Module ruleset :: Class Ruleset
[hide private]
[frames] | no frames]

Class Ruleset

source code

Instance Methods [hide private]
 
__init__(self)
Constructor for an empty ruleset.
source code
 
__str__(self)
String representation of the ruleset.
source code
 
append(self, rule)
Append a rule to the ruleset and modify ruleset's properties accordingly.
source code
 
print_rule_tree_2_6(ruleset, depth, pos_symbol, neg_symbol)
Print out the rules.
source code
 
print_rule_tree(ruleset, depth, pos_symbol, neg_symbol)
Print out the rules.
source code
integer
count_rules(ruleset)
Count the number of rules in a ruleset.
source code
boolean
improved_by(self, rule, datapoint_bits, c)
Check if adding a rule improves the ruleset by shortening its description length.
source code
Method Details [hide private]

append(self, rule)

source code 

Append a rule to the ruleset and modify ruleset's properties accordingly.

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

print_rule_tree_2_6(ruleset, depth, pos_symbol, neg_symbol)

source code 

Print out the rules.

Can be used with Python 2.6+

Parameters:
  • ruleset (Ruleset) - rules to output.
  • depth (integer) - Current depth.
  • pos_symbol (string) - Symbol signifying positive classification.
  • neg_symbol (string) - Symbol signifying negative classification.

print_rule_tree(ruleset, depth, pos_symbol, neg_symbol)

source code 

Print out the rules.

Parameters:
  • ruleset (Ruleset) - rules to output.
  • depth (integer) - Current depth.
  • pos_symbol (string) - Symbol signifying positive classification.
  • neg_symbol (string) - Symbol signifying negative classification.

count_rules(ruleset)

source code 

Count the number of rules in a ruleset.

Parameters:
  • ruleset (Ruleset) - ruleset whose rules are to be counted.
Returns: integer
number of rules in the ruleset.

improved_by(self, rule, datapoint_bits, c)

source code 

Check if adding a rule improves the ruleset by shortening its description length.

Parameters:
  • rule (Rule) - rule to be added.
  • datapoint_bits (float) - bits needed to encode one data point.
  • c (float) - Symbol signifying positive classification.
Returns: boolean
True if adding the rule to ruleset shortens its description length.