anfis-toolbox


Nameanfis-toolbox JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryANFIS Toolbox is a comprehensive Python library for creating, training, and deploying Adaptive Neuro-Fuzzy Inference Systems (ANFIS). It provides an intuitive API that makes fuzzy neural networks accessible to both beginners and experts.
upload_time2025-10-25 01:55:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords anfis explainable ai fuzzy logic machine learning neuro-fuzzy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <a href="https://dcruzf.github.io/anfis-toolbox">
  <h1>ANFIS Toolbox</h1>
  <img src="https://dcruzf.github.io/anfis-toolbox/assets/logo.svg" alt="ANFIS Toolbox">
  </a>
</div>

[![CI](https://github.com/dcruzf/anfis-toolbox/actions/workflows/ci.yml/badge.svg)](https://github.com/dcruzf/anfis-toolbox/actions/workflows/ci.yml)
[![Docs](https://img.shields.io/badge/docs-online-brightgreen.svg)](https://dcruzf.github.io/anfis-toolbox/)
[![coverage](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fdcruzf.github.io%2Fanfis-toolbox%2Fassets%2Fcov%2Findex.html&search=%3Cspan%20class%3D%22pc_cov%22%3E(%3F%3Ccov%3E%5Cd%2B%25)%3C%2Fspan%3E&replace=%24%3Ccov%3E&style=flat&logo=pytest&logoColor=white&label=coverage&color=brightgreen)](https://dcruzf.github.io/anfis-toolbox/assets/cov/)
[![License: MIT](https://img.shields.io/badge/License-MIT-indigo.svg)](LICENSE)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/anfis-toolbox)
![PyPI - Format](https://img.shields.io/pypi/format/anfis-toolbox)
[![security: bandit](https://img.shields.io/badge/security-bandit-black.svg)](https://github.com/PyCQA/bandit)
![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Hatch](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pypa/hatch/master/docs/assets/badge/v0.json)](https://github.com/pypa/hatch)
[![Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy)

![PyPI - Version](https://img.shields.io/pypi/v/anfis-toolbox)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17437178.svg)](https://doi.org/10.5281/zenodo.17437178)


ANFIS Toolbox is a comprehensive Python library for creating, training, and deploying Adaptive Neuro-Fuzzy Inference Systems (ANFIS). It provides an intuitive API that makes fuzzy neural networks accessible to both beginners and experts.

## ๐Ÿš€ Overview

- Takagiโ€“Sugenoโ€“Kang (TSK) ANFIS with the classic four-layer architecture (Membership โ†’ Rules โ†’ Normalization โ†’ Consequent).
- Regressor and classifier facades with a familiar scikit-learn style (`fit`, `predict`, `score`).
- Trainers (Hybrid, SGD, Adam, RMSProp, PSO) decoupled from the model for easy experimentation.
- 10+ membership function families. The primary public interfaces are `ANFISRegressor` and `ANFISClassifier`.
- Thorough test coverage (100%+).

## ๐Ÿ“ฆ Installation

Install from PyPI:

```bash
pip install anfis-toolbox
```

## ๐Ÿง  Quick start

### Regression

```python
import numpy as np
from anfis_toolbox import ANFISRegressor

X = np.random.uniform(-2, 2, (100, 2))
y = X[:, 0]**2 + X[:, 1]**2

model = ANFISRegressor()
model.fit(X, y)
metrics = model.evaluate(X, y)
```

### Classification

```python
import numpy as np
from anfis_toolbox import ANFISClassifier

X = np.r_[np.random.normal(-1, .3, (50, 2)), np.random.normal(1, .3, (50, 2))]
y = np.r_[np.zeros(50, int), np.ones(50, int)]

model = ANFISClassifier()
model.fit(X, y)
metrics = model.evaluate(X, y)
```

## ๐Ÿงฉ Membership functions at a glance

- **Gaussian** (`GaussianMF`) - Smooth bell curves
- **Gaussian2** (`Gaussian2MF`) - Two-sided Gaussian with flat region
- **Triangular** (`TriangularMF`) - Simple triangular shapes
- **Trapezoidal** (`TrapezoidalMF`) - Plateau regions
- **Bell-shaped** (`BellMF`) - Generalized bell curves
- **Sigmoidal** (`SigmoidalMF`) - S-shaped transitions
- **Diff-Sigmoidal** (`DiffSigmoidalMF`) - Difference of two sigmoids
- **Prod-Sigmoidal** (`ProdSigmoidalMF`) - Product of two sigmoids
- **S-shaped** (`SShapedMF`) - Smooth S-curve transitions
- **Linear S-shaped** (`LinSShapedMF`) - Piecewise linear S-curve
- **Z-shaped** (`ZShapedMF`) - Smooth Z-curve transitions
- **Linear Z-shaped** (`LinZShapedMF`) - Piecewise linear Z-curve
- **Pi-shaped** (`PiMF`) - Bell with flat top



## ๐Ÿ› ๏ธ Training options

* **SGD (Stochastic Gradient Descent)** โ€“ Classic gradient-based optimization with incremental updates
* **Adam** โ€“ Adaptive learning rates with momentum for faster convergence
* **RMSProp** โ€“ Scales learning rates by recent gradient magnitudes for stable training
* **PSO (Particle Swarm Optimization)** โ€“ Population-based global search strategy
* **Hybrid SGD + OLS** โ€“ Combines gradient descent with least-squares parameter refinement
* **Hybrid Adam + OLS** โ€“ Integrates adaptive optimization with analytical least-squares adjustment

## ๐Ÿ“š Documentation

- Comprehensive guides, API reference, and examples: [docs/](https://dcruzf.github.io/anfis-toolbox/) (built with MkDocs).

## ๐Ÿงช Testing & quality

Run the full suite (pytest + coverage):

```bash
make test
```

Additional targets:

- `make lint` โ€” Run Ruff linting
- `make docs` โ€” Build the MkDocs site locally
- `make help` โ€” Show all available targets with their help messages

This project is tested on Python 3.10 | 3.11 | 3.12 | 3.13 | 3.14 across Linux, Windows and macOS.

## ๐Ÿค Contributing

Issues and pull requests are welcome! Please open a discussion if youโ€™d like to propose larger changes. See the [docs/guide](docs/guide.md) section for architecture notes and examples.

## ๐Ÿ“„ License

Distributed under the MIT License. See [LICENSE](LICENSE) for details.

## ๐Ÿ“š References

1. Jang, J. S. (1993). ANFIS: adaptive-network-based fuzzy inference system. IEEE transactions on systems, man, and cybernetics, 23(3), 665-685. https://doi.org/10.1109/21.256541

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "anfis-toolbox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "anfis, explainable ai, fuzzy logic, machine learning, neuro-fuzzy",
    "author": null,
    "author_email": "Daniel Fran\u00e7a <daniel@ci.ufpb.br>",
    "download_url": "https://files.pythonhosted.org/packages/e6/60/cdacc869267d1cdd2386a8ed90d4a4e14f9ebf3e61cf106696d6ec1baa3a/anfis_toolbox-0.1.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <a href=\"https://dcruzf.github.io/anfis-toolbox\">\n  <h1>ANFIS Toolbox</h1>\n  <img src=\"https://dcruzf.github.io/anfis-toolbox/assets/logo.svg\" alt=\"ANFIS Toolbox\">\n  </a>\n</div>\n\n[![CI](https://github.com/dcruzf/anfis-toolbox/actions/workflows/ci.yml/badge.svg)](https://github.com/dcruzf/anfis-toolbox/actions/workflows/ci.yml)\n[![Docs](https://img.shields.io/badge/docs-online-brightgreen.svg)](https://dcruzf.github.io/anfis-toolbox/)\n[![coverage](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fdcruzf.github.io%2Fanfis-toolbox%2Fassets%2Fcov%2Findex.html&search=%3Cspan%20class%3D%22pc_cov%22%3E(%3F%3Ccov%3E%5Cd%2B%25)%3C%2Fspan%3E&replace=%24%3Ccov%3E&style=flat&logo=pytest&logoColor=white&label=coverage&color=brightgreen)](https://dcruzf.github.io/anfis-toolbox/assets/cov/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-indigo.svg)](LICENSE)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/anfis-toolbox)\n![PyPI - Format](https://img.shields.io/pypi/format/anfis-toolbox)\n[![security: bandit](https://img.shields.io/badge/security-bandit-black.svg)](https://github.com/PyCQA/bandit)\n![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Hatch](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pypa/hatch/master/docs/assets/badge/v0.json)](https://github.com/pypa/hatch)\n[![Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy)\n\n![PyPI - Version](https://img.shields.io/pypi/v/anfis-toolbox)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17437178.svg)](https://doi.org/10.5281/zenodo.17437178)\n\n\nANFIS Toolbox is a comprehensive Python library for creating, training, and deploying Adaptive Neuro-Fuzzy Inference Systems (ANFIS). It provides an intuitive API that makes fuzzy neural networks accessible to both beginners and experts.\n\n## \ud83d\ude80 Overview\n\n- Takagi\u2013Sugeno\u2013Kang (TSK) ANFIS with the classic four-layer architecture (Membership \u2192 Rules \u2192 Normalization \u2192 Consequent).\n- Regressor and classifier facades with a familiar scikit-learn style (`fit`, `predict`, `score`).\n- Trainers (Hybrid, SGD, Adam, RMSProp, PSO) decoupled from the model for easy experimentation.\n- 10+ membership function families. The primary public interfaces are `ANFISRegressor` and `ANFISClassifier`.\n- Thorough test coverage (100%+).\n\n## \ud83d\udce6 Installation\n\nInstall from PyPI:\n\n```bash\npip install anfis-toolbox\n```\n\n## \ud83e\udde0 Quick start\n\n### Regression\n\n```python\nimport numpy as np\nfrom anfis_toolbox import ANFISRegressor\n\nX = np.random.uniform(-2, 2, (100, 2))\ny = X[:, 0]**2 + X[:, 1]**2\n\nmodel = ANFISRegressor()\nmodel.fit(X, y)\nmetrics = model.evaluate(X, y)\n```\n\n### Classification\n\n```python\nimport numpy as np\nfrom anfis_toolbox import ANFISClassifier\n\nX = np.r_[np.random.normal(-1, .3, (50, 2)), np.random.normal(1, .3, (50, 2))]\ny = np.r_[np.zeros(50, int), np.ones(50, int)]\n\nmodel = ANFISClassifier()\nmodel.fit(X, y)\nmetrics = model.evaluate(X, y)\n```\n\n## \ud83e\udde9 Membership functions at a glance\n\n- **Gaussian** (`GaussianMF`) - Smooth bell curves\n- **Gaussian2** (`Gaussian2MF`) - Two-sided Gaussian with flat region\n- **Triangular** (`TriangularMF`) - Simple triangular shapes\n- **Trapezoidal** (`TrapezoidalMF`) - Plateau regions\n- **Bell-shaped** (`BellMF`) - Generalized bell curves\n- **Sigmoidal** (`SigmoidalMF`) - S-shaped transitions\n- **Diff-Sigmoidal** (`DiffSigmoidalMF`) - Difference of two sigmoids\n- **Prod-Sigmoidal** (`ProdSigmoidalMF`) - Product of two sigmoids\n- **S-shaped** (`SShapedMF`) - Smooth S-curve transitions\n- **Linear S-shaped** (`LinSShapedMF`) - Piecewise linear S-curve\n- **Z-shaped** (`ZShapedMF`) - Smooth Z-curve transitions\n- **Linear Z-shaped** (`LinZShapedMF`) - Piecewise linear Z-curve\n- **Pi-shaped** (`PiMF`) - Bell with flat top\n\n\n\n## \ud83d\udee0\ufe0f Training options\n\n* **SGD (Stochastic Gradient Descent)** \u2013 Classic gradient-based optimization with incremental updates\n* **Adam** \u2013 Adaptive learning rates with momentum for faster convergence\n* **RMSProp** \u2013 Scales learning rates by recent gradient magnitudes for stable training\n* **PSO (Particle Swarm Optimization)** \u2013 Population-based global search strategy\n* **Hybrid SGD + OLS** \u2013 Combines gradient descent with least-squares parameter refinement\n* **Hybrid Adam + OLS** \u2013 Integrates adaptive optimization with analytical least-squares adjustment\n\n## \ud83d\udcda Documentation\n\n- Comprehensive guides, API reference, and examples: [docs/](https://dcruzf.github.io/anfis-toolbox/) (built with MkDocs).\n\n## \ud83e\uddea Testing & quality\n\nRun the full suite (pytest + coverage):\n\n```bash\nmake test\n```\n\nAdditional targets:\n\n- `make lint` \u2014 Run Ruff linting\n- `make docs` \u2014 Build the MkDocs site locally\n- `make help` \u2014 Show all available targets with their help messages\n\nThis project is tested on Python 3.10 | 3.11 | 3.12 | 3.13 | 3.14 across Linux, Windows and macOS.\n\n## \ud83e\udd1d Contributing\n\nIssues and pull requests are welcome! Please open a discussion if you\u2019d like to propose larger changes. See the [docs/guide](docs/guide.md) section for architecture notes and examples.\n\n## \ud83d\udcc4 License\n\nDistributed under the MIT License. See [LICENSE](LICENSE) for details.\n\n## \ud83d\udcda References\n\n1. Jang, J. S. (1993). ANFIS: adaptive-network-based fuzzy inference system. IEEE transactions on systems, man, and cybernetics, 23(3), 665-685. https://doi.org/10.1109/21.256541\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "ANFIS Toolbox is a comprehensive Python library for creating, training, and deploying Adaptive Neuro-Fuzzy Inference Systems (ANFIS). It provides an intuitive API that makes fuzzy neural networks accessible to both beginners and experts.",
    "version": "0.1.1",
    "project_urls": {
        "DOI": "https://doi.org/10.5281/zenodo.17437178",
        "Documentation": "https://dcruzf.github.io/anfis-toolbox/",
        "Homepage": "https://github.com/dcruzf/anfis-toolbox",
        "Source": "https://github.com/dcruzf/anfis-toolbox",
        "Tracker": "https://github.com/dcruzf/anfis-toolbox/issues"
    },
    "split_keywords": [
        "anfis",
        " explainable ai",
        " fuzzy logic",
        " machine learning",
        " neuro-fuzzy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7e4162893604f35a4c89c90ae6fb85e702fe7e62b9958be2f9fe6d817bccb44e",
                "md5": "e26ced449b682ca6efb3e27c8e4d0bef",
                "sha256": "88e87a625c426c7161b1320588bf7224510f2e68a6febefe8732d2765f80c4f3"
            },
            "downloads": -1,
            "filename": "anfis_toolbox-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e26ced449b682ca6efb3e27c8e4d0bef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 88055,
            "upload_time": "2025-10-25T01:55:52",
            "upload_time_iso_8601": "2025-10-25T01:55:52.104827Z",
            "url": "https://files.pythonhosted.org/packages/7e/41/62893604f35a4c89c90ae6fb85e702fe7e62b9958be2f9fe6d817bccb44e/anfis_toolbox-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e660cdacc869267d1cdd2386a8ed90d4a4e14f9ebf3e61cf106696d6ec1baa3a",
                "md5": "31263e70352622b97650fec4b39d064b",
                "sha256": "242fbe260925957d1f0a4d28e1f2ef50b85d936522b0bba333b2acaff6ca7c79"
            },
            "downloads": -1,
            "filename": "anfis_toolbox-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "31263e70352622b97650fec4b39d064b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 137170,
            "upload_time": "2025-10-25T01:55:53",
            "upload_time_iso_8601": "2025-10-25T01:55:53.210676Z",
            "url": "https://files.pythonhosted.org/packages/e6/60/cdacc869267d1cdd2386a8ed90d4a4e14f9ebf3e61cf106696d6ec1baa3a/anfis_toolbox-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-25 01:55:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dcruzf",
    "github_project": "anfis-toolbox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "anfis-toolbox"
}
        
Elapsed time: 2.13025s