{"id":28158266,"url":"https://github.com/kyosek/cfxplorer","last_synced_at":"2025-06-20T04:05:57.574Z","repository":{"id":180242749,"uuid":"600531779","full_name":"kyosek/CFXplorer","owner":"kyosek","description":"CFXplorer generates optimal distance counterfactual explanations for a given machine learning model.","archived":false,"fork":false,"pushed_at":"2024-01-16T20:49:02.000Z","size":1006,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-12T01:52:17.859Z","etag":null,"topics":["adaboost","algorithmic-recourse","binary-classification","counterfactual-explanations","decision-tree","machine-learning","optimization","python","python3","random-forest","tree-based-models"],"latest_commit_sha":null,"homepage":"https://cfxplorer.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyosek.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-11T19:28:33.000Z","updated_at":"2023-08-19T21:26:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"72673da2-13b1-4ad8-a82a-db394c16a292","html_url":"https://github.com/kyosek/CFXplorer","commit_stats":null,"previous_names":["kyosek/focus"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kyosek/CFXplorer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyosek%2FCFXplorer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyosek%2FCFXplorer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyosek%2FCFXplorer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyosek%2FCFXplorer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyosek","download_url":"https://codeload.github.com/kyosek/CFXplorer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyosek%2FCFXplorer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260878328,"owners_count":23075959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adaboost","algorithmic-recourse","binary-classification","counterfactual-explanations","decision-tree","machine-learning","optimization","python","python3","random-forest","tree-based-models"],"created_at":"2025-05-15T09:16:40.434Z","updated_at":"2025-06-20T04:05:52.558Z","avatar_url":"https://github.com/kyosek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"CFXplorer\n=========\n\n**Deployment \u0026 Documentation \u0026 Stats \u0026 License**\n\n.. image:: https://img.shields.io/pypi/v/CFXplorer.svg?color=brightgreen\n   :target: https://pypi.org/project/CFXplorer/\n   :alt: PyPI version\n\n.. image:: https://readthedocs.org/projects/CFXplorer/badge/?version=latest\n   :target: https://CFXplorer.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation status\n\n.. image:: https://pepy.tech/badge/CFXplorer\n   :target: https://pepy.tech/project/CFXplorer\n   :alt: Downloads\n\n.. image:: https://codecov.io/gh/kyosek/CFXplorer/branch/master/graph/badge.svg?token=G5I7TJR0JQ\n    :target: https://codecov.io/gh/kyosek/CFXplorer\n    :alt: Code Coverage\n\n.. image:: https://dl.circleci.com/status-badge/img/gh/kyosek/CFXplorer/tree/master.svg?style=svg\n    :target: https://dl.circleci.com/status-badge/redirect/gh/kyosek/CFXplorer/tree/master\n    :alt: Circle CI\n\n.. image:: https://api.codeclimate.com/v1/badges/93840d29606abb212051/maintainability\n   :target: https://codeclimate.com/github/kyosek/CFXplorer/maintainability\n   :alt: Maintainability\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\n   :target: https://github.com/kyosek/CFXplorer\n   :alt: pre-commit\n\n.. image:: https://img.shields.io/github/license/kyosek/CFXplorer.svg\n   :target: https://github.com/kyosek/CFXplorer/blob/master/LICENSE\n   :alt: License\n\n---------\n\nCFXplorer generates optimal distance counterfactual explanations of the original data for the instances in tree‐based machine learning models.\n\nThis package is an implementation of `FOCUS: Flexible Optimizable Counterfactual Explanations for Tree Ensembles (Lucic, et at. 2022) \u003chttps://arxiv.org/abs/1911.12199\u003e`_.\n\nInstallation\n------------\n\nIt is recommended to use **pip** or **conda** for installation. Please make sure\n**the latest version** is installed:\n\n.. code-block:: bash\n\n   pip install CFXplorer            # normal install\n   pip install --upgrade CFXplorer  # or update if needed\n\n.. code-block:: bash\n\n   conda install -c conda-forge CFXplorer\n\nRequirements\n------------\n\n- Python 3.6+\n- numpy\u003e=1.19.1\n- tensorflow\u003e=2.0.0\n- scikit-learn\u003e=1.0.2\n\nUsage\n-----\n**FOCUS counterfactual explanation generation with 3 Lines of Code**\\ :\n\n.. code-block:: python\n\n    from cfxplorer import Focus\n    # Initialize Focus instance with default values\n    focus = Focus()\n\n    # Generate counterfactual explanations for given tree model and features\n    pertubed = focus.generate(tree_model, X)\n\nExamples\n--------\n\n- Comprehensive examples can be found in the `examples folder \u003chttps://github.com/kyosek/CFXplorer/blob/master/examples\u003e`_.\n- Kaggle notebook example can be found `here \u003chttps://www.kaggle.com/code/kyosukemorita/cfxplorer-example\u003e`__.\n- Below is demonstrated a comparison of before and after Focus is applied to feature set from the example given above.\n\n.. image:: https://raw.githubusercontent.com/kyosek/focus/master/docs/plot.png\n    :width: 800px\n    :height: 400px\n    :scale: 100 %\n    :alt: Before and After FOCUS was applied to the features from above example.\n\nLimitations of Focus class\n--------------------------\n\n- Currently, Focus class can only be applied to scikit-learn ``DecisionTreeClassifier``, ``RandomForestClassifier`` and ``AdaBoostClassifier``.\n- 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.\n- 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.\n\nDocumentation\n-------------\n\nThe documentation can be found `here \u003chttps://cfxplorer.readthedocs.io/en/latest/\u003e`__.\n\nContributing\n------------\n\nIf you would like to contribute to the project, please refer to;\n\n- `ISSUE_TEMPLATE \u003chttps://github.com/kyosek/CFXplorer/tree/master/.github/ISSUE_TEMPLATE\u003e`_ for raising an issue\n- `PULL_REQUEST_TEMPLATE.md \u003chttps://github.com/kyosek/CFXplorer/blob/master/.github/PULL_REQUEST_TEMPLATE.md\u003e`_ for raising a PR\n\nLicense\n-------\nThis package is using the `Apache License 2.0 \u003chttps://github.com/kyosek/CFXplorer/blob/master/LICENSE\u003e`_ license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyosek%2Fcfxplorer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyosek%2Fcfxplorer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyosek%2Fcfxplorer/lists"}