Giter Site home page Giter Site logo

feature-tweaking's Introduction

feature-tweaking

Implementation of the Feature Tweaking algorithm for XGBoost models

Interpretable Predictions of Tree-based Ensembles via Actionable Feature Tweaking, Tolomei et. al. https://arxiv.org/abs/1706.06691

Setup

The package may be installed by

pip installl git+https://github.com/nicholaskarlsen/feature-tweaking

Usage

# the feature-tweaking class may be instantiated in the following way
ft = FeatureTweaking(model, continuous_features, categorical_features, continuous_metric="l1", categorical_metric="kronecker delta")

# which may then be used to generate counterfactual examples
counterfactuals = ft.generate_counterfactuals(X.iloc[i], epsilon=0.1)
# the factual class is inferred from the passed model and a pandas dataframe contiaining the set of epsilon-satisfactory examples
# is returned along with their distance from the factual example measured using the selected metric
Parameter Description
`model (xgboost.Booster xgboost.sklearn.XGBModel)`
continuous_features (list<str>) list containing column names of the continuous features to tweak
categorical_features(list<str>) list containing column names of the categorical features to tweak
continuous_metric (str) metric to use for all of the continuous features. see FeatureTweaking._metrics for a list of currently implemented metrics
categorical_metric (str) metric to use for all of the categorical features. see FeatureTweaking._categorical_metrics for a list of currently implemented metrics

feature-tweaking's People

Contributors

nicholaskarlsen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.