Python:如何将自己的数据用于Tensorflow?
我是TensorFow的新手,但我必须使用它,所以我有一个问题 我必须在csv文件中使用特定数据,如下所示: 0.5,1,0,0,慢速启动 1,2,0,0,慢启动 1.5,4,0,0,慢速启动 2,8,0,0,慢启动 (慢启动是我必须使用的标签之一) 我使用以下代码成功导入数据Python:如何将自己的数据用于Tensorflow?,python,tensorflow,Python,Tensorflow,我是TensorFow的新手,但我必须使用它,所以我有一个问题 我必须在csv文件中使用特定数据,如下所示: 0.5,1,0,0,慢速启动 1,2,0,0,慢启动 1.5,4,0,0,慢速启动 2,8,0,0,慢启动 (慢启动是我必须使用的标签之一) 我使用以下代码成功导入数据 directory = "/home/matthieu/Documents/python/*.csv" filename_queue = tf.train.string_input_producer( tf.train.
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)
但是我不知道我的数据是如何存储的,也不知道如何使用它来生成具有不同标签的多类分类,因为我知道我的数据代表了一个窗口相对于时间的大小,所以它不必被洗牌
我不知道我是否清楚,但任何帮助都会很好,谢谢