NiaARMTS¶
- class niaarmts.NiaARMTS.NiaARMTS(dimension, lower, upper, features, transactions, interval, alpha, beta, gamma, delta)¶
Bases:
Problem
- add_rule_to_archive(full_rule, antecedent, consequent, fitness, start, end, support, confidence, inclusion, amplitude)¶
Add the rule to the archive if its fitness is greater than zero and it’s not already present.
- Parameters:
full_rule (list) – The full rule generated from the solution.
antecedent (list) – The antecedent part of the rule.
consequent (list) – The consequent part of the rule.
fitness (float) – The fitness value of the rule.
start (timestamp) – The start timestamp for the rule.
end (timestamp) – The end timestamp for the rule.
support (float) – Support value for the rule.
confidence (float) – Confidence value for the rule.
inclusion (float) – Inclusion metric for the rule.
amplitude (float) – Amplitude metric for the rule.
- cut_point(sol, num_attr)¶
Calculate cut point based on the solution and the number of attributes.
- get_rule_archive()¶
Return the archive of all valid rules (those with fitness > 0), sorted by fitness in descending order.
- rule_representation(rule)¶
Generate a string representation of a rule for easier comparison and to avoid duplicates. :param rule: The rule to represent as a string. :type rule: list
- Returns:
A string representation of the rule.
- Return type:
str
- save_rules_to_csv(file_path)¶
Save the archived rules to a CSV file, sorted by fitness (descending).
- Parameters:
file_path (str) – The path to save the CSV file.
- save_rules_to_json(file_path)¶
Save the archived rules to a JSON file, sorted by fitness (descending).
- Parameters:
file_path (str) – The path to save the JSON file.