I have been doing the basic linear regression TensorFlow tutorial: https://www.tensorflow.org/tutorials/estimator/linear And I have arrived at the end whereas I have created an evaluation set input function and a feature column and have predicted the probabilities of the evaluation set. However, one thing I don't understand is that, machine learning is supposed to train using the training set and then predict labels using features and thus extrapolate in a sense. However, I'm feeding it both labels and features through my evaluation function:
def make_input_fn(data_df, label_df, num_epochs=10, shuffle=True, batch_size=32):
def input_function():
ds = tf.data.Dataset.from_tensor_slices((dict(data_df), label_df))
if shuffle:
ds = ds.shuffle(1000)
ds = ds.batch(batch_size).repeat(num_epochs)
return ds
return input_function
train_input_fn = make_input_fn(dftrain, y_train)
dfeval = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/eval.csv")
y_eval = dfeval.pop("survived")
eval_input_fn = make_input_fn(dfeval, y_eval, 1, False)
...
result = list(linear_est.predict(eval_input_fn))
How may I feed my model a single input node and get back a predicted output label? As in, instead of getting a probability back, I get an actual value back.