Skip to main content

A torch based package for fuzzy rank based ensembles

Project description

Fuzzy-Rank-Ensemble-Torch

GitHub Release GitHub License PyPI - Version PyPI - Downloads Python Version

A PyTorch-based implementation of a Fuzzy Rank-based Ensemble compatible with the MONAI framework for medical image segmentation and classification tasks.

The code is based on our papers:

Installation

Basic Installation

pip install fuzzy-rank-ensemble-torch

With MONAI Support

pip install fuzzy-rank-ensemble-torch[monai]

Development Installation

git clone https://github.com/Digiratory/fuzzy-rank-ensemble-torch.git
cd fuzzy-rank-ensemble-torch
pip install -e .

Usage

Pure PyTorch Implementation

import torch
from fuzzy_rank_ensemble_torch import fuzzy_rank_ensemble

# Initialize prediction tensors from different models
# Shape: [Batch, Class Index]

# Inception v3 model predictions
inception_v3_pred = torch.tensor([[0.261, 0.315, 0.102, 0.286]])

# Xception model predictions
xception_pred = torch.tensor([[0.402, 0.347, 0.201, 0.050]])

# DenseNet-169 model predictions
densenet_169_pred = torch.tensor([[0.357, 0.467, 0.131, 0.045]])

# Apply fuzzy rank ensemble
result = fuzzy_rank_ensemble([inception_v3_pred, xception_pred, densenet_169_pred])
print(f"Ensemble Result: {result}")

MONAI Integration

import torch
from fuzzy_rank_ensemble_torch.monai import FuzzyRankBasedEnsemble

# Initialize models and predictions (same as above)
# ...

# Create ensemble instance
ens = FuzzyRankBasedEnsemble()

# Apply ensemble to predictions
result = ens([inception_v3_pred, xception_pred, densenet_169_pred])

# Verify result matches expected output
expected = torch.tensor([[1-0.4587, 1-0.4264, 1-0.5948, 1-0.5883]])
assert torch.allclose(result, expected, rtol=1e-03)

Also, you can use dictionary-based wrapper FuzzyRankBasedEnsembled.

Citation

If you use this software in your research, please cite our work:

@article{10.1016/j.bspc.2024.107342,
  title     = {A fuzzy rank-based ensemble of CNN models for MRI segmentation},
  journal   = {Biomedical Signal Processing and Control},
  volume    = {102},
  pages     = {107342},
  year      = {2025},
  issn      = {1746-8094},
  doi       = {10.1016/j.bspc.2024.107342},
  url       = {https://www.sciencedirect.com/science/article/pii/S1746809424014009},
  author    = {Valenkova, Daria and Lyanova, Asya and Sinitca, Aleksandr and Sarkar, Ram and Kaplun, Dmitrii},
}
@article{manna2021fuzzy,
  title        = {A fuzzy rank-based ensemble of CNN models for classification of cervical cytology},
  author       = {Manna, Ankur and Kundu, Rohit and Kaplun, Dmitrii and Sinitca, Aleksandr and Sarkar, Ram},
  journal      = {Scientific Reports},
  volume       = {11},
  number       = {1},
  pages        = {1--18},
  year         = {2021},
  doi          = {10.1038/s41598-021-93783-8},
  publisher    = {Nature Publishing Group}
}

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is licensed under the Apache-2.0 license - see the LICENSE file for details.

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

fuzzy_rank_ensemble_torch-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

fuzzy_rank_ensemble_torch-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file fuzzy_rank_ensemble_torch-0.1.1.tar.gz.

File metadata

File hashes

Hashes for fuzzy_rank_ensemble_torch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d1dbecdb2d82c740b906dbf3075601800a1557a54ad23c7eede4c24ef940d643
MD5 2b56d7423afdf725d3b6db3e6bed8a45
BLAKE2b-256 9238dc64ff49fa7b787bd8b14e78d43266e091e3733ed55f95a132decb53fc9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuzzy_rank_ensemble_torch-0.1.1.tar.gz:

Publisher: python-publish.yml on Digiratory/fuzzy-rank-ensemble-torch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fuzzy_rank_ensemble_torch-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fuzzy_rank_ensemble_torch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 177170989f9c249fadd8347aba7617abf22559fbaa4826f1b742b8aeb8020ddb
MD5 cbc38645b67a2872f7519763bd624d7c
BLAKE2b-256 3ac47f794242c82c57a518a33268d8623fdb39f1225dc583a39d92dbafdb0b18

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuzzy_rank_ensemble_torch-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on Digiratory/fuzzy-rank-ensemble-torch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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