Fuzzy-rough set utilities for Python.
Project description
frsutils
frsutils is a scientific Python library for fuzzy-rough set computations. It provides reusable building blocks and task-oriented APIs for similarity construction, fuzzy-rough lower and upper approximations, boundary regions, and
positive-region scores.
The package is intended for researchers and downstream libraries that need a small, documented fuzzy-rough core with a stable public API.
Installation
Install from PyPI:
pip install frsutils
For local development from a source checkout:
pip install -e .
Core requirements are intentionally small:
- Python >= 3.10
- NumPy >= 1.21.0
- scikit-learn
Optional extras are used only for specific workflows:
pip install -e ".[dev]"
pip install -e ".[docs]"
# or, for CUDA 12.x CuPy experiments:
pip install -e ".[gpu-cuda12x]"
Quick start
Use the package root as the canonical public API:
import numpy as np
from frsutils import compute_approximations, compute_positive_region
X = np.array(
[
[0.00, 0.10],
[0.08, 0.18],
[0.15, 0.12],
[0.80, 0.82],
[0.88, 0.90],
[0.95, 0.86],
],
dtype=float,
)
y = np.array([0, 0, 0, 1, 1, 1], dtype=int)
result = compute_approximations(
X,
y,
model="itfrs",
similarity="linear",
)
print(result.lower)
print(result.upper)
print(result.boundary)
print(result.positive_region)
scores = compute_positive_region(X, y, model="itfrs", similarity="linear")
print(scores)
A runnable version is available in
examples/public_api_quickstart.py.
Public API
Prefer imports from frsutils instead of deep internal modules:
from frsutils import (
FuzzyRoughPositiveRegionScorer,
build_similarity_matrix,
compute_approximations,
compute_positive_region,
)
Main user-facing entry points include:
compute_approximationscompute_lower_approximationcompute_upper_approximationcompute_boundary_regioncompute_positive_regionbuild_similarity_matrixbuild_similarity_enginebuild_fuzzy_rough_modelFuzzyRoughPositiveRegionScorer
See the public API guide for the full public boundary and downstream-package contract. Common terms are defined in the glossary.
Supported fuzzy-rough models
Current public model aliases are:
"itfrs"— Implicator/T-norm Fuzzy-Rough Sets"vqrs"— Vaguely Quantified Rough Sets"owafrs"— Ordered Weighted Average Fuzzy-Rough Sets
Concept notes are kept separate for review and maintenance:
Execution modes and backends
frsutils supports dense and exact blockwise execution through the public API.
Dense NumPy is the stable reference path. Blockwise execution can reduce memory pressure by avoiding materialization of a full n x n similarity matrix.
from frsutils import compute_approximations
result = compute_approximations(
X,
y,
model="itfrs",
similarity="linear",
engine="blockwise",
block_size=512,
backend="numpy",
)
CuPy is optional and currently limited to selected backend-aware computation paths. The stable default backend is NumPy. Public result arrays are always NumPy arrays, even when a CuPy-backed blockwise path is used internally. See backends and execution behavior for the precise backend claim boundaries.
Benchmarking
The repository includes a benchmark harness for dense NumPy, blockwise NumPy, and optional CuPy-backed blockwise execution:
python benchmarks/benchmark_fuzzy_rough_execution.py \
--models itfrs,vqrs,owafrs \
--sample-sizes 128,256,512 \
--n-features 8 \
--block-sizes 64,128 \
--scenarios dense_numpy,blockwise_numpy,blockwise_cupy \
--repeats 3 \
--output-json benchmark_results.json \
--output-csv benchmark_results.csv
See the benchmark guide for larger synthetic runs, paired NumPy/CuPy comparisons, and interpretation rules.
Project boundary
frsutils is the fuzzy-rough core library. This keeps frsutils focused on reusable fuzzy-rough computations that can be
used by multiple research and application packages.
Documentation
The published documentation is available at mehi64.github.io/frsutils.
Repository sources:
Build the documentation locally with:
python -m pip install -e ".[docs]"
mkdocs build --strict
mkdocs serve
Development and validation
Run the main test suite from the repository root:
python -m pytest tests -q
Run public API and backend-focused smoke checks:
python examples/public_api_quickstart.py
python -m pytest tests/api/test_public_api_examples_smoke.py -q -rs
python -m pytest tests/api tests/core_tests/test_approximation_engines.py -q -rs
Run slow model-combination tests only when needed:
python -m pytest tests/models_tests -m slow -o addopts="" -q
Before tagging or submitting to JOSS, follow the release and JOSS validation guide.
Community and project governance
Bug reports, usage questions, and scientific enhancement proposals should use the structured issue forms. Public contributions are reviewed through pull requests and the automated CI checks.
License
This project is licensed under the BSD-3-Clause License. See LICENSE for details.
Citation
If you use frsutils in research, cite the software metadata in
CITATION.cff. After the JOSS paper is accepted, cite the JOSS
paper DOI as the preferred citation.
@software{Amiri_frsutils_2026,
author = {Amiri, Mehran},
title = {frsutils: Fuzzy-Rough Set Utilities for Python},
url = {https://github.com/mehi64/frsutils},
version = {0.1.0},
year = {2026}
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frsutils-0.1.0.tar.gz.
File metadata
- Download URL: frsutils-0.1.0.tar.gz
- Upload date:
- Size: 264.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f628e4e44271e23a79f2f24b25ca3180f069d63955b62bab6de78cf6d6b30f7
|
|
| MD5 |
ab81e15db7808d6d673962547c4ffb2c
|
|
| BLAKE2b-256 |
a2d453981539ee60a05d72d945017559c06be2c84aac0f267457774510ab0dbb
|
File details
Details for the file frsutils-0.1.0-py3-none-any.whl.
File metadata
- Download URL: frsutils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 72.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a28fee4136611a86991c57bb9a021da799ddcf59750d15f04f9eee17191c66ef
|
|
| MD5 |
3401e2f02da76d940f809a10f31508a2
|
|
| BLAKE2b-256 |
c6d92044dfe102eefeadaf762be952f3874722f93753b37871fddaef9b28ea08
|