ComenzarEmpieza gratis

Performance on multi-class classification

In this exercise, you will compute the performance metrics for models using the module sklearn.metrics.

The model is already trained and stored in the variable model. Also, the variables X_test and y_true are also loaded, together with the functions confusion_matrix() and classification_report() from sklearn.metrics package.

You will first compute the confusion matrix of the model. Then, to summarize a model's performance, you will compute the precision, recall and F1-score using the classification_report() function. In this function, you can optionally pass a list containing the classes names (they are stored it in the news_cat variable) to the parameter target_names to make the report more readable.

Este ejercicio forma parte del curso

Recurrent Neural Networks (RNNs) for Language Modeling with Keras

Ver curso

Ejercicio interactivo práctico

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

# Use the model to predict on new data
____ = model.____(X_test)

# Choose the class with higher probability 
y_pred = np.____(predicted, axis=1)
Editar y ejecutar código