Skip to main content

A case-based reasoning python library that aims to help researchers find similar cases according to an input case with a wide range of methods that can detect similarity based on the features of each time series

Project description

CBR-FoX: Case-Based Reasoning for Time Series Prediction Explanations

CBR-FoX is a Python library designed to provide case-based reasoning explanations for time series prediction models. This approach enhances the transparency and interpretability of machine learning models applied to sequential data.

Features

  • Case-Based Reasoning (CBR) Implementation: Utilizes case-based reasoning to enhance explainability in time series predictions.
  • Versatile & Adaptable: Supports various types of time series data.
  • ML Model Compatibility: Easily integrates with common machine learning models.
  • Comprehensible Explanations: Provides clear, human-readable insights into model predictions.

Installation

To install CBR-FoX and its dependencies, either clone the repository or use the pip package manager:

Install via PyPI

pip install CBR-FoX

Install via GitHub

# Clone the repository
git clone https://github.com/aaaimx/CBR-FoX.git
cd CBR-FoX

# Install required dependencies
pip install -r requirements.txt

Usage

Follow these steps to use CBR-FoX in your projects:

1. Retrieve Model Information

Extract the relevant inputs and outputs from your AI model.

2. Create CBR-FoX Instances

from cbr_fox import CBRfoxInstances
cbr_instances = CBRfoxInstances(model_outputs)

3. Initialize the Builder

from cbr_fox import CBRfoxBuilder
builder = CBRfoxBuilder(cbr_instances)

4. Train the Instance

builder.fit(train_windows, train_targets, target_to_analyze, window_to_predict)

5. Obtain Explanations

builder.predict(prediction=prediction, num_cases=5)

6. Visualize Results

builder.visualize_pyplot(
    fmt='--d',
    scatter_params={'s': 50},
    xtick_rotation=50,
    title='Example Visualization',
    xlabel='X-axis',
    ylabel='Y-axis'
)

Library Usage Diagram

The following diagram illustrates the typical workflow of CBR-FoX, from retrieving AI model outputs to generating visual explanations.

Library Basic Usage Diagram

Library File Relation Diagram

The following diagram represents the core classes and their interactions within the library. The cci_distance file is utilized when an instance is created using the custom distance metric implemented in this script.

Library File Relation Diagram


For further details, check out the official documentation: CBR-FoX on Read the Docs.

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

cbr_fox-0.3.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

cbr_fox-0.3.1-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file cbr_fox-0.3.1.tar.gz.

File metadata

  • Download URL: cbr_fox-0.3.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cbr_fox-0.3.1.tar.gz
Algorithm Hash digest
SHA256 26287e4a5386486a4b8e5ed2340d8dc0da1098d0e16a4d8597b551bc18743ffb
MD5 516feb3589305e5d70b726f3a0bca1f7
BLAKE2b-256 0d70e34cd27c38c4cf5d688ecc056b964f4ca47d7e3a04603f60957e8450d0d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbr_fox-0.3.1.tar.gz:

Publisher: publish.yml on aaaimx/CBR-FoX

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

File details

Details for the file cbr_fox-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: cbr_fox-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cbr_fox-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1590ecf588f1274e1a84746c8899f4d4eca3b2ea9526d187cf0a9e6706d4b89
MD5 424d56c9cdf3ca4245a19b04b30b3dc8
BLAKE2b-256 556101a3ca55298e3e094393e4f8dcba44b9c56c17b7e344e57febfb40373513

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbr_fox-0.3.1-py3-none-any.whl:

Publisher: publish.yml on aaaimx/CBR-FoX

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