CBR-FoX is a Python library designed to provide case-based reasoning explanations for time series prediction models. This approach enhances the transparency and understanding of machine learning models used with sequential data.
- CBR-FoX approach implementation.
- Adaptable to various types of time series.
- Compatible with common machine learning models.
- Generates comprehensible explanations.
Clone this repository and install its dependencies:
git clone https://github.com/jerryperezperez/CBR-FoX.git
cd CBR-FoX
pip install -r requirements.txt
Follow these steps to use CBR-FoX in your projects:
-
Retreive model's information: Obtain the inputs and outputs generated by your AI model.
-
Create CBRfox instances:
cbr_instances = CBRfoxInstances(model_outputs)
-
Initialize Builder
builder = CBRfoxBuilder(cbr_instances)
-
Train the instance:
builder.fit(train_windows, train_targets, target_to_analyze, window_to_predict)
-
Obtain explanations:
builder.predict(prediction = prediction,num_cases=5)
-
Use graph visualization methods:
builder.visualize_pyplot( fmt = '--d', scatter_params={"s": 50}, xtick_rotation=50, title="nombre", xlabel="x", ylabel="y" )
The following diagram illustrates the typical workflow when using the CBR-FoX library. From retrieving inputs and outputs from the AI model to generating visual explanations, each step is designed to facilitate the interpretation and explanation of time series-based predictions.
The following diagram shows the classes involved in the basic functionality of the library. Thecci_distance
file is used when creating an instance that employs the eponymous technique implemented in this script.