Classification evaluation tools

Functions that contain some general functions to eval already fitted fuzzy rule based models. It can also be used to visualize rules and fuzzy partitions.

class ex_fuzzy.eval_tools.FuzzyEvaluator(fl_classifier: BaseFuzzyRulesClassifier)[source]

Bases: object

Takes a model and associated data and permits rule evaluation

eval_fuzzy_model(X_train: array, y_train: array, X_test: array, y_test: array, plot_rules=True, print_rules=True, plot_partitions=True, return_rules=False, print_accuracy=True, print_matthew=True, export_path: str = None) None[source]

Function that evaluates a fuzzy rule based model. It also plots the rules and the fuzzy partitions.

Parameters:
  • X_train – Training data.

  • y_train – Training labels.

  • X_test – Test data.

  • y_test – Test labels.

  • plot_rules – If True, it plots the rules.

  • print_rules – If True, it prints the rules.

  • plot_partitions – If True, it plots the fuzzy partitions.

Returns:

None

get_metric(metric: str, X_true: array, y_true: array, **kwargs) float[source]
Parameters:
  • metric – named metric in string format available in sklearn library for evaluation

  • X_true – np.array of X values for prediction

  • y_true – np.array of true class outcomes for X values

  • **kwargs

    additional arguments for different sklearn.metrics functions