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 DOI

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.2.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.2-cp313-cp313-win_amd64.whl (258.6 kB view details)

Uploaded CPython 3.13Windows x86-64

fuzzycocopython-0.1.2-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.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (316.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

fuzzycocopython-0.1.2-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.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (316.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

fuzzycocopython-0.1.2-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.2-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.2-cp311-cp311-macosx_11_0_arm64.whl (315.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fuzzycocopython-0.1.2-cp310-cp310-win_amd64.whl (256.8 kB view details)

Uploaded CPython 3.10Windows x86-64

fuzzycocopython-0.1.2-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.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (534.5 kB view details)

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

fuzzycocopython-0.1.2-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.2.tar.gz.

File metadata

  • Download URL: fuzzycocopython-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 b0fbe81f7132b05e47b42c47cc4bc8d4dea173f6c113106164eb44c53bb285ab
MD5 cbc44fad19a7d547f3497fdd0ef0911a
BLAKE2b-256 a0624bd96bcc19dcc53c5753ad80490170e3120596d541d95bcad35693edfc94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 34fa4db5cd05749adbbe99371955ec92308f90dd90255beb8f2735eb47dce65d
MD5 342043181f0865ebb86786f23c5d768b
BLAKE2b-256 5bce5fdacef5878976e5ab0890e43582ebc4136f55ade4509b1ad50b740f19e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 88329499938c111c528faf018ec7b3e0d985769a9bb47daf0555a7e6af1c9141
MD5 597f8a1235fe197f6316d2f0784705f7
BLAKE2b-256 ce2622891250152a00feb36e00fb1a18bb62d405ccc6f869e1afca88a3ac9c62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b682a776d0ed8372071de257a1881c83ce4e49a9e397a6576bfd0deb6e11e30e
MD5 bf8b348c1f18b89e5c5f022fa315ff53
BLAKE2b-256 b42c56fe521cdc451125890324c11936a97d68c38f2b0ac7af7ba40977939ec9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9326b688692f9a942b4ca7da172b5d9841fc3d69c00d5b5fb45122a0c241fea
MD5 da38d54966f010b7c515414a9e89f5b7
BLAKE2b-256 db81a59195ec505d93050dadff24b50ed45201a41271e019ce2a9f5412ff3cf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 18e2bec9db06ba58bf48e6aae38ea51b1703bc11b2c3e0a4c448d5e67a3b4dab
MD5 16757845304cd49ef55c40eac725151d
BLAKE2b-256 6724e83547f26b56f5176023a2de68ecd2315ca9ee7f75b4b5e5fc5d802a23b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3776da5731ea111b873079d399e7f98ed75bb5e05977fb195b236c3419671686
MD5 466079ac1fb30b76f1c52b4843742a25
BLAKE2b-256 20120e9505dd7989be1b11fe01272c5d1ce153cce23e209e81e859436c6a2ba1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b7e4bcb7d43d77b0858d5c7583ef04447a12fcc364b3e912270d0a426732fffb
MD5 a9df7681ee5f35f585075823cde5a8c4
BLAKE2b-256 6e92335f92be1269f37075704957d934bdb068d09d07572843c2e6528213a3f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0b1f489572edeb1e5d1e37c30a710b0fdbb8cf79a63425b9f6fe1a52aad4a93
MD5 c7d7150bb08b33848bf4a15fd381ed1a
BLAKE2b-256 49a47fdaadb1728be4e2e10bbe6a8c13faf05dfc65594248df3127c639831d51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8c7c059e8c436689cb726c647e9ce9646cb850c0f20dd640dcd907a51234c6d3
MD5 5d4c63e936853c5e62f4c0316e775c61
BLAKE2b-256 a5a368561dc61be130606b4eb1c9335d323ae6238661772e0e7f320bb32694a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f9af65b786dc7a0fd466bf7df61fe736f189de685df044d30f34f300bee53816
MD5 1deb3e779974adc58da4b4a72be250e2
BLAKE2b-256 bc11ad2af7f9676a7b0df83910aa0c02998bde5f8941a802c4f42721f4a077b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d244e254b6f3fc8a2d8eea6a29e33f531e1dfd123b7d28594a9088d1c3ba094f
MD5 abe7b1440c5aff30fac56ae9be585dab
BLAKE2b-256 8b49f8b9c8796eaf7b7c27f491635e8f6196cea44c6fe8c77d58bab1b1680883

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02a86009bcff469da33cefd8c7cfbbb238b80307aeacc24585a59b1355f3c845
MD5 fabe002a677512c2722e7a9b58573dc0
BLAKE2b-256 d0165d116bc8389a4070ba87ad9463689710b867cf016074477d11d5e6946fe1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5fbd0385ee6fbfd6adc97f7d83066ecb9de00d9c4e93091fd8cadcbc3e8d3384
MD5 3548b8ed7e41b8c936bdc6707bc09172
BLAKE2b-256 82ed08abcee762b1e9ebda65710cc5bbc74e618c89aad9b56708694e040ebf48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 91103c8aceb7a3a6f7dd81741f81edf86699e59d6c4e24d239ef4ecfcbb9c4ae
MD5 40e2716da793fa1d4a8fd4ba39a72b37
BLAKE2b-256 5b4fe3cec4b6ef185b88d5b5daf62e46656066402e7ea65a15f4cdebb53d4f21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 95caac5062bb2442711922951df017c4a84a2d833ac2921bfba1d12126dfe171
MD5 d3ecfd467767f2f290f60b1dfe71d8bc
BLAKE2b-256 cc19abcdc992e4958251ddfe6b57e7a64bd25ed11c7f9f0f6ac9a3050037088d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e305b4b967dc063492896dd9be708a017bb11397f791795c6dd86d9e6eccb8cf
MD5 f99c3ae4a4b05e9b4e1494ac7f5ec71b
BLAKE2b-256 03857996801234562c2ebc13ac73b51891dcd02ff51e06b05ce691ee7a01a787

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