0

I want to split my full dataset(every raw data has multiple features) into train and test sets. Rather than using scikit-learn 's train-test-split is there any other proper way to split my data? as well as I need to shuffle my data when splitting. (If the suggested method is based on tensorflow, it's too better.)

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Dale Steyn
  • 51
  • 1
  • 5

1 Answers1

1

Try this code:

import tensorflow as tf
input = tf.random.uniform([100, 5], 0, 10, dtype=tf.int32)
input = tf.random.shuffle(input)
train_ds = input[:90]
test_ds = input[-10:]
Andrey
  • 5,932
  • 3
  • 17
  • 35