Complete the code to show how AI learns from training data.
model.fit([1], labels, epochs=5)
The model learns patterns from the training_data. Using test or validation data here would not train the model.
Complete the code to split data into training and testing sets.
train_data, test_data = data.[1](test_size=0.2)
The function train_test_split divides data into training and testing parts, which is essential for evaluating AI behavior.
Fix the error in the code that trains a model with biased data.
if data.is_biased(): model.[1](data)
The method fit is used to train the model on data. Using 'train' or 'predict' here is incorrect syntax or purpose.
Fill both blanks to create a dictionary showing word lengths only for words longer than 3 letters.
{word: [1] for word in words if len(word) [2] 3}We want the length of each word as the value, so len(word) is correct. The condition len(word) > 3 filters words longer than 3 letters.
Fill all three blanks to create a filtered dictionary of words and their lengths where length is greater than 4.
filtered = { [1]: [2] for [3] in words if len([3]) > 4 }The dictionary keys are words (word), values are their lengths (len(word)), and the loop variable is word. Using 'item' would cause a mismatch.