NearMiss Undersampling
NearMiss balances classes by keeping only some rows of the larger classes, chosen by their distance to the minority class. Version 1 keeps the rows closest to their nearest minority rows, version 2 those closest to their farthest minority rows, and version 3 keeps the nearest neighbours of each minority row and then the most distant of these.
니어미스는 큰 범주의 행 가운데 소수 범주와의 거리로 고른 일부만 남겨 범주 크기를 맞춥니다. 1판은 가장 가까운 소수 행들과의 평균 거리가 짧은 행을, 2판은 가장 먼 소수 행들과의 평균 거리가 짧은 행을 남기고, 3판은 소수 행마다 가까운 이웃을 먼저 고른 뒤 그 가운데 소수 범주에서 가장 먼 행을 남깁니다.
If I shrink the majority class with NearMiss, does a classifier find the minority class better?
니어미스로 다수 범주를 줄이면 분류기가 소수 범주를 더 잘 찾아냅니까?
The method reports how many rows each class keeps and compares balanced accuracy, macro F1 and minority recall of a classifier trained on the original, NearMiss-reduced and randomly reduced training folds.
When to use NearMiss Undersampling
- One class is much rarer and the classifier ignores it.
- You want an informed alternative to random undersampling.
When to use something else
- You prefer to keep all rows and reweight: use Imbalanced Classification (Resampling and Class Weights)
- You want to remove only noisy majority rows: use Edited Nearest Neighbours Undersampling
Assumptions and requirements
- Numeric features on which Euclidean distance is meaningful (they are standardised)
- Resampling happens inside training folds only
- The test data keep their natural class balance
What the analysis reports
- Rows kept and removed per class
- Imbalance ratio before and after
- Cross-validated comparison with the original and random undersampling
How to report it
NearMiss-[value] reduced the data from [value] to [value] rows; in 5-fold cross-validation balanced accuracy was [value] with the original and [value] with NearMiss training folds.
Related methods
- Imbalanced Classification (Resampling and Class Weights)
- Edited Nearest Neighbours Undersampling
- Condensed Nearest Neighbour Undersampling
- K-Nearest Neighbors (KNN)
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with direct computations (formulas, enumeration or simulation).
독립 계산. 직접 계산(식·열거·모의실험) 대조 참조 시험 1건 통과.
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run NearMiss Undersampling on Quorant
- Data you need
- a table (CSV or Excel) with an outcome variable and predictor (feature) columns
- Price
- 400 credits for one analysis up to 10,000 rows (complexity level 3); larger or wider data costs more. Optional methodologist review: 1800 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.