Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save securetorobert/3b8a9a0436e8f51862863a266970c225 to your computer and use it in GitHub Desktop.
Save securetorobert/3b8a9a0436e8f51862863a266970c225 to your computer and use it in GitHub Desktop.
Neural Network with Keras on Boston Housing data
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
import tensorflow as tf
#read in training data
train_df = pd.read_csv('train.csv', index_col='ID')
train_df.head()
target = 'medv'
scaler = MinMaxScaler(feature_range=(0, 1))
scaled_train = scaler.fit_transform(train_df)
# Print out the adjustment that the scaler applied to the total_earnings column of data
print("Note: median values were scaled by multiplying by {:.10f} and adding {:.6f}".format(scaler.scale_[13], scaler.min_[13]))
multiplied_by = scaler.scale_[13]
added = scaler.min_[13]
scaled_train_df = pd.DataFrame(scaled_train, columns=train_df.columns.values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment