Tensorflow - Python:我如何在TensorFlow中使用自己的数据?

问题描述:

我是新的TensorFow,但我必须使用它,所以我有一个问题。Tensorflow - Python:我如何在TensorFlow中使用自己的数据?

我有一个CSV文件,它看起来像使用特定的数据:

0.5,1,0,0,Slow_Start

1,2,0,0,Slow_Start

1.5, 4,0,0,Slow_Start

2,8,0,0,Slow_Start

(Slow_Start是标签我必须使用中的一个)。

我用下面的代码

directory = "/home/matthieu/Documents/python/*.csv" 
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once(directory), 
shuffle=False) 
line_reader = tf.TextLineReader() 

_, csv_row = line_reader.read(filename_queue) 
record_defaults = [[0.0], [0.0], [0.0], [0.0], [""]] 
time, cwnd, rtt, dupack, Algo = \ 
tf.decode_csv(csv_row, record_defaults=record_defaults) 
features = tf.pack([ 
    time, 
    cwnd, 
    rtt, 
    dupack]) 

with tf.Session() as sess: 
    tf.initialize_all_variables().run() 

    coord = tf.train.Coordinator() 
    threads = tf.train.start_queue_runners(coord=coord) 

    # we grab an example from the CSV file. 
    for iteration in range(1, 50): 

     example, label = sess.run([features, Algo]) 
     print(example, label) 

    coord.request_stop() 
    coord.join(threads) 

成功导入我的数据,但我没有对我有多么的数据都是存储以及如何使用它来制作与型动物标签多类分类中的任何想法,知道我的数据代表一个窗口的大小与时间的比较,所以不需要改动。

我不知道我是否清楚,但任何帮助将是非常好的,谢谢!

skflow examples上有很多示例可用。确保你的数据格式正确。