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

Uploaded CPython 3.13Windows x86-64

fuzzycocopython-0.1.0-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.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (535.8 kB view details)

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

fuzzycocopython-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (315.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fuzzycocopython-0.1.0-cp312-cp312-win_amd64.whl (258.0 kB view details)

Uploaded CPython 3.12Windows x86-64

fuzzycocopython-0.1.0-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.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (535.8 kB view details)

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

fuzzycocopython-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (315.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fuzzycocopython-0.1.0-cp311-cp311-win_amd64.whl (256.8 kB view details)

Uploaded CPython 3.11Windows x86-64

fuzzycocopython-0.1.0-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.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (534.5 kB view details)

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

fuzzycocopython-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (315.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fuzzycocopython-0.1.0-cp310-cp310-win_amd64.whl (256.2 kB view details)

Uploaded CPython 3.10Windows x86-64

fuzzycocopython-0.1.0-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.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (533.9 kB view details)

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

fuzzycocopython-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (313.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: fuzzycocopython-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 4a1340d571b0bfe2e4cea01bc102f262f71f13c590496ac89458ec37bacd748e
MD5 fe07cec3f28022d5cff2e9400b6b2b63
BLAKE2b-256 9370612abfed5931a8b53c2cf31604cbbf737947739540afc82da431832db7d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8b99d482f8a02b0ca4493e21d3ea4fe211dd33c02c89d77a65bb526af10ec78d
MD5 09567758b96be4493a0f7d5ed9fc2ef6
BLAKE2b-256 77956bee12cb142dd3e017ea87c6864776d4daa9c538ad69eb2724012b5b8736

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 15b05c78e597971e757f566036d08e17c29def8aae50172bbd3499373aacfd67
MD5 a35e8d882e24e73b3654bd886d70415c
BLAKE2b-256 ac22a72c374e25d0fe60f8400b189017380b3951682fe071332888a61adec761

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f78d8afc13ccc9188f4a0ca058e0e0f1a3d184c1ec4fa96284cfc3583b5265e0
MD5 cc8cdd258c2db9c2c0cc1b7997f89989
BLAKE2b-256 e6102fb6ed09b133235dc0b3d5a829ecc21174ba65dd4db48b0afae015b38343

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47369f078b7e54dc9f790754c51c671e6850261adc75ecb35906c406e6d32faa
MD5 75e63ee582681cb42e8cee878625720d
BLAKE2b-256 41d66f191946098d76a43370a902b07bb23a03952c65efdfbc8e6b4793368932

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ee0b425e23b0eea6b3d5f208c2dd1802ed6b672faca7df4db8261a2e073185ca
MD5 01a34adc0b512900d06fc8112c6a8ecd
BLAKE2b-256 5d49b9b133babf7f3390a24a3089965391dc38d7046fd04c5f7886ba345628cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d1b95a6389534f01be92dfe7075aab8f379856c34c2c48ad736288fbbf4926ec
MD5 68600ec88ced4139bce00f4a252f1b81
BLAKE2b-256 f8bf6d4608a0eda4b549c4b8dbdc0136823f9a94d7d5f86f6530cb83412e3d84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b413590af7f7e262b846e337be3f4c8454e9649523d8a6a0660ab927fa0028b6
MD5 40bde6ec6a11ce3fe8185c2e0ec57720
BLAKE2b-256 b8c599983aa9cdf901a1492b029b0b1831c79628b751b070ec709e11a2d812de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ea94ade583a5b53338fee05926854181cb034f021c1635ff782011afc893a22
MD5 7d6d62897dd200db9595c7642a699480
BLAKE2b-256 8db6b1af383803481447a8bf7a42bf99a246582ca0c491b904a33fa77bfe2e30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 09d89f85857178f86b73ea352e3ba5b553e7eb4f2bd1370098fd620111a59b19
MD5 835705e885c2ec54ca02653d7a430378
BLAKE2b-256 db2ffe43003020e6c03a61f5465b4490f87af7634a1fe864dcc62674eca1aeb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a12338dc63d094d53dca563e83bc849bb78b470279b7ea02a7bbda0ea092a1be
MD5 4e27d9d0194b3eb2a7f859eecb5b990e
BLAKE2b-256 f1c229b4e249870a62bf66eb0b8f14b5b2be9dd33af5c68d0a3e83d47d665195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 77bdb02511c9448dfbb83f205d5408d7319240e60ae6ecd65f0f933e11bfcc48
MD5 d4a48507290e8952bc42937e0fee79b7
BLAKE2b-256 4a5e00d85dd4e826e2656ae310e1cb6eb45b4ec32860274b1d48a048d56c4efa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a520ad74561f682afbe43f4cd26929aadd2e4afd67f1df57fc04fb13a348890
MD5 8e7db68732d83cf625da761ad46c00f5
BLAKE2b-256 2459deb9053ef1048bed6e105dbf0437bee68cac8200cbb73fd1aac6c6f3bcf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5a0992d56dcf4b8cf319a92bbac136dc0622e7b22919c1a0f905dbfb894a005b
MD5 b68edca39a1a37ef94e0568371e2da52
BLAKE2b-256 6a170e7d75f30a6cb7925abb0bd94fcb5a1e4adc6d8013beda5d8bffb400fab2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4c8af907008b6b7d7043996bb92b8a9eba77128f645ad407ecd04c99f5643878
MD5 53d3778b94e58b7d2a1b6bbf9cbe1e73
BLAKE2b-256 0845fb7b9232fa88cf630e8a37d4a3f5f181dfc5f7349543ba6efef11d6c95a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b58e91b6eb304459d94dd4803558b92dc3616a7113f8589156d820fe426b3c7a
MD5 e0c43635750da64011fd8c0155b8299a
BLAKE2b-256 cdf355f7a8c91cdb84db3c39590c1b4b00cf4691302e29640965e7785c80f392

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fuzzycocopython-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bcabc8667f7091827f51fdcae404aea13b42bd56a673ef696a51b1e1aa09b094
MD5 ce398566d3c5c8c732e7e304b3407680
BLAKE2b-256 b3f7ccc0b24bdf1a894cc3ea10c64c2d3a0d21b4df1f93e8953e69d433eaecf2

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