Final Model Evaluation: Metrics

How do we evaluate a trained model using metrics?

Answer

Final evaluation of a trained model is done using the metric functions in the sklearn.metrics subpackage.

These functions take two parameters: y_test and y_pred.

Python
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import LinearRegression

model = LinearRegression()
model.fit(X_train, y_train)

y_pred = model.predict(X_test)

mse = mean_squared_error(y_test, y_pred)
print(mse)
Back to collection