liveBook · Manning

Evaluation dataset

As explained in Effective Data Analysis

A validation set is a dataset reserved for assessing or tuning a model after training and before final evaluation or deployment.

An evaluation dataset is held-out data used to assess how well a predictive model performs on examples it did not use for fitting. In the example, an 80/20 split reserves the test set for this check. section 9.3.2

A practical evaluation workflow:

  • Fit the model on training data, then predict outcomes for the held-out set. section 9.3.2
  • Compare predictions with actual values; RMSE and R-squared are used to assess performance. section 9.3.2
  • Compare training and test performance to check whether accuracy carries over to unseen data. section 9.3.2
from sklearn.metrics import mean_squared_error    #1

y_pred_train = model.predict(X_train)
y_pred = model.predict(X_test)     #2

r2_train = model.score(X_train, y_train) 
r2_test = model.score(X_test, y_test)    #3

rmse_train = np.sqrt(mean_squared_error(y_train, y_pred_train))
rmse_test = np.sqrt(mean_squared_error(y_test, y_pred))     #4

print(f"Training Set RMSE: {rmse_train}")
print(f"Test Set RMSE: {rmse_test}")
print(f"Training Set R-squared: {r2_train}")
print(f"Test Set R-squared: {r2_test}")

The example calculates RMSE and R-squared for both training and test sets. section 9.3.2

How Effective Data Analysis covers it

How deep it goes
Works through an 80/20 split, fitting, prediction, and metric comparison, without describing a separate tuning set.
Examples
Uses weather predictors to estimate rat-sighting complaints and compares training and test metrics.
What you can do after
Evaluate predictive performance on unseen data by comparing predictions with actual values and training-set results.
How it connects
Connects predictive modeling and regression evaluation with RMSE and R-squared.

Also explained in

Compare how 27 books explain evaluation dataset →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Data Analysis. The section links point to the parts of the book it draws on.