Skip to main content

Python API for FuzzyCoco using C++ bindings

Project description

FuzzyCocoPython

Tests Build Coverage PyPI License: AGPL-3.0-or-later Python Versions

Documentation

Python bindings and scikit-learn style estimators for fuzzycoco, an evolutionary fuzzy rule learning engine written in C++. This package wraps the C++ core as a Python module and exposes FuzzyCocoClassifier and FuzzyCocoRegressor with a familiar fit/predict API.

Features

  • Train fuzzy rule-based classifiers and regressors using fit, predict, and score
  • Inspect learned linguistic variables, rules, and activation statistics from Python
  • Persist trained estimators with save/load helpers based on joblib

Installation

Install from PyPI:

pip install fuzzycocopython

Or install from source. Make sure the following prerequisites are available:

  • A C++17 compiler toolchain (GCC/Clang on Linux & macOS, MSVC on Windows)
  • CMake ≥ 3.21 and Ninja on your PATH
  • uv is recommended for dependency management, but pip works just as well

Clone the repository, initialise the fuzzycoco submodule, then build and install in editable mode with uv:

git clone https://github.com/CI4CB-lab/fuzzycocopython.git
cd fuzzycocopython
git submodule update --init --recursive

uv venv
source .venv/bin/activate
uv pip install -e .

If you prefer the standard tooling, create a virtual environment manually and install with pip:

python -m venv .venv
source .venv/bin/activate

pip install -e .

When you only need the published bindings and not the repository, install straight from GitHub:

pip install git+https://github.com/CI4CB-lab/fuzzycocopython.git

For development tasks (tests, linting, docs) install the optional toolchain:

uv pip install -e '.[dev]'

The build compiles the bundled C++ bindings. Refer to the fuzzycoco project for background on the engine itself.

Quick start

import pandas as pd
from sklearn.datasets import load_iris
from fuzzycocopython import FuzzyCocoClassifier

data = load_iris(as_frame=True)
clf = FuzzyCocoClassifier(random_state=0)
clf.fit(data.data, data.target)

preds = clf.predict(data.data)
score = clf.score(data.data, data.target)

print(f"Accuracy: {score:.3f}")
print(clf.rules_df_.head())

The estimators now expose scikit-learn style hyper-parameters for direct tuning:

from fuzzycocopython import FuzzyCocoClassifier

model = FuzzyCocoClassifier(nb_rules=10, nb_sets_in=3, random_state=42)
model.fit(X, y)
preds = model.predict(X)

Bit widths for variable and set indices are automatically derived from the training data. Override them with nb_bits_vars_in, nb_bits_sets_in, nb_bits_vars_out, or nb_bits_sets_out when you need full manual control.

For a guided tour, open demo.ipynb. Additional usage examples live in tests/test_fuzzycocopython.py.

Documentation

Full API documentation is available at CI4CB-lab.github.io/fuzzycocopython. To build the docs locally run:

uv pip install -e '.[docs]'
uv run sphinx-build -W -b html docs docs/_build/html

Pre-commit hooks

Install and activate the provided hooks (Ruff lint/format, mypy, general hygiene) once per clone:

uv run pre-commit install

Run them against the full tree when needed:

uv run pre-commit run --all-files

License

This fuzzycoco software is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fuzzycocopython-0.1.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fuzzycocopython-0.1.1-cp313-cp313-win_amd64.whl (258.5 kB view details)

Uploaded CPython 3.13Windows x86-64

fuzzycocopython-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

fuzzycocopython-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (536.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

fuzzycocopython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (316.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fuzzycocopython-0.1.1-cp312-cp312-win_amd64.whl (258.5 kB view details)

Uploaded CPython 3.12Windows x86-64

fuzzycocopython-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

fuzzycocopython-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (536.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

fuzzycocopython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (316.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fuzzycocopython-0.1.1-cp311-cp311-win_amd64.whl (257.3 kB view details)

Uploaded CPython 3.11Windows x86-64

fuzzycocopython-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

fuzzycocopython-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (535.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

fuzzycocopython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (315.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fuzzycocopython-0.1.1-cp310-cp310-win_amd64.whl (256.7 kB view details)

Uploaded CPython 3.10Windows x86-64

fuzzycocopython-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

fuzzycocopython-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (534.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

fuzzycocopython-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (314.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file fuzzycocopython-0.1.1.tar.gz.

File metadata

  • Download URL: fuzzycocopython-0.1.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fuzzycocopython-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9f3623ff3759b6a9e007c2ed9b9e4eb9ae178c4768eedf1bf9970eaa84f4187a
MD5 64bd9a9f1d23fd7c8b689136db0f4bae
BLAKE2b-256 6d74400a9d1b439b45626a439aa91caba8e00f5f2560f589f75634ba01130f55

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 09de54419605e354c629e20f439f900659a0b1ae0b1f66e0720ee3d18afa18dd
MD5 9678cba909a1ed9196e316ba1a38d347
BLAKE2b-256 7859d7499bf13012e5dad5dd1331c84ac78127a8f3c71eed03ce1ce423cadb0f

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c8cc3721884891ee08d17d20ac9f9b6dbb9e13d0663cd4b1724cde38805d9927
MD5 5955216f92034152592566dda89713db
BLAKE2b-256 b47b43fda7e0757f4425925d84a915adc196dd6366d90b2943c4052feb525dc7

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f0a1be57b55532c5fadc3c3f7c785c8f80f4cd943eed18799a20a4b644da5e88
MD5 63e956c6a11d38b498669f26a7b261da
BLAKE2b-256 243caff14a2d050c6076f5f406d3504150f55f55fac014a2d5cf5bdcc1866ba4

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 775bf7d240b240e4c4e4665b7a18485a666dc09a9a398d897f41ed3d8370e06c
MD5 52049e40b4014ead10083e107c88dea2
BLAKE2b-256 79dcec187af60693b637961bdb0d5316e3e4309f005fec5a62429535da9b80c7

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e1941c47c9b9917ce5ac874cd287e9f2fdd7d4a7ef047e90957d221856cd1048
MD5 cad068b29208bd8c44723ac4cd41c3bf
BLAKE2b-256 b50793c039c138513fbb30c516648ab2a7f121dfc0e8769c5d06eb6c8facba69

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bf4bb5369e8f851096bd84ce72647139b3d4c3694f181698e68543cf32b093e4
MD5 0b4c731a1aefa94f55cf34bb77ff84f2
BLAKE2b-256 9894720e0af2b19c00f5cc88e10f4243c935b016410027d41a32e89e724b81e3

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 167c9fc11c098154dc04a73d657e5e7ef6516ae1ebc13156880f0cc08935f5d2
MD5 4264254f02a9b4a49ce9c4d8c6727c48
BLAKE2b-256 502a611cb7a5ca9522b329aade8dd7312a3fb905225fc22e02d1eee24a3b9e0f

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ebbcc78fe8179749f89fad261dc42e57869ab316dc6bc493f8a1897a21950ff
MD5 007f0003b5c135878d6b17b584b09424
BLAKE2b-256 d4688b623532992df7f9c58dedce359628c1e50716e61d4a053ccddb19b58d91

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e5091dcce51485f1275116df909a49c997d9183b80ff82db916e4aaec0669a01
MD5 26d4076e5aa185ffd46f07e77570c80e
BLAKE2b-256 b0724bf993fbfebeef7eb95d60030310622a11bf3d86f4a04e414551779ca61b

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 44a6afadf14fcb6b751e962038f361308551ce0d4b02a5d37a572c638645a98c
MD5 4f28d9802318d7190ff65e5db81bc5ef
BLAKE2b-256 57ba0eda846365a733922db48942621c7333bf0746a4870803a1d2491c000f01

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1cd206b37056a7e4be3db304ca25e252421eba3e12a5039f2d64308a457b4aa4
MD5 44d116815d51b5738c8a45c50a54b65d
BLAKE2b-256 e7fd16f8cfa0375caad35614ef079393cf43a282e63f890d2441d2a9166a87d9

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd836aab324815f39e78d615a1967e42f7ecbcdc2bd1bc75ec9c57b4cf3d2654
MD5 c444ebc903fa2aea44ec2657d998885a
BLAKE2b-256 684652b9e9abe924073c94ee62e58bde4b929454e63b9fea35a6c9b92bf61a20

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7dedb6177d66539d2e18d0ec1489de72b8beae310bec3c888dbe3307733f0a93
MD5 482d924b3926923b61da5f1f8face256
BLAKE2b-256 ab9218c7f343f8fda556e924504c627ece6a94a3b4225573e23018b5b917aa62

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 224d79eafbfc42b7d26a89120076f0ac507c91ad5e65742919b69f2c967fec3b
MD5 4a3c73c9a9fb4b5a623a75f8adb96d8b
BLAKE2b-256 280a36a13a88131b5a9fd1bffb4b5af033ac4dd131f7f112285940dfba433e63

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4051c6c113e5bb456d0ff868080166bc176d58919ea9c825888535490a054dee
MD5 ea1d81f3cb9fdca95bf8388ba5e8a102
BLAKE2b-256 ffb9e65c26905058aae99c42df028d783fc161b0e99a88db6bc2686e358a5fc1

See more details on using hashes here.

File details

Details for the file fuzzycocopython-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fuzzycocopython-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1648517732f1ea45b0eb03bd9c5f740f7a5afc59e6ee7d1efdf2ad229241139
MD5 b4c0f39c7fcd57628b73dd8ed303666e
BLAKE2b-256 1e4c02bac59a2bd44cd74627991db160d9764f0973e8d2598640b0e0af378520

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page