felimination


Namefelimination JSON
Version 0.2.2 PyPI version JSON
download
home_page
SummaryThis library contains some useful scikit-learn compatible classes for feature selection.
upload_time2024-01-15 12:37:36
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords feature selection scikit-learn machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![pytest](https://github.com/ClaudioSalvatoreArcidiacono/felimination/workflows/Tests/badge.svg)](https://github.com/ClaudioSalvatoreArcidiacono/felimination/actions?query=workflow%3A%22Tests%22)
[![PyPI](https://img.shields.io/pypi/v/felimination)](#)
[![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)](https://claudiosalvatorearcidiacono.github.io/felimination/)


# felimination

This library contains some useful scikit-learn compatible classes for feature selection.

## Features

- [Recursive Feature Elimination with Cross Validation using Permutation Importance](reference/RFE.md#felimination.rfe.PermutationImportanceRFECV)

## Requirements

- Python 3.7+
- NumPy
- Scikit-learn
- Pandas

## Installation

In a terminal shell run the following command
```
pip install felimination
```

## Usage

```python
from felimination.rfe import PermutationImportanceRFECV
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification
import numpy as np


X, y = make_classification(
    n_samples=1000,
    n_features=20,
    n_informative=6,
    n_redundant=10,
    n_clusters_per_class=1,
    random_state=42,
)

selector = PermutationImportanceRFECV(LogisticRegression(), step=0.3)

selector.fit(X, y)

selector.support_
# array([False, False, False, False, False, False, False, False, False,
#        False, False,  True, False, False, False, False, False, False,
#        False, False])

selector.ranking_
# array([9, 3, 8, 9, 7, 8, 5, 6, 9, 6, 8, 1, 9, 7, 8, 9, 9, 2, 4, 7])
selector.plot()
```
![example of plot](./docs/assets/example_plot.png)

It looks like `5` is a good number of features, we can set the number of features to select to 5 without need of retraining

```python
selector.set_n_features_to_select(5)
selector.support_
# array([False,  True, False, False, False, False,  True, False, False,
#        False, False,  True, False, False, False, False, False,  True,
#         True, False])
```

## License

This project is licensed under the BSD 3-Clause License - see the LICENSE.md file for details

## Acknowledgments

- [scikit-learn](https://scikit-learn.org/)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "felimination",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "feature selection,scikit-learn,machine learning",
    "author": "",
    "author_email": "Claudio Salvatore Arcidiacono <author@email.com>",
    "download_url": "https://files.pythonhosted.org/packages/46/1a/c067cd7fa4db99b74e4b997def4abb3cc25a22f8e0e8bf68ce01fbc9be30/felimination-0.2.2.tar.gz",
    "platform": null,
    "description": "[![pytest](https://github.com/ClaudioSalvatoreArcidiacono/felimination/workflows/Tests/badge.svg)](https://github.com/ClaudioSalvatoreArcidiacono/felimination/actions?query=workflow%3A%22Tests%22)\n[![PyPI](https://img.shields.io/pypi/v/felimination)](#)\n[![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)](https://claudiosalvatorearcidiacono.github.io/felimination/)\n\n\n# felimination\n\nThis library contains some useful scikit-learn compatible classes for feature selection.\n\n## Features\n\n- [Recursive Feature Elimination with Cross Validation using Permutation Importance](reference/RFE.md#felimination.rfe.PermutationImportanceRFECV)\n\n## Requirements\n\n- Python 3.7+\n- NumPy\n- Scikit-learn\n- Pandas\n\n## Installation\n\nIn a terminal shell run the following command\n```\npip install felimination\n```\n\n## Usage\n\n```python\nfrom felimination.rfe import PermutationImportanceRFECV\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.datasets import make_classification\nimport numpy as np\n\n\nX, y = make_classification(\n    n_samples=1000,\n    n_features=20,\n    n_informative=6,\n    n_redundant=10,\n    n_clusters_per_class=1,\n    random_state=42,\n)\n\nselector = PermutationImportanceRFECV(LogisticRegression(), step=0.3)\n\nselector.fit(X, y)\n\nselector.support_\n# array([False, False, False, False, False, False, False, False, False,\n#        False, False,  True, False, False, False, False, False, False,\n#        False, False])\n\nselector.ranking_\n# array([9, 3, 8, 9, 7, 8, 5, 6, 9, 6, 8, 1, 9, 7, 8, 9, 9, 2, 4, 7])\nselector.plot()\n```\n![example of plot](./docs/assets/example_plot.png)\n\nIt looks like `5` is a good number of features, we can set the number of features to select to 5 without need of retraining\n\n```python\nselector.set_n_features_to_select(5)\nselector.support_\n# array([False,  True, False, False, False, False,  True, False, False,\n#        False, False,  True, False, False, False, False, False,  True,\n#         True, False])\n```\n\n## License\n\nThis project is licensed under the BSD 3-Clause License - see the LICENSE.md file for details\n\n## Acknowledgments\n\n- [scikit-learn](https://scikit-learn.org/)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "This library contains some useful scikit-learn compatible classes for feature selection.",
    "version": "0.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/ClaudioSalvatoreArcidiacono/felimination/issues",
        "Documentation": "https://claudiosalvatorearcidiacono.github.io/felimination/",
        "Homepage": "https://github.com/ClaudioSalvatoreArcidiacono/felimination"
    },
    "split_keywords": [
        "feature selection",
        "scikit-learn",
        "machine learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f22f27e70521d1db35f37d03a8e61954d939ecb5d9e4905562414830a0d1fec9",
                "md5": "65b5a0cc08c0a8e178329fa602381369",
                "sha256": "6610ffb9b135115ce572bd30fc2e686cc8342da54969b3b8ea48bebd73ded869"
            },
            "downloads": -1,
            "filename": "felimination-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65b5a0cc08c0a8e178329fa602381369",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17409,
            "upload_time": "2024-01-15T12:37:34",
            "upload_time_iso_8601": "2024-01-15T12:37:34.552007Z",
            "url": "https://files.pythonhosted.org/packages/f2/2f/27e70521d1db35f37d03a8e61954d939ecb5d9e4905562414830a0d1fec9/felimination-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "461ac067cd7fa4db99b74e4b997def4abb3cc25a22f8e0e8bf68ce01fbc9be30",
                "md5": "c7f93c2de616b952e4d817f7d249f4af",
                "sha256": "98f6b063b1c6b9e8b958ad885d9b6c4ec40a9e1ac7e27f564f53601d90bed14c"
            },
            "downloads": -1,
            "filename": "felimination-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c7f93c2de616b952e4d817f7d249f4af",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14135,
            "upload_time": "2024-01-15T12:37:36",
            "upload_time_iso_8601": "2024-01-15T12:37:36.513394Z",
            "url": "https://files.pythonhosted.org/packages/46/1a/c067cd7fa4db99b74e4b997def4abb3cc25a22f8e0e8bf68ce01fbc9be30/felimination-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-15 12:37:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ClaudioSalvatoreArcidiacono",
    "github_project": "felimination",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "felimination"
}
        
Elapsed time: 0.20427s