Module rule :: Class Rule
[hide private]
[frames] | no frames]

Class Rule

source code

Instance Methods [hide private]
 
__init__(self, name=None, add_coverage=0, add_confidence=0)
Construct a new rule.
source code
 
__repr__(self)
String representation of the ruleset.
source code
 
append(self, rule)
Append a rule to the ruleset.
source code
 
set_exceptions(self, rules)
Add exceptions to the rule.
source code
float
get_error(self)
Calculate error percentage.
source code
float
get_single_error(self)
Calculate error percentage without taking exceptions into account.
source code
boolean
shorter_than(self, rule2, c)
Compare rule's description length with another rule.
source code
 
cost(self)
Find the cost per element for the rule.
source code
Class Variables [hide private]
  MAX_COST = 1000000
Method Details [hide private]

append(self, rule)

source code 

Append a rule to the ruleset.

Parameters:
  • rule (Rule) - rule to be appended.

set_exceptions(self, rules)

source code 

Add exceptions to the rule.

Parameters:
  • rules (Ruleset) - exceptions to be added.

get_error(self)

source code 

Calculate error percentage.

Returns: float
error percentage of the rule.

get_single_error(self)

source code 

Calculate error percentage without taking exceptions into account.

Returns: float
error percentage of the rule without exceptions.

shorter_than(self, rule2, c)

source code 

Compare rule's description length with another rule.

Parameters:
  • rule2 (Rule) - rule to compare with.
Returns: boolean
True if rule has shorter description length than rule2.