Let's say I've read in a textfile using a TextLineReader
. Is there some way to split this into train and test sets in Tensorflow
? Something like:
def read_my_file_format(filename_queue):
reader = tf.TextLineReader()
key, record_string = reader.read(filename_queue)
raw_features, label = tf.decode_csv(record_string)
features = some_processing(raw_features)
features_train, labels_train, features_test, labels_test = tf.train_split(features,
labels,
frac=.1)
return features_train, labels_train, features_test, labels_test
Something like the following should work:
tf.split_v(tf.random_shuffle(...
Edit: For tensorflow>0.12 This should now be called as tf.split(tf.random.shuffle(...
See docs for tf.split and for tf.random.shuffle for examples.