oversampleqa.surrogate¶
oversampleqa.surrogate
¶
Surrogate model evaluation utilities.
evaluate_surrogate_models(X, y, minority_label, oversampler, model, test_size=0.3, random_state=None)
¶
Evaluate model performance with and without synthetic data.
The function trains the provided model under three scenarios:
real_only– using the original training data without oversampling.real_plus_synth– using the oversampled training data.synth_only– replacing the real minority samples with the synthetic samples generated by the oversampler.
Parameters¶
X, y : ndarray
Input data and labels.
minority_label : int
Label of the minority class.
oversampler : imblearn BaseOverSampler
Oversampler instance used to generate synthetic samples.
model : sklearn estimator
Classifier implementing fit/predict.
test_size : float, default=0.3
Fraction of the dataset reserved for testing.
random_state : int, optional
Random seed for the split.
Returns¶
dict
Mapping of scenario names to dictionaries with f1, recall and
precision scores.
Source code in src/oversampleqa/surrogate.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |