Modify Classifiers to Include Class Weighting? #3609
Replies: 2 comments 3 replies
-
Afaik the classification module does not support class weights currently. You can try undersampling/oversampling though before you apply classifiers. Perhaps some of the classification aficionados has a better suggestion. |
Beta Was this translation helpful? Give feedback.
-
I'm affraid I haven't seen this functionality in def _balance_classes(
target: ArrayLike,
ts: NDArray[np.float_],
) -> tuple[pd.DataFrame, NDArray[np.float_]]:
"""Balances class distribution by under-sampling majority classes."""
rus = RandomUnderSampler() # You could replace this by an Oversampler
_, y_resampled = rus.fit_resample(metadata, target)
ts_resampled = ts[y_resampled.index]
metadata_resampled = metadata.loc[y_resampled.index]
return metadata_resampled, ts_resampled This will help you deal with the panel data |
Beta Was this translation helpful? Give feedback.
-
Hello sktime community!
Is there a way for me to modify or add a class_weight parameter to any of the sktime classifiers similar to the class_weight parameter included in many sklearn models?
I'm working on a classification project with imbalanced data (target variable is ~10% of data); the goal is to maximize recall of the target class.
The sktime classifiers I've tried have high accuracy, but achieve this by predicting nearly everything as part of the majority class.
Beta Was this translation helpful? Give feedback.
All reactions