focus-cfe 0.0.dev3

Creator: railscoder56

Last updated:

Add to Cart

Description:

focuscfe 0.0.dev3

Deployment & Documentation & Stats & License









This library is an implementation of FOCUS: Flexible Optimizable Counterfactual Explanations for Tree Ensembles.
FOCUS generates optimal distance counterfactual explanations to the original data for all the instances in treeā€based machine learning models.
FOCUS counterfactual explanation generation with 3 Lines of Code:
from focus import Focus
# Initialize Focus instance with default values
focus = Focus()
# Generate counterfactual explanations for given tree model and features
pertubed = focus.generate(tree_model, X)
Examples:

More comprehensive example can be found in the examples folder.
Another example in a kaggle notebook can be found here.
Below demonstrates the comparison of before and after FOCUS was applied to feature set from the above example.


Limitations:

Currently, FOCUS can only be applied to scikit-learn DecisionTreeClassifier, RandomForestClassifier and AdaBoostClassifier.
While categorical features may be included in the feature set, it is important to note that the interpretation of changes in categorical features, such as transitioning from age 40 to 20, may not provide meaningful insights.
The input features should be scaled to the range of 0 and 1 before applying FOCUS. Therefore, it is necessary to transform the features prior to using FOCUS. However, this scaling process may introduce some additional complexity when interpreting the features after applying FOCUS.


It is recommended to use pip or conda for installation. Please make sure
the latest version is installed:
pip install focus-cfe # normal install
pip install --upgrade focus-cfe # or update if needed
conda install -c conda-forge focus-cfe

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.