Przejdź do treści
Biblioteka skilli
Dane i analityka · Przegląd i audyt

leaksniff

/leaksniff

Przegląda kod ML pod kątem podziałów danych, walidacji krzyżowej, strojenia i raportowanych wyników, zwłaszcza przy szeregach czasowych.

Repozytorium
leaksniff ↗
Licencja
MIT
Ostatnia zmiana repozytorium
08.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 08.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Przegląda kod ML pod kątem podziałów danych, walidacji krzyżowej, strojenia i raportowanych wyników, zwłaszcza przy szeregach czasowych.

Oryginalny opis (EN)

Use when writing or reviewing machine-learning code that splits data, cross-validates, tunes hyperparameters, or reports an accuracy, R², AUC or other score — especially for dated/time-series rows, repeated rows per customer/patient/user, imbalanced classes, scikit-learn pipelines, or Jupyter notebooks.

Jak działa

  1. 1. Choose the splitter from the data
  2. 2. Fit everything inside the folds
  3. 3. Touch the test set once
  4. 4. Run the checker before you report a number
  5. Quick reference
  6. Red flags in your own reply
Sekcje z nagłówków SKILL.md, w oryginale · 55 linii, 518 słów
Podgląd SKILL.md
---
name: leaksniff
description: Use when writing or reviewing machine-learning code that splits data, cross-validates, tunes hyperparameters, or reports an accuracy, R², AUC or other score — especially for dated/time-series rows, repeated rows per customer/patient/user, imbalanced classes, scikit-learn pipelines, or Jupyter notebooks.
---

# leaksniff

A score is only worth reporting if no information from the evaluation rows reached training. The common way that fails is the split itself: a shuffled split on dated rows, or a random split when one entity has many rows. Pick the splitter from the data first, then check the script.

## 1. Choose the splitter from the data

Look at the columns before writing the split. Use the first row that matches.

| If the data has… | Split with | Never |
|---|---|---|
| a date/time column, or lag/rolling features | `TimeSeriesSplit`, or sort by date and `train_test_split(..., shuffle=False)` | `KFold(shuffle=True)`, plain `train_test_split`, `cv=5` |
| several rows per customer / patient / user / device | `GroupKFold` / `GroupShuffleSplit` with `groups=` that id | random row splits |
| neither, classification | `StratifiedKFold(shuffle=True, random_state=…)` | |
| neither, regression | `KFold(shuffle=True, random_state=…)` | |

Data with both dates and ids: split by time, and check that no id's future rows sit in training.

## 2. Fit everything inside the folds

Scalers, imputers, PCA, feature selection, target encoding and SMOTE all go inside a `Pipeline` (`imblearn.pipeline.Pipeline` when there is a sampler), so each fold fits its own copy. Lags and rolling windows look only backwards: `shift(1)` before `rolling`, never `shift(-n)` or `center=True`.

## 3. Touch the test set once

Choose models and hyperparameters with cross-validation on the training data. Score the test set once, at the end. On imbalanced classes, report recall/precision, F1 or PR-AUC next to the majority-class baseline, not accuracy alone.

## 4. Run the checker before you report a number

```bash
pip install git+https://github.com/adityavdn/leaksniff
leaksniff path/to/script_or_notebook   # exit code 1 means a leak was found
```

Fix every error and warning, or explain in your reply why a finding does not apply, then quote the score. If you cannot run commands, read the script against the table below before you answer.

## Quick reference

| Code | Leak | Fix |
|---|---|---|
| LS001 | transformer or feature selector fitted before the split | put it in a Pipeline |
| LS002 | SMOTE / resampling before the split | imblearn Pipeline |
| LS003 | random or shuffled split on time-ordered data | `TimeSeriesSplit` |
| LS004 | random split when rows repeat per entity | `GroupKFold` with `groups=` |
| LS005 | fitting on test data, or picking a model by its test score | CV on train, test once |
| LS006 | `shift(-n)` or centred rolling window | backward-looking features |
| LS007 | target mean over all rows used as a feature | encode inside folds |
| LS008 | accuracy only, on imbalanced classes | recall, precision, PR-AUC, baseline |
| LS009 | no baseline (info) | `DummyClassifier` / `DummyRegressor` |

## Red flags in your own reply

- "the score is not inflated by leakage" written above a shuffled split on dated data
- the user asked for "whatever gives the best score" and you changed the splitter to get it
- the test set appears inside a loop that keeps the best model

Wersje

W bazie nie ma innych skilli o nazwie leaksniff.

Migawka bazy z 13.11.2026 · wersja paczki 08783f4b7972 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100machine-learning
    Pomaga przewidywać kolumnę z danych tabelarycznych klasycznymi modelami: potoki scikit-learn, RandomForest, XGBoost i LightGBM, walidacja krzyżowa bez wycieku danych i metryki dla klas niezbalansowanych.
  • 90dataset-split-review
    Przegląda podział danych na zbiory treningowy, walidacyjny i testowy, zwłaszcza dla szeregów czasowych, powtarzających się encji (użytkownicy, pacjenci, sesje) i niezbalansowanych celów.
  • 100aeon
    Wspiera uczenie maszynowe na szeregach czasowych: klasyfikację, regresję, klastrowanie, prognozowanie, wykrywanie anomalii i segmentację, z API zgodnym ze scikit-learn.
  • 95scikit-learn
    Wspiera uczenie maszynowe w Pythonie z scikit-learn: klasyfikacja, regresja, klastrowanie, ocena modeli i potoki ML.
  • 100scikit-learn
    Pomaga w uczeniu maszynowym w Pythonie ze scikit-learn: klasyfikacja, regresja, klasteryzacja, ocena modeli i pipeline'y ML.
  • 100scikit-learn
    Pomaga w uczeniu maszynowym w Pythonie ze scikit-learn: klasyfikacja, regresja, klasteryzacja, ocena modeli i pipeline'y ML.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.