ComenzarEmpieza gratis

Precision vs. recall

The accuracy metrics you use to evaluate your model should always be based on the specific application. For this example, let's assume you are a really sore loser when it comes to playing Tic-Tac-Toe, but only when you are certain that you are going to win.

Choose the most appropriate accuracy metric, either precision or recall, to complete this example. But remember, if you think you are going to win, you better win!

Use rfc, which is a random forest classification model built on the tic_tac_toe dataset.

Este ejercicio forma parte del curso

Model Validation in Python

Ver curso

Instrucciones del ejercicio

  • Import the precision or the recall metric for sklearn. Only one method is correct for the given context.
  • Calculate the precision or recall using y_test for the true values and test_predictions for the predictions.
  • Print the final score based on your selected metric.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

from sklearn.metrics import ____

test_predictions = rfc.predict(X_test)

# Create precision or recall score based on the metric you imported
score = ____(____, ____)

# Print the final result
print("The ____ value is {0:.2f}".format(____))
Editar y ejecutar código