0Pricing
Data Science Academy · Lekcja

Macierz pomyłek bez tajemnic

Prawdziwie i fałszywie dodatnie oraz ujemne wyniki

Macierz pomyłek bez tajemnic to bezpłatna lekcja Data Science Academy na CoddyKit. To lekcja 2 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Data Science Academy, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Data Science Academy zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

Beyond a Single Number

For classifiers, one accuracy score hides too much. The confusion matrix lays out exactly which predictions were right and which were wrong. 🧩

A Simple Grid

The matrix is a small grid: rows are the true classes, columns are the predicted ones. Each cell counts how often that pairing happened.

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

True Positives

A true positive is when the model says yes and the answer really is yes. These are the wins you want to maximize.

True Negatives

A true negative is when the model says no and the truth is also no. The model correctly left this case alone.

False Positives

A false positive is a false alarm: the model predicted yes, but the truth was no. Think of flagging a healthy patient as sick.

False Negatives

A false negative is a miss: the model said no while the truth was yes. Picture letting a real fraud slip through unnoticed.

Two Kinds of Mistakes

Notice the two error types differ in cost. A false positive and a false negative are rarely equal, so the matrix keeps them separate.

Where Accuracy Lives

Accuracy is just the correct cells over the total. It is the diagonal divided by everything, which is why it can mask rare errors.

accuracy = (TP + TN) / (TP + TN + FP + FN)

Read the Off-Diagonal

The most useful cells sit off the diagonal: they show where the model confuses one class for another, pointing to its weak spots.

See It as a Heatmap

For many classes, plot the matrix as a heatmap. Bright off-diagonal squares instantly reveal which labels get mixed up most.

from sklearn.metrics import ConfusionMatrixDisplay
ConfusionMatrixDisplay.from_predictions(y_true, y_pred)

Your Metric Foundation

Almost every classification metric is built from these four counts. Master the confusion matrix and the rest follow naturally.

Quick Check

Let's make sure each cell of the matrix is crystal clear.

Recap

The confusion matrix splits results into true and false, positive and negative. Those four counts power every classification metric. 🎯

Często zadawane pytania

Czy lekcja „Macierz pomyłek bez tajemnic” jest bezpłatna?

Tak — pełny tekst „Macierz pomyłek bez tajemnic” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Data Science Academy, przejdź na CoddyKit PRO. Kurs Data Science Academy zawiera 4 lekcji w sumie.

Co nauczysz się w „Macierz pomyłek bez tajemnic”?

Prawdziwie i fałszywie dodatnie oraz ujemne wyniki Ćwiczysz Data Science Academy z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Data Science Academy?

Nie wymagamy żadnego doświadczenia. Data Science Academy w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 2 z 4.

Ile czasu zajmuje lekcja „Macierz pomyłek bez tajemnic”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Data Science Academy?

Tak. Każda lekcja Data Science Academy zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Metryki regresji: MAE, MSE, R2
  2. Macierz pomyłek bez tajemnic
  3. Precision, Recall i F1
  4. ROC, AUC i progi
← Powrót do Data Science Academy