0Pricing
NLP Academy · Lección

Lectura de la matriz de confusión

Ver exactamente dónde se equivoca el modelo

Lectura de la matriz de confusión es una lección gratuita de NLP Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de NLP Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de NLP Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

The Whole Picture

The confusion matrix is a small table showing every prediction sorted by what was true and what you guessed. It reveals exactly where errors live.

Rows and Columns

Rows are the true labels and columns are the predicted ones. Each cell counts how many examples fell into that true-versus-predicted combination.

The Four Cells

For two classes you get four counts: true positives, true negatives, and the two error types. Every metric you know is built from these.

True Positive

A true positive is a real positive you correctly flagged, like real spam sent straight to the spam folder. A clean win.

True Negative

A true negative is a real negative you correctly left alone, like a normal email that stays safely in the inbox.

False Positive

A false positive is a false alarm: you flagged something that was actually negative, like a real email wrongly marked as spam.

False Negative

A false negative is a miss: a real positive you let slip through, like spam that lands in the inbox unflagged.

The Diagonal Tells All

Correct predictions sit on the diagonal. A strong model concentrates counts there and leaves the off-diagonal cells nearly empty.

Build It in Python

scikit-learn assembles the matrix from your true and predicted labels in a single call.

from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_true, y_pred)

Make It Readable

A plotted matrix makes errors jump out, so you instantly see which class gets confused for which.

from sklearn.metrics import ConfusionMatrixDisplay
ConfusionMatrixDisplay(cm).plot()

Spotting the Weak Spot

Read off-diagonal cells to find the model blind spot. A large false-negative count, for example, warns you that real positives are being missed.

Quick Check

Name the error type from the description.

Recap

The confusion matrix splits results into four cells. The diagonal holds wins; off-diagonal cells expose exactly where your model errs. 🔍

Preguntas frecuentes

¿La lección «Lectura de la matriz de confusión» es gratis?

Sí — el texto completo de «Lectura de la matriz de confusión» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de NLP Academy, actualiza a CoddyKit PRO. El curso de NLP Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Lectura de la matriz de confusión»?

Ver exactamente dónde se equivoca el modelo Practicas NLP Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar NLP Academy?

No se requiere experiencia previa. NLP Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.

¿Cuánto tiempo toma la lección «Lectura de la matriz de confusión»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de NLP Academy?

Sí. Cada lección de NLP Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Por qué la precisión puede engañar
  2. Precisión, exhaustividad y F1
  3. Lectura de la matriz de confusión
  4. Validación cruzada bien hecha
← Volver a NLP Academy