tf.keras.utils.get_file直接从URL下载资源
TRAIN_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/train.csv"
TEST_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/eval.csv"
train_file_path = tf.keras.utils.get_file("train.csv", TRAIN_DATA_URL)
test_file_path = tf.keras.utils.get_file("eval.csv", TEST_DATA_URL)
clf.fit(
# The path to the train.csv file.
train_file_path,
# The name of the label column.
'survived',
epochs=3)
predicted_y = clf.predict(test_file_path)