Skip to main content

RFMSU

Random Tree and Random Forest classifiers based on Multivariate Symmetrical Uncertainty (MSU).

Features

  • Random Tree classifier.
  • Random Tree with MSU.
  • Random Forest classifier.
  • Random Forest with MSU.
  • Local and global discretization.
  • Parallel training using Joblib.
  • Out-of-bag evaluation.

Installation

pip install rfmsu

Usage Examples

1. Basic Configuration

The following example trains a Random Forest with MSU using 100 trees, local discretization, and parallel tree construction.

from rfmsu import RandomForestMSU

clf = RandomForestMSU(
    numIterations=100,
    rediscretize_msu_per_node=True,
    n_jobs=-1
)

clf.fit(X_train, y_train)
predictions = clf.predict(X_test)

2. Weka-Oriented Configuration (Closest to the Original Java Implementation)

The following configuration is the closest to the original Weka implementation of RFMSU, using local discretization and weighted bootstrap sampling.

Local discretization recomputes the discretization at each tree node, while weighted bootstrap sampling represents bootstrap repetitions through instance weights, following the approach used in Weka.

from rfmsu import RandomForestMSU

clf = RandomForestMSU(
    numIterations=100,
    kValue=0,
    maxDepth=0,
    minNum=1,
    seed=42,
    debug=False,
    rediscretize_msu_per_node=True,
    bootstrap_mode="weighted",
    n_jobs=12,
    parallel_backend="loky",
    use_joblib_discretization=False,
    discretization_n_jobs=1
)

clf.fit(X_train, y_train)
predictions = clf.predict(X_test)

Parallelization Options

RFMSU supports parallel tree construction and optional parallel feature discretization.

  • n_jobs: Controls the number of parallel workers used for tree construction in both local and global discretization modes.
  • parallel_backend: Specifies the Joblib backend used for tree construction (loky, threading, or multiprocessing).
  • use_joblib_discretization: Enables parallel feature discretization when global discretization is used.
  • discretization_n_jobs: Specifies the number of workers used for global feature discretization when Joblib is enabled.

Important: In the current implementation, local discretization (rediscretize_msu_per_node=True) is performed sequentially within each tree. Therefore, use_joblib_discretization and discretization_n_jobs do not affect node-level discretization. However, tree construction can still be parallelized using n_jobs.

When global discretization is selected (rediscretize_msu_per_node=False), Joblib can additionally parallelize feature discretization.

Comparison with Weka

The second configuration is recommended for experiments aiming to reproduce the behavior of the original Weka implementation.

However, exact equivalence is not guaranteed due to possible differences in random number generation, bootstrap handling, and other implementation details.

References

RFMSU implements Random Tree and Random Forest classifiers incorporating Multivariate Symmetrical Uncertainty (MSU).

For further details about RFmsu and its theoretical foundations, see:

García-Torres, M., Saucedo, F., Divina, F., & Gómez-Guerrero, S. (2026). RFMSU: A multivariate symmetrical uncertainty-based random forest. Pattern Recognition, 169, 111939. DOI: https://doi.org/10.1016/j.patcog.2025.111939

License

MIT License.

Metadata

Release files for rfmsu 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rfmsu 0.1.3
File Size Uploaded Provenance
rfmsu-0.1.3.tar.gz 52.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rfmsu 0.1.3
File Interpreter ABI Platform
rfmsu-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 108.1 kB

Release files / rfmsu-0.1.3.tar.gz

Download URL rfmsu-0.1.3.tar.gz
Size 52.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0a10659dfa6f9f4dcb9ff97b008d4ef00f6f25303bd7778563c59a8285faa7cb
BLAKE2b-256 checksum
How to use checksums
0601146cd7238eb2348dd4275a7b8e982a730e9e50bd5f00b1c2e8bd6d97ad64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Release files / rfmsu-0.1.3-py3-none-any.whl

Download URL rfmsu-0.1.3-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d3a57ee55b147072655d808737ee3de2d5af3597f36051e09e3995d6268df7d
BLAKE2b-256 checksum
How to use checksums
d879a1d454b6dfab4309058e6464a51a15fdc770198322f3d37b066b60f6026a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Security for rfmsu 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page