Currently RealMLP_TD_Classifier only supports class_weights="balanced" for handling class imbalance. However, it does not allow users to specify custom class weights.
This limitation makes it difficult to tune models for highly imbalanced datasets, where manually defined weights often perform better than automatic balancing.
For example, the following snippet triggers an error:
RealMLP_TD_Classifier(
class_weights={0: 1.0, 1: 3.44},
verbosity=1
)
Proposed API change:
Allow class_weights to accept either
class_weights: Union[str, Dict[int, float]] or
class_weights='balanced'
Example (usage):
RealMLP_TD_Classifier(
class_weights={0: 1.0, 1: 3.44},
verbosity=1
)
Motivation
Custom class weighting is widely supported in other ML libraries:
scikit-learn
LightGBM
XGBoost
Thanks a lot! Pytabkit is awesome
Currently RealMLP_TD_Classifier only supports class_weights="balanced" for handling class imbalance. However, it does not allow users to specify custom class weights.
This limitation makes it difficult to tune models for highly imbalanced datasets, where manually defined weights often perform better than automatic balancing.
For example, the following snippet triggers an error:
Proposed API change:
Allow class_weights to accept either
class_weights: Union[str, Dict[int, float]]orclass_weights='balanced'Example (usage):
Motivation
Custom class weighting is widely supported in other ML libraries:
scikit-learn
LightGBM
XGBoost
Thanks a lot! Pytabkit is awesome