5
我是新的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)
成功導入我的數據,但我沒有對我有多麼的數據都是存儲以及如何使用它來製作與型動物標籤多類分類中的任何想法,知道我的數據代表一個窗口的大小與時間的比較,所以不需要改動。
我不知道我是否清楚,但任何幫助將是非常好的,謝謝!