0
$\begingroup$

so I'm following the official keras tutorial here. However I couldn't really understand the subset and validation_split arguments of tf.keras.preprocessing.text_dataset_from_directory.

How I use them is:

raw_train_ds = tf.keras.preprocessing.text_dataset_from_directory(
    "aclImdb/train",
    batch_size=BATCH_SIZE,
    validation_split=0.2,
    subset="training",
    seed=1337
)

raw_val_ds = tf.keras.preprocessing.text_dataset_from_directory(
    "aclImdb/train",
    batch_size=BATCH_SIZE,
    validation_split=0.2,
    subset="validation",
    seed=1337
)

As I understand we're trying to split train data into validation of its 0.2. However we do the same for both "training" and "validation" subsets on same dataset with the same validation_split value which is 0.2. So isn't it supposed to take 0.2 of training data to raw_train_ds and 0.2 to raw_val_ds instead of 0.8, 0.2?

I checked the documentation from here which was not really useful. I also couldn't find any related questions. How does this work exactly?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.