Skip to content

Commit ff0f396

Browse files
committed
Documentation edits
1 parent 8de7279 commit ff0f396

File tree

12 files changed

+35
-45
lines changed

12 files changed

+35
-45
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/firefly-cpp/niaarm.svg)
1515
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/firefly-cpp/niaarm.svg)](http://isitmaintained.com/project/firefly-cpp/niaarm "Average time to resolve an issue")
1616

17-
## General outline of framework
18-
NiaARM is a framework for Association Rule Mining based on nature-inspired algorithms for optimization. The framework is fully written in Python and runs on all platforms.
19-
NiaARM allows users to automatically preprocess the data in a transaction database, to search for association rules and provide pretty output of rules found. This framework also supports numerical and real-valued types of attributes besides the categorical ones. Mining the association rules is defined as an optimization problem and solved using the nature-inspired algorithms that comes from the related framework called [NiaPy](https://github.com/NiaOrg/NiaPy).
17+
## General outline of the framework
18+
NiaARM is a framework for Association Rule Mining based on nature-inspired algorithms for optimization. The framework is written fully in Python and runs on all platforms. NiaARM allows users to preprocess the data in a transaction database automatically, to search for association rules and provide a pretty output of the rules found. This framework also supports numerical and real-valued types of attributes besides the categorical ones. Mining the association rules is defined as an optimization problem, and solved using the nature-inspired algorithms that come from the related framework called [NiaPy](https://github.com/NiaOrg/NiaPy).
2019

2120
## Detailed insights
22-
Current version witholds (but is not limited to) following functions:
21+
The current version witholds (but is not limited to) the following functions:
2322

24-
- loading dataset in CSV format,
23+
- loading datasets in CSV format,
2524
- preprocessing of data,
2625
- searching for association rules,
2726
- providing output of mined association rules,

datasets/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# References
22

3-
- Abalone dataset is downloaded from https://archive.ics.uci.edu/ml/index.php.
3+
- The Abalone dataset is downloaded from https://archive.ics.uci.edu/ml/index.php.
44

5-
- wiki_test_case dataset is composed from first Table found in: https://en.wikipedia.org/wiki/Lift_(data_mining)
5+
- The wiki_test_case dataset is composed from the first Table found in: https://en.wikipedia.org/wiki/Lift_(data_mining)

examples/basic_run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66

77
if __name__ == '__main__':
8-
# load and preprocess dataset from csv
8+
# load and preprocess the dataset from csv
99
data = Dataset("datasets/Abalone.csv")
1010

1111
# Create a problem:::
12-
# dimension represents dimension of the problem;
12+
# dimension represents the dimension of the problem;
1313
# features represent the list of features, while transactions depicts the list of transactions
1414
# the following 4 elements represent weights (support, confidence, coverage, shrinkage)
15-
# None defines that criteria is omitted and is therefore excluded from fitness function
15+
# None defines that criteria are omitted and are, therefore, excluded from the fitness function
1616
problem = NiaARM(data.dimension, data.features, data.transactions, alpha=1.0, beta=1.0)
1717

1818
# build niapy task

examples/feature_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# numerical features: min and max borders
55
# categorical features: all categories
66
if __name__ == '__main__':
7-
# load and preprocess dataset from csv
7+
# load and preprocess the dataset from csv
88
data = Dataset("datasets/Abalone.csv")
99
# get feature report
1010
data.feature_report()

niaarm/association_rule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def build_rule(self, vector):
2020
current_feature = self.permutation[i]
2121
feature = self.features[current_feature]
2222

23-
# set current position in vector
23+
# set current position in the vector
2424
vector_position = self.feature_position(current_feature)
2525

26-
# get threshold for each feature
26+
# get a threshold for each feature
2727
threshold_position = vector_position + self.threshold_move(current_feature)
2828

2929
if vector[vector_position] > vector[threshold_position]:

niaarm/dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44

55
class Dataset:
6-
r"""Class for working with dataset.
6+
r"""Class for working with a dataset.
77
88
Attributes:
99
data (pd.DataFrame): Data as a pandas Dataframe.
1010
transactions (np.ndarray): Transactional data.
1111
header (list[str]): Feature names.
1212
features (list[Feature]): List of features.
13-
dimension (int): Dimension of the optimization problem for dataset.
13+
dimension (int): Dimension of the optimization problem for the dataset.
1414
1515
"""
1616

@@ -25,7 +25,7 @@ def __init__(self, path, delimiter=',', header=0, names=None):
2525
self.dimension = self.__problem_dimension()
2626

2727
def __analyse_types(self):
28-
r"""Extract data types for data in dataset."""
28+
r"""Extract data types for the data in a dataset."""
2929
for head in self.header:
3030
col = self.data[head]
3131

niaarm/feature.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class Feature:
77
r"""Class representing a feature.
88
99
Attributes:
10-
name (str): Name of feature.
11-
dtype (str): Datatype of feature.
12-
min_val (Optional[float]): Minimum value of feature in transaction database.
13-
max_val (Optional[float]): Maximum value of feature in transaction database.
10+
name (str): Name of the feature.
11+
dtype (str): Datatype of the feature.
12+
min_val (Optional[float]): Minimum value of the feature in the transaction database.
13+
max_val (Optional[float]): Maximum value of the feature in the transaction database.
1414
categories (Optional[list[float]]): Possible categorical feature's values.
1515
1616
"""

niaarm/niaarm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class NiaARM(Problem):
2323
2424
Attributes:
2525
features (list[Feature]): List of features.
26-
transactions (np.ndarray): Data from transaction database.
26+
transactions (np.ndarray): Data from the transaction database.
2727
rules (list[Rule]): Mined association rules.
2828
2929
"""
@@ -46,14 +46,14 @@ def __init__(self, dimension, features, transactions, alpha=0.0, beta=0.0, gamma
4646
super().__init__(dimension, 0.0, 1.0)
4747

4848
def rule_exists(self, antecedent, consequent):
49-
r"""Check if association rule already exists."""
49+
r"""Check if the association rule already exists."""
5050
for rule in self.rules:
5151
if rule.antecedent == antecedent and rule.consequent == consequent:
5252
return True
5353
return False
5454

5555
def export_rules(self, path):
56-
r"""Save all association rules found to csv file."""
56+
r"""Save all association rules found to a csv file."""
5757
with open(path, 'w', newline='') as f:
5858
writer = csv.writer(f)
5959

@@ -84,7 +84,7 @@ def _evaluate(self, sol):
8484
antecedent = rule[:cut]
8585
consequent = rule[cut:]
8686

87-
# check if rule is feasible
87+
# check if the rule is feasible
8888
if _rule_feasible(antecedent, consequent):
8989
# get support and confidence of rule
9090
support, confidence = arm.support_confidence(antecedent, consequent, self.transactions)
@@ -126,8 +126,8 @@ def _evaluate(self, sol):
126126

127127

128128
def _fix_border(antecedent, consequent):
129-
r"""In case lower and upper bounds of interval are the same.
130-
We need this in order to provide clean output.
129+
r"""In case the lower and the upper bounds of interval are the same.
130+
We need this in order to provide a clean output.
131131
132132
Arguments:
133133
antecedent (np.ndarray): .

niaarm/rule.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ class Rule:
77
r"""Class representing an association rule.
88
99
Attributes:
10-
antecedent (list[str]): A list of antecedents of association rule.
11-
consequent (list[str]): A list of consequents of association rule.
12-
fitness (float): Value of fitness function.
13-
support (float): Value of support.
14-
confidence (float): Value of confidence.
15-
shrink (Optional[float]): Value of shrink.
16-
coverage (Optional[float]): Value of coverage.
10+
antecedent (list[str]): A list of antecedents of the association rule.
11+
consequent (list[str]): A list of consequents of the association rule.
12+
fitness (float): Value of the fitness function.
13+
support (float): Value of the support.
14+
confidence (float): Value of the confidence.
15+
shrink (Optional[float]): Value of the shrink.
16+
coverage (Optional[float]): Value of the coverage.
1717
1818
"""
1919

niaarm/tests/test_coverage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class TestCoverage(TestCase):
7-
# let's borrow test case from wikipedia:
7+
# let's borrow a test case from wikipedia:
88
# https://en.wikipedia.org/wiki/Lift_(data_mining)
99

1010
def setUp(self):

0 commit comments

Comments
 (0)