ex_fuzzy.classifiers.RuleMineClassifier#

class ex_fuzzy.classifiers.RuleMineClassifier(nRules=30, nAnts=4, fuzzy_type=None, tolerance=0.0, verbose=False, n_class=None, runner=1, linguistic_variables=None)[source]#

Bases: ClassifierMixin

A classifier that works by mining a set of candidate rules with a minimum support, confidence and lift, and then using a genetic algorithm that chooses the optimal combination of those rules.

__init__(nRules=30, nAnts=4, fuzzy_type=None, tolerance=0.0, verbose=False, n_class=None, runner=1, linguistic_variables=None)[source]#

Inits the optimizer with the corresponding parameters.

Parameters:
  • nRules (int) – number of rules to optimize.

  • nAnts (int) – max number of antecedents to use.

  • type (fuzzy) – FUZZY_SET enum type in fuzzy_sets module. The kind of fuzzy set used.

  • tolerance (float) – tolerance for the support/dominance score of the rules.

  • verbose – if True, prints the progress of the optimization.

  • n_class (int) – number of classes in the problem. If None (default) the classifier will compute it empirically.

  • runner (int) – number of threads to use.

  • linguistic_variables (list[fuzzyVariable]) – linguistic variables per antecedent.

fit(X, y, n_gen=30, pop_size=50, **kwargs)[source]#

Trains the model with the given data.

Parameters:
  • X (array) – samples to train.

  • y (array) – labels for each sample.

  • n_gen (int) – number of generations to compute in the genetic optimization.

  • pop_size (int) – number of subjects per generation.

  • kwargs – additional parameters for the genetic optimization. See fit method in BaseRuleBaseClassifier.

predict(X)[source]#

Predict for each sample the corresponding class.

Parameters:

X (array) – samples to predict.

Returns:

a class for each sample.

Return type:

array

internal_classifier()[source]#