Rule Mining methods#
Fuzzy Rule Mining Module for Ex-Fuzzy Library
This module provides comprehensive fuzzy rule mining capabilities for extracting meaningful rules from datasets using support-based itemset mining algorithms. It implements efficient algorithms for discovering frequent fuzzy patterns and generating fuzzy association rules.
- Main Components:
Itemset mining: Discovery of frequent fuzzy itemsets using support thresholds
Rule generation: Conversion of frequent itemsets into fuzzy association rules
Support calculation: Efficient computation of fuzzy support measures
Rule filtering: Quality-based filtering of discovered rules
Integration with evolutionary algorithms: Compatibility with genetic optimization
- Key Features:
Support-based fuzzy itemset mining with configurable thresholds
Efficient combination generation for large datasets
Integration with fuzzy variable definitions
Support for both Type-1 and Type-2 fuzzy systems
Scalable algorithms for large rule bases
Direct integration with evolutionary optimization workflows
The module is designed to work seamlessly with the evolutionary_fit module to provide a complete pipeline from rule discovery to rule optimization, enabling the creation of high-quality fuzzy rule-based classifiers from data.
- ex_fuzzy.rule_mining.rule_search(data, fuzzy_variables, support_threshold=0.05, max_depth=None)[source]#
Computes the apriori algorithm for the given dataframe and threshold the support.
- ex_fuzzy.rule_mining.generate_rules_from_itemsets(itemsets, nAnts)[source]#
Given a list of itemsets, it creates the rules for each one and returns a list of rules containing them.
- Parameters:
- Returns:
the rules for ech itemset.
- Return type:
- ex_fuzzy.rule_mining.mine_rulebase_support(x, fuzzy_variables, support_threshold=0.05, max_depth=3)[source]#
Search the data for associations that are frequent given a list of fuzzy variables for each antecedent.
- Parameters:
x (DataFrame) – the data to mine. Dims: samples x features.
fuzzy_variables (list[fuzzyVariable]) – list of the fuzzy variables for each of the input variables.
support_threshold (float) – minimum threshold to decide if prune or not the rule.
max_depth (int) – maximum number of antecedents per rule.
- Returns:
a rulebase object with the rules denoted as good.
- Return type:
- ex_fuzzy.rule_mining.prune_rules_confidence_lift(x, y, rules, fuzzy_variables, confidence_threshold=0.5, lift_threshold=1.05)[source]#
Removes the rules from the rule base that do not meet a minimum value for confidence and lift measures.
Confidence is the ratio of rules that have a particular antecedent and consequent, and those that only have the antecedent. Lift is ratio between confidence and expected confidence, which is the percentage of class samples in the original data.
- Parameters:
x (DataFrame) – data to mine. samples x features.
y (array) – class vector.
rules (MasterRuleBase) – MasterRuleBase object with the rules to prune.
fuzzy_variables (list[fuzzyVariable]) – a list of the fuzzy variables per antecedent.
confidence_threshold (float) – minimum confidence required to the rules.
lift_threshold (float) – minimum lift required to the rules.
- ex_fuzzy.rule_mining.simple_mine_rulebase(x, fuzzy_type=FUZZY_SETS.t1, support_threshold=0.05, max_depth=3)[source]#
Search the data for associations that are frequent. Computes the fuzzy variables using a 3 label partition (low, medium, high).
- Parameters:
x (DataFrame) – the data to mine. Dims: samples x features.
fuzzy_type (FUZZY_SETS) – fuzzy type to use.
support_threshold (float) – minimum threshold to decide if prune or not the rule.
max_depth (int) – maximum number of antecedents per rule.
- Returns:
a rulebase object with the rules denoted as good.
- Return type:
- ex_fuzzy.rule_mining.multiclass_mine_rulebase(x, y, fuzzy_variables, support_threshold=0.05, max_depth=3, confidence_threshold=0.05, lift_threshold=1.05)[source]#
Search the data for associations that are frequent and have good confidence/lift values given a list of fuzzy variables for each antecedent. Computes a different ruleBase for each class and then uses them to form a MasterRuleBase.
- Parameters:
x (DataFrame) – the data to mine. Dims: samples x features.
fuzzy_variables (list[fuzzyVariable]) – list of the fuzzy variables for each of the input variables.
support_threshold (float) – minimum threshold to decide if prune or not the rule.
max_depth (int) – maximum number of antecedents per rule.
confidence_threshold (float) – minimum confidence value.
lift_threshold (float)
- Returns:
a rulebase object with the rules denoted as good.
- Return type:
- ex_fuzzy.rule_mining.simple_multiclass_mine_rulebase(x, y, fuzzy_type, support_threshold=0.05, max_depth=3, confidence_threshold=0.5, lift_threshold=1.1)[source]#
Search the data for associations that are frequent and have good confidence/lift values given a list of fuzzy variables for each antecedent. Computes a different ruleBase for each class and then uses them to form a MasterRuleBase.
Computes the fuzzy variables using a 3 label partition (low, medium, high).
- Parameters:
x (DataFrame) – the data to mine. Dims: samples x features.
fuzzy_type (FUZZY_SETS) – fuzzy type to use.
support_threshold (float) – minimum threshold to decide if prune or not the rule.
max_depth (int) – maximum number of antecedents per rule.
- Returns:
a rulebase object with the rules denoted as good.
- Return type: