Skip to main content

highFIS is a comprehensive Python package for training and evaluating high-dimensional TSK fuzzy systems, built on PyTorch and compatible with the scikit-learn API.

Project description

highFIS

CI Documentation DOI PyPI - Python Version PyPI - Version PyPI - License

Python library for high-dimensional Takagi–Sugeno–Kang (TSK) fuzzy inference systems, built on PyTorch with a scikit-learn compatible API.

📦 Installation

Install from PyPI:

pip install highfis

🧠 Quick Start

from highfis import HTSKClassifierEstimator

clf = HTSKClassifierEstimator(
    n_mfs=3,
    rule_base="en",
    epochs=200,
    learning_rate=1e-3,
    ur_weight=0.01,
    random_state=42,
)
clf.fit(X_train, y_train)
print(clf.score(X_test, y_test))

Works with sklearn.pipeline.Pipeline, GridSearchCV, and cross_val_score.

🧩 Key Components

Class Module Description
BaseTSK highfis.base Abstract base for TSK models with unified training loop.
GaussianMF highfis.memberships Differentiable Gaussian membership function.
TriangularMF highfis.memberships Triangular membership function.
TrapezoidalMF highfis.memberships Trapezoidal membership function.
BellMF highfis.memberships Generalized bell membership function.
SigmoidalMF highfis.memberships Sigmoidal membership function.
SoftmaxLogDefuzzifier highfis.defuzzifiers Stable softmax(log(w)) normalization.
SumBasedDefuzzifier highfis.defuzzifiers Classic w / sum(w) normalization.
LogSumDefuzzifier highfis.defuzzifiers Temperature-scaled log-space normalization.
MembershipLayer highfis.layers Evaluates all membership functions.
RuleLayer highfis.layers Computes firing strengths with configurable t-norm and rule base.
ClassificationConsequentLayer highfis.layers Linear TSK consequent aggregation for classification.
RegressionConsequentLayer highfis.layers Linear TSK consequent aggregation for regression.
HTSKClassifier highfis.models Full TSK classification pipeline as nn.Module.
HTSKRegressor highfis.models Full TSK regression pipeline as nn.Module.
TSKClassifier highfis.models Vanilla TSK classifier with sum-based defuzzification.
TSKRegressor highfis.models Vanilla TSK regressor with sum-based defuzzification.
LogTSKClassifier highfis.models LogTSK classifier with log-space defuzzification.
LogTSKRegressor highfis.models LogTSK regressor with log-space defuzzification.
HTSKClassifierEstimator highfis.estimators sklearn-compatible classification estimator.
HTSKRegressorEstimator highfis.estimators sklearn-compatible regression estimator.
TSKClassifierEstimator highfis.estimators sklearn-compatible vanilla TSK classifier estimator.
TSKRegressorEstimator highfis.estimators sklearn-compatible vanilla TSK regressor estimator.
LogTSKClassifierEstimator highfis.estimators sklearn-compatible LogTSK classifier estimator.
LogTSKRegressorEstimator highfis.estimators sklearn-compatible LogTSK regressor estimator.
InputConfig highfis.estimators Per-feature membership function configuration.

Structural Typing Protocols

Protocol Description
MembershipFn Any callable (Tensor) → Tensor for membership degrees.
TNorm Any callable (Tensor) → Tensor for rule aggregation.
Defuzzifier Any callable (Tensor) → Tensor for firing-strength normalization.
ConsequentFn Any callable (Tensor, Tensor) → Tensor for consequent output.

🧪 Testing & Quality

Running tests

Run the full test suite with coverage:

hatch test -c -a

This project is tested on Python 3.11 | 3.12 | 3.13 | 3.14 across Linux, Windows and macOS.

Linting & Formatting

hatch fmt

Typing

hatch run typing

Security

hatch run security

📚 Documentation

Comprehensive guides, API reference, and examples: dcruzf.github.io/highFIS.

🤝 Contributing

Issues and pull requests are welcome! Please open a discussion if you'd like to propose larger changes.

📄 License

Distributed under the GPLv3.

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

highfis-0.4.0.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

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

highfis-0.4.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file highfis-0.4.0.tar.gz.

File metadata

  • Download URL: highfis-0.4.0.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for highfis-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f89efc0ebd4148b805ef78fc5ab232a89f1bacf38abd2e65d297b7cefe73c0a3
MD5 512594cad4f1e3448f9d9b0b837e5a1b
BLAKE2b-256 2bc6aa05263f83a67c249bec80da257f888d21158a5b4f6953ed031c1a040769

See more details on using hashes here.

File details

Details for the file highfis-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: highfis-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for highfis-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 beb54b7d80d8e9f318d4764c804a8b82287f37af39a77d521edf677c659bcd71
MD5 830eca62f0fe446d9cad9da82ea5d747
BLAKE2b-256 c2ae3083c1b69a8e92f57708aacade2bccb57ffe1e2dcf179f06ce7820df7e0f

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