OversamplingBase<T>
Base Classes · AiDotNet.Preprocessing.ImbalancedLearning
Base class for oversampling strategies that create synthetic samples for minority classes.
Implements: IResamplingStrategy<T>
Known derived types: ADASYN<T>, BorderlineSMOTE<T>, RandomOverSampler<T>, SMOTE<T>
For Beginners
When you have imbalanced data (e.g., 1000 “normal” samples but only 50 “fraud” samples), the model often ignores the minority class. Oversampling creates synthetic “fraud” samples so the model sees enough examples to learn the pattern.
Different oversampling strategies create synthetic samples in different ways:
- SMOTE: Creates samples between existing minority samples
- ADASYN: Creates more samples in regions where classification is harder
- BorderlineSMOTE: Focuses on samples near the decision boundary
Important: Only oversample the training data! Never oversample test data.
How It Works
Oversampling strategies increase the number of minority class samples by creating synthetic examples. This helps machine learning models learn to recognize minority classes.
Properties
| Property | Summary |
|---|---|
string Name { get; } |
Gets the name of this oversampling strategy. |
Methods
| Method | Summary |
|---|---|
ResamplingStatistics<T> GetStatistics() |
Gets statistics about the last resampling operation. |
ValueTuple<Matrix<T>, Vector<T>> Resample(Matrix<T> x, Vector<T> y) |
Resamples the dataset by creating synthetic minority samples. |