builder

cbr_fox_builder module

class cbr_fox.builder.cbr_fox_builder.cbr_fox_builder(techniques)[source]

Bases: object

A class for managing multiple techniques used in case-based reasoning (CBR) with cbr_fox objects.

This class allows the user to store different techniques, explain them, fit them to training data, and make predictions. It provides an interface for visualizing the results of each technique using plot_utils.

explain_all_techniques(training_windows, target_training_windows, forecasted_window, prediction, num_cases)[source]

Explains all techniques provided by the user.

This method loops through each technique stored in techniques_dict and calls the explain method of each one to provide an explanation of the given case.

Parameters:
  • training_windows (ndarray) – The training windows for the CBR model.

  • target_training_windows (ndarray) – The target training windows for the CBR model.

  • forecasted_window (ndarray) – The forecasted window for the CBR model.

  • prediction (ndarray) – The prediction made by the CBR model.

  • num_cases (int) – The number of cases used in the explanation.

fit(training_windows, target_training_windows, forecasted_window)[source]

Fits all techniques to the provided training data.

This method calls the fit method of each technique stored in techniques_dict to train them using the provided data.

Parameters:
  • training_windows (ndarray) – The training windows for the CBR model.

  • target_training_windows (ndarray) – The target training windows for the CBR model.

  • forecasted_window (ndarray) – The forecasted window for the CBR model.

predict(prediction, num_cases, mode='simple')[source]

Makes predictions using all the techniques stored in techniques_dict.

This method calls the predict method of each technique, passing the provided prediction and number of cases.

Parameters:
  • prediction (ndarray) – The predicted values for the given cases.

  • num_cases (int) – The number of cases to predict.

visualize_pyplot(mode='individual', **kwargs)[source]

Visualizes the techniques using plot_utils.visualize_pyplot.

This method creates visualizations for all the techniques in techniques_dict using plot_utils.

Parameters:

**kwargs – Additional keyword arguments to pass to the visualization function.

Returns:

A list of visualizations for each technique.

Return type:

list