Complete the code to load a dataset from a CSV file using TensorFlow.
dataset = tf.data.experimental.make_csv_dataset('data.csv', batch_size=[1])
The batch size controls how many samples are loaded at once. 32 is a common batch size.
Complete the code to shuffle the dataset with a buffer size of 1000.
dataset = dataset.shuffle(buffer_size=[1])Shuffling with a buffer size of 1000 ensures good mixing of data.
Fix the error in the code to map a function that normalizes features.
def normalize(features, label): features = tf.cast(features, tf.float32) / [1] return features, label dataset = dataset.map(normalize)
Dividing by 255.0 normalizes pixel values from 0-255 to 0-1.
Fill both blanks to batch the dataset and repeat it indefinitely.
dataset = dataset.[1](batch_size=32).[2]()
First batch the dataset, then repeat it indefinitely for training.
Fill all three blanks to create a dataset from text files, shuffle, and batch it.
files = tf.data.Dataset.list_files([1]) dataset = files.interleave(tf.data.TextLineDataset, cycle_length=4) dataset = dataset.[2](buffer_size=1000).[3](batch_size=64)
Use list_files with a pattern to find text files, then shuffle and batch the dataset.
