Created
September 16, 2018 02:08
-
-
Save b0noI/7f733bd191f548c1d20e87d02579012a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
import pandas as pd | |
FEATURES = ["SqFt", "Bedrooms", "Offers"] | |
LABEL = "Price" | |
feature_cols = [tf.feature_column.numeric_column(k) for k in FEATURES] | |
estimator = tf.estimator.LinearRegressor( | |
feature_columns=feature_cols, | |
model_dir="train") | |
def get_input_fn(data_set): | |
return tf.estimator.inputs.pandas_input_fn( | |
x=pd.DataFrame({k: data_set[k].values for k in FEATURES}), | |
y=pd.Series(data_set[LABEL].values), | |
batch_size=10, | |
num_epochs=100, | |
shuffle=True) | |
estimator.train(input_fn=get_input_fn(house_pricing)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment