imbalanced-data
/imbalanced-data
Obsługuje niezrównoważone klasy przez przesuwanie progu, ważenie i ocenę opartą na krzywej PR zamiast odruchowego resamplingu, gdy klasa pozytywna jest rzadka, a trafność wygląda zwodniczo wysoko.
- Autor
- Amey-Thakur ↗
- Repozytorium
- AI-SKILLS ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 05.09.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Obsługuje niezrównoważone klasy przez przesuwanie progu, ważenie i ocenę opartą na krzywej PR zamiast odruchowego resamplingu, gdy klasa pozytywna jest rzadka, a trafność wygląda zwodniczo wysoko.
Oryginalny opis (EN)
Handle skewed classes with threshold moving, weighting, and PR-based evaluation instead of reflexive resampling. Use when the positive class is rare and accuracy looks deceptively high.
Jak działa
- Method
- Boundaries
Podgląd SKILL.md
--- name: imbalanced-data description: Handle skewed classes with threshold moving, weighting, and PR-based evaluation instead of reflexive resampling. Use when the positive class is rare and accuracy looks deceptively high. --- # Imbalanced data With 1% positives, "always predict negative" scores 99% accuracy. The cure is rarely synthetic data; it is evaluating correctly, weighting costs, and choosing the operating threshold deliberately. ## Method 1. **Fix the evaluation first.** PR curves and PR-AUC, precision and recall at the deployment threshold, per the cost table from ml-problem-framing; never accuracy, and treat ROC-AUC with suspicion at heavy skew (it barely moves when false positives grow by thousands against a huge negative pool). Keep the test set at the *natural* imbalance whatever you do to train (see train-test-discipline). 2. **Move the threshold before touching the data.** A well-calibrated model at natural imbalance plus a cost-derived threshold (minimize expected cost on validation) solves many "imbalance problems" outright. Sweep the threshold, plot cost vs threshold, pick the minimum; revisit when costs or base rates change. 3. **Weight before you resample.** Class weights (inverse-frequency or cost-ratio) in the loss are equivalent to oversampling without duplicating rows, supported natively by most learners (`class_weight`, `scale_pos_weight`). This is the default second move; it changes nothing about the data pipeline. 4. **Resample only with care, inside the fold.** Random undersampling of negatives works at massive scale (and speeds training); SMOTE-class synthesis helps sometimes on tabular data and harms whenever synthetic points cross the true boundary. All resampling fits inside cross-validation folds on train only; resampling before splitting leaks duplicated/synthetic neighbors into test (see cross-validation). 5. **Recalibrate after any reweighting.** Weights and resampling distort predicted probabilities away from true base rates; if probabilities feed thresholds or expected values, recalibrate on an untouched validation slice (see model-evaluation calibration). 6. **Buy more positives where it is cheapest.** Longer time windows, related-event labels, hard-negative mining to sharpen the boundary, or targeted labeling of model-uncertain cases (active learning); a hundred real positives beat ten thousand synthetic ones. At extreme rarity (<0.01%), reconsider the frame: anomaly detection or tiered rules-then-model funnels (see ml-problem-framing). ## Boundaries - Imbalance is not the problem when both classes are plentiful in absolute terms; a 1:100 ratio with a million positives needs nothing special. - If the minority class is undersampled *in collection* (label bias, censoring), no algorithm recovers what was never observed; that is a data acquisition problem. - Base rates drift; a threshold tuned at 1% positives misfires at 3% (see drift-monitoring), so monitor the rate itself.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · Amey-Thakur/AI-SKILLS | 90 | MIT |
| param087/agent-ml-skills | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 8f0adaec3cc3 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 85model-evaluation
Ocenia klasyfikatory i regresory uczciwie: macierz pomyłek, precyzję, czułość, F1, ROC-AUC wobec PR-AUC, kalibrację i przedziały ufności. - 100class-imbalance-handling-for-rare-signal-events
Obsługuje niezbalansowane klasy przy przewidywaniu rzadkich zdarzeń, takich jak zatrzymania handlu lub flash crash: ważenie kosztów, undersampling i rekalibracja prawdopodobieństw.