FuzzyPy is a Python library for creating, manipulating and visualizing fuzzy numbers (triangular, trapezoidal and general fuzzy numbers). It provides convenience types and vectorized operations to make numerical and statistical workflows with fuzzy data ergonomic.
Documentation is available at github pages.
This repository includes:
fuzzpy/— package source (numbers, container structs and config)docs/— Sphinx documentation source and built outputexamples/— short runnable examples and notebooks (seetest.ipynbfor an interactive demo)tests/— unit tests
Highlights
fuzzpy.numbers— core fuzzy number classes:TriangularFuzzyNumber— left/center/right triangular TFNsTrapezoidalFuzzyNumber— four-parameter trapezoidal numbersFuzzyNumber— more general base with customizable membership helpers
fuzzpy.structs.FuzzyNumberArray— fixed-size, typed container for arrays of fuzzy numbers with vectorized attributes (e.g..left,.mid,.right), sequence semantics and plotting supportfuzzpy.config— runtime configuration for e.g. fuzzy addition semantics
Quick install (developer workflow)
- Install UV (recommended for reproducible envs used in this project):
pip install uv- Install project dependencies (dev/test/bench as needed):
uv pip install -r requirements.txt # runtime deps
uv pip install -r requirements-dev.txt # developer/test deps
uv pip install -r requirements-bench.txt # benchmark depsRunning tests
uv pip install -r requirements-dev.txt
uv pytestRunning benchmarks
uv pip install -r requirements-bench.txt
python benchmarks/bench_*.pyQuick examples
import numpy as np
from fuzzpy.numbers import TriangularFuzzyNumber, TrapezoidalFuzzyNumber
from fuzzpy.structs import FuzzyNumberArray
# create numbers
a = TriangularFuzzyNumber(0, 1, 2)
b = TrapezoidalFuzzyNumber(0, 1, 2, 3)
# arrays
arr = FuzzyNumberArray([a, b])
print(arr.mid) # numpy array of centers
# plotting (uses plotnine)
arr.plot()License
This repository includes a package copyright and license (check PKG-INFO or LICENSE).