scikit-learn-contrib / skope-rules

machine learning with logical rules in Python
http://skope-rules.readthedocs.io
Other
599 stars 96 forks source link

add balanced class functionality #53

Open AndrewTanQB opened 3 years ago

AndrewTanQB commented 3 years ago

Description

Often when working with imbalanced datasets, it is necessary to fit DecisionTreeClassifier with class weights.

This simple PR adds the class_weight parameter to the SkopeRules constructor which is then passed to the DecisionTreeClassifier. An alternative would have been to pass a set of optional kwargs to the Classifier / Regressor, but that adds complexity that may not be needed.

Comments welcome.

ngoix commented 3 years ago

interesting feature, are you reading to try and fix travis?

AndrewTanQB commented 3 years ago

Seems like the tests are failing because setup.py (requirements.txt) installs sklearn 0.24.1 and numpy 1.20.2, and imports for skrules/datasets/credit_data.py are failing as well due to sklearn version. Let me open another PR that fixes travis checks