4

Google just opened up TensorFlow as opened source. I read it a bit but looks like you can only train it with their given MNIST data.

I am looking for example code where i can train with my own data, and output results for my test file.

where I have .csv file (like a sample per line) as training data (with id,output,+72 more columns)

and have another .csv file for test data where i'd to predict output(1 or 0).

Anyone understand that TensorFlow enough to give me some sample code?

5
  • yeah i read the tutorials but i don't see examples of where you use your data. I am sure there's a way somewhere just can't find it. The very beginning tutorial just shows how you to use the MNIST dataset.
    – Tin Tran
    Commented Nov 10, 2015 at 23:12
  • 1
    Just by looking at the data for MNIST it is pretty clear how do they download and construct the data. At the very worse, you can just take your own images, save them the same way as the mist is saved. A little bit better is too look how the data looks like right before feeding it to the NN and construct your own in a similar fashion. Commented Nov 10, 2015 at 23:18
  • 1
    How do you get out of their docs that you can only use it given their MNIST data? It clearly states, multiple times, that it's simply an example. "In the land of neural networks the most "classic" classical [sic] problem is the MNIST handwritten digit classification. We offer two introductions here, one for machine learning newbies, and one for pros. If you've already trained dozens of MNIST models in other software packages, please take the red pill. If you've never even heard of MNIST, definitely take the blue pill." Commented Nov 10, 2015 at 23:20
  • maybe i need to re read that stuff...it's all very new to me.
    – Tin Tran
    Commented Nov 10, 2015 at 23:23
  • 1
    it's all very new to me Does that mean just TensorFlow, or Deep Learning, or Neural Networks. Check out the StackOverflow TensorFlow info tag. I have been adding links to introductory material to help new people
    – Guy Coder
    Commented Jan 29, 2016 at 11:56

3 Answers 3

5

The best solution I have found is:

https://github.com/google/skflow

Charles

0

You can have a look at those examples (like linear regression): https://github.com/aymericdamien/TensorFlow-Examples

But, for examples using mnist, you just need to replace inputs (train and test mnist data by your own data arrays).

0
0

Ok, here is the code sample from the site for csv. You need to use TextLineReader to handle the csv format if that is what you are interested in and it sounds like you are. For all of your options to read files, the link is here

filename_queue = tf.train.string_input_producer(["file0.csv", "file1.csv"])

reader = tf.TextLineReader()
key, value = reader.read(filename_queue)

# Default values, in case of empty columns. Also specifies the type of the
# decoded result.
record_defaults = [[1], [1], [1], [1], [1]]
col1, col2, col3, col4, col5 = tf.decode_csv(
    value, record_defaults=record_defaults)
features = tf.concat(0, [col1, col2, col3, col4])

with tf.Session() as sess:
  # Start populating the filename queue.
  coord = tf.train.Coordinator()
  threads = tf.train.start_queue_runners(coord=coord)

  for i in range(1200):
    # Retrieve a single instance:
    example, label = sess.run([features, col5])

  coord.request_stop()
  coord.join(threads)
3
  • The link doesn't seem to work...
    – Isilmë O.
    Commented Nov 21, 2015 at 9:20
  • I click on it right now and it still works for me, although it redirects me to tensorflow.org now. Links from that site have not proven to be too predictable in its young life.
    – demongolem
    Commented Nov 21, 2015 at 21:04
  • Yes basically it's still correct, but they switched to hash representation like #reading_data.
    – Isilmë O.
    Commented Nov 24, 2015 at 12:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.