Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xgboost example for hyperparameter tuning #476

Merged
merged 4 commits into from
Jan 15, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix xgboost for hp tuning
  • Loading branch information
richardsliu committed Jan 14, 2019
commit 9e1ee205126e6b8bf78baf7e1fcdc3ea49cd9852
5 changes: 3 additions & 2 deletions xgboost_ames_housing/housing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def read_input(file_name, test_size=0.25):

train_X, test_X, train_y, test_y = train_test_split(X.values,
y.values,
test_size=test_size)
test_size=test_size,
shuffle=False)

imputer = Imputer()
train_X = imputer.fit_transform(train_X)
Expand Down Expand Up @@ -61,7 +62,7 @@ def train_model(train_X,
def eval_model(model, test_X, test_y):
"""Evaluate the model performance."""
predictions = model.predict(test_X)
print("MAE on test: {:.2f}".format(mean_absolute_error(predictions, test_y)))
print("mean_absolute_error={:.2f}".format(mean_absolute_error(predictions, test_y)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the logging module rather than print?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


def save_model(model, model_file):
"""Save XGBoost model for serving."""
Expand Down