Closed Ed4Piksel closed 6 years ago
just change the "skip_header_lines=1" to 0 on line "reader = tf.TextLineReader(skip_header_lines=1)" because there are/is no header line(s). Before that I had to change the filename_queue to "filename_queue= tf.train.string_input_producer([os.path.join(os.getcwd() , file_name)])".
greets
Hello, Thanks for this great ebook,
I am also having this problem : tensorflow.python.framework.errors.OutOfRangeError: RandomShuffleQueue
And cannot find a way to resolve it, any idea ?
OK I think I just found out that the data file downloaded had 2 extra blank line that kill the read_csv def !! Hope that this can help others...
@kochraph Thank you. That really helps. I got 1 extra blank line at the end of the file and I couldn't find the solution for an hour. I don't know why it cannot process this situation properly. All my error information starts from Expect 5 fields but have 0 in record 0
, which I didn't know what it meant at all. Anyway, deleting the blank line made it work.
Thank you for your comments. I've added a comment in the example file requesting to remove the empty line of the bottom when you download the dataset file.
File reading broken, batch size broken on fix file read as per attached
Softmax example in TF using the classical Iris dataset
Download iris.data from https://archive.ics.uci.edu/ml/datasets/Iris
import tensorflow as tf import os
this time weights form a matrix, not a column vector, one "weight vector" per class.
W = tf.Variable(tf.zeros([4, 3]), name="weights")
so do the biases, one per class.
b = tf.Variable(tf.zeros([3], name="bias"))
def combine_inputs(X): return tf.matmul(X, W) + b
def inference(X): return tf.nn.softmax(combine_inputs(X))
def loss(X, Y): return tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(combine_inputs(X), Y))
def read_csv(batch_size, file_name, record_defaults): filename_queue = tf.train.string_input_producer([file_name])
def inputs():
def train(total_loss): learning_rate = 0.01 return tf.train.GradientDescentOptimizer(learning_rate).minimize(total_loss)
def evaluate(sess, X, Y):
Launch the graph in a session, setup boilerplate
with tf.Session() as sess:
loss:
OutOfRangeError Traceback (most recent call last)