1. # Scale data
  2. from sklearn.preprocessing import StandardScaler
  3. scale = StandardScaler()
  4. all_dummies_scaled = all_dummies.copy()
  5. all_dummies_scaled[['Age','SibSp','Parch','norm_fare']]= scale.fit_transform(
  6. all_dummies_scaled[['Age',
  7. 'SibSp','Parch','norm_fare']])
  8. X_train_scaled = all_dummies_scaled[all_dummies_scaled.train_test == 1].drop(['train_test'], axis =1)
  9. X_test_scaled = all_dummies_scaled[all_dummies_scaled.train_test == 0].drop(['train_test'], axis =1)
  10. y_train = all_data[all_data.train_test==1].Survived
Comments powered by Disqus