Skip to content

Commit fa2a4d8

Browse files
authored
Merge pull request #563 from LasyaPalla/main
updated the function's return types
2 parents ad0c704 + 0cfe54b commit fa2a4d8

File tree

27 files changed

+133
-132
lines changed

27 files changed

+133
-132
lines changed

PAMI/AssociationRules/basic/_ARWithLeverage.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555

5656
from PAMI.AssociationRules.basic import abstract as _ab
57-
from typing import List, Dict, Tuple, Set, Union, Any, Generator
57+
#from typing import List, Dict, Tuple, Set, Union, Any, Generator
5858
from deprecated import deprecated
5959

6060

@@ -97,7 +97,7 @@ def _generation(self, prefix, suffix) -> None:
9797

9898

9999
if len(suffix) == 1:
100-
conf = self._generateWithLeverage(prefix, suffix[0])
100+
self._generateWithLeverage(prefix, suffix[0])
101101
for i in range(len(suffix)):
102102
suffix1 = suffix[:i] + suffix[i + 1:]
103103
prefix1 = prefix + ' ' + suffix[i]
@@ -140,7 +140,7 @@ def run(self) -> None:
140140
suffix = self._singleItems[:i] + self._singleItems[i + 1:]
141141
prefix = self._singleItems[i]
142142
for j in range(i + 1, len(self._singleItems)):
143-
conf = self._generateWithLeverage(self._singleItems[i], self._singleItems[j])
143+
self._generateWithLeverage(self._singleItems[i], self._singleItems[j])
144144
self._generation(prefix, suffix)
145145

146146

@@ -234,6 +234,7 @@ def __init__(self, iFile, minConf, sep) -> None:
234234
:type sep: str
235235
:return: None
236236
"""
237+
self._frequentPattern = None
237238
self._iFile = iFile
238239
self._minConf = minConf
239240
self._finalPatterns = {}

PAMI/extras/syntheticDataGenerator/GeoReferentialTemporalDatabase.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GeoReferentialTemporalDatabase:
1818
No of transactions
1919
noOfItems : int or float
2020
No of items
21-
avgTransactionLength : str
21+
avgTransactionLength : int
2222
The length of average transaction
2323
outputFile: str
2424
Name of the output file.
@@ -90,21 +90,21 @@ def performCoinFlip(self, probability: float) -> bool:
9090
result = np.random.choice([0, 1], p=[1 - probability, probability])
9191
return result
9292

93-
def tuning(self, array, sumRes) -> list:
93+
def tuning(self, array, sumRes) -> np.ndarray:
9494
"""
9595
Tune the array so that the sum of the values is equal to sumRes
9696
9797
:param array: list of values
9898
99-
:type array: list
99+
:type array: numpy.ndarray
100100
101101
:param sumRes: the sum of the values in the array to be tuned
102102
103103
:type sumRes: int
104104
105105
:return: list of values with the tuned values and the sum of the values in the array to be tuned and sumRes is equal to sumRes
106106
107-
:rtype: list
107+
:rtype: numpy.ndarray
108108
"""
109109

110110
while np.sum(array) != sumRes:
@@ -118,17 +118,17 @@ def tuning(self, array, sumRes) -> list:
118118
array[minIndex] += 1
119119
return array
120120

121-
def generateArray(self, nums, avg, maxItems) -> list:
121+
def generateArray(self, nums, avg, maxItems) -> np.ndarray:
122122
"""
123123
Generate a random array of length n whose values average to m
124124
125125
:param nums: number of values
126126
127-
:type nums: list
127+
:type nums: int
128128
129129
:param avg: average value
130130
131-
:type avg: float
131+
:type avg: int
132132
133133
:param maxItems: maximum value
134134

PAMI/extras/syntheticDataGenerator/GeoReferentialTransactionalDatabase.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,21 @@ def __init__(self, databaseSize, avgItemsPerTransaction, numItems, x1, y1, x2, y
103103
self._endTime = float()
104104
self._memoryUSS = float()
105105
self._memoryRSS = float()
106-
def tuning(self, array, sumRes) -> list:
106+
def tuning(self, array, sumRes) -> np.ndarray:
107107
"""
108108
Tune the array so that the sum of the values is equal to sumRes
109109
110110
:param array: list of values
111111
112-
:type array: list
112+
:type array: numpy.ndarray
113113
114114
:param sumRes: the sum of the values in the array to be tuned
115115
116116
:type sumRes: int
117117
118118
:return: list of values with the tuned values and the sum of the values in the array to be tuned and sumRes is equal to sumRes
119119
120-
:rtype: list
120+
:rtype: numpy.ndarray
121121
"""
122122

123123
while np.sum(array) != sumRes:
@@ -131,25 +131,25 @@ def tuning(self, array, sumRes) -> list:
131131
array[minIndex] += 1
132132
return array
133133

134-
def generateArray(self, nums, avg, maxItems) -> list:
134+
def generateArray(self, nums, avg, maxItems) -> np.ndarray:
135135
"""
136136
Generate a random array of length n whose values average to m
137137
138138
:param nums: number of values
139139
140-
:type nums: list
140+
:type nums: int
141141
142142
:param avg: average value
143143
144-
:type avg: float
144+
:type avg: int
145145
146146
:param maxItems: maximum value
147147
148148
:type maxItems: int
149149
150150
:return: random array
151151
152-
:rtype: list
152+
:rtype: numpy.ndarray
153153
"""
154154

155155
# generate n random values

PAMI/extras/syntheticDataGenerator/SequentialDatabase.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(self, numSeq, avgItemsetPerSeq, avgItemsPerItemset, numItems, maxIt
9494
self.seqSep = seqSep
9595
self.db = []
9696

97-
def tuning(self, array, sumRes) -> list:
97+
def tuning(self, array, sumRes) -> np.ndarray:
9898
"""
9999
Tune the array so that the sum of the values is equal to sumRes
100100
@@ -123,17 +123,17 @@ def tuning(self, array, sumRes) -> list:
123123
array[randIndex] += 1
124124
return array
125125

126-
def generateArray(self, nums, avg, maxItems) -> list:
126+
def generateArray(self, nums, avg, maxItems) -> np.ndarray:
127127
"""
128128
Generate a random array of length nums whose values average to avg
129129
130130
:param nums: number of values
131131
132-
:type nums: list
132+
:type nums: int
133133
134134
:param avg: average value
135135
136-
:type avg: float
136+
:type avg: int
137137
138138
:param maxItems: maximum value
139139

PAMI/extras/syntheticDataGenerator/_TransactionalDatabase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __init__(self, databaseSize, avgItemsPerTransaction, numItems,sep = "\t") ->
107107
self.sep = sep
108108
self.db = []
109109

110-
def _generateArray(self, nums, avg, maxItems) -> list:
110+
def _generateArray(self, nums, avg, maxItems):
111111
"""
112112
Generate a random array of length n whose values average to m
113113

PAMI/extras/syntheticDataGenerator/createSyntheticGeoreferentialTransactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def createGeoreferentialTransactionalDatabase(self, outputFile):
6161
writer.write("%s \n" % st)
6262

6363
if __name__ == "__main__":
64-
_ap = str()
64+
#_ap = str()
6565
_ap = createSyntheticGeoreferentialTransaction(100000, 870, 10)
6666
_ap.createGeoreferentialTransactionalDatabase("T10_geo.txt")
6767
else:

PAMI/extras/syntheticDataGenerator/createSyntheticGeoreferentialUncertainTransaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def createGeoreferentialUncertainTransactionalDatabase(self, outputFile: str) ->
6565
writer.write("%s \n" % st1)
6666

6767
if __name__ == "__main__":
68-
_ap = str()
68+
#_ap = str()
6969
_ap = createSyntheticGeoreferentialUncertainTransaction(100000, 870, 10)
7070
_ap.createGeoreferentialUncertainTransactionalDatabase("T10_geo_un.txt")
7171
else:

PAMI/extras/syntheticDataGenerator/createSyntheticTemporal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def createTemporalDatabase(self, outputFile: str) -> None:
5151
count += 1
5252

5353
if __name__ == "__main__":
54-
_ap = str()
54+
#_ap = str()
5555
_ap = createSyntheticTemporal(100000, 870, 10)
5656
_ap.createTemporalDatabase("temporal_T10.txt")
5757
else:

PAMI/extras/syntheticDataGenerator/createSyntheticTransactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def createTransactionalDatabase(self, outputFile: str) -> None:
4949
writer.write("%s \n" % st)
5050

5151
if __name__ == "__main__":
52-
_ap = str()
52+
#_ap = str()
5353
_ap = createSyntheticTransaction(100000, 870, 10)
5454
_ap.createTransactionalDatabase("T10.txt")
5555
else:

PAMI/extras/syntheticDataGenerator/createSyntheticUncertainTemporal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def createUncertainTemporalDatabase(self, outputFile: str) -> None:
5858

5959

6060
if __name__ == "__main__":
61-
_ap = str()
61+
#_ap = str()
6262
_ap = createSyntheticUncertainTemporal(50000, 870, 10)
6363
_ap.createUncertainTemporalDatabase("T10_uncertain_temp.txt")
6464
else:

0 commit comments

Comments
 (0)