Skip to content

Commit

Permalink
Merge pull request #428 from Tarun-Sreepada/main
Browse files Browse the repository at this point in the history
standard format
  • Loading branch information
udayRage authored May 29, 2024
2 parents 449b28e + 7be754c commit 04a903d
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 7 deletions.
3 changes: 3 additions & 0 deletions PAMI/correlatedPattern/basic/CoMine.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def _creatingItemSets(self) -> None:
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")
if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
data = _ab._urlopen(self._iFile)
Expand Down
3 changes: 3 additions & 0 deletions PAMI/correlatedPattern/basic/CoMinePlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def _creatingItemSets(self) -> None:
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")
if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
data = _ab._urlopen(self._iFile)
Expand Down
5 changes: 2 additions & 3 deletions PAMI/extras/syntheticDataGenerator/TransactionalDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def save(self, filename) -> None:
for line in self.db:
f.write(str(self.seperator).join(map(str, line)) + '\n')

def getTransactions(self) -> pd.DataFrame:
def getTransactions(self, sep = "\t") -> pd.DataFrame:
"""
Get the transactional database in dataFrame format
Expand All @@ -182,8 +182,7 @@ def getTransactions(self) -> pd.DataFrame:
"""
column = "Transactions"
db = pd.DataFrame(columns=[column])
temp = ["\t".join([str(a) for a in x]) for x in self.db]
db[column] = temp
db[column] = [sep.join(map(str, line)) for line in self.db]
return db


Expand Down
8 changes: 4 additions & 4 deletions PAMI/frequentPattern/basic/Apriori.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ def _creatingItemSets(self) -> None:
print("its empty..")
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
temp = self._iFile['Transactions'].tolist()

for k in temp:
self._Database.append(set(k))
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")
if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
data = _ab._urlopen(self._iFile)
Expand Down
3 changes: 3 additions & 0 deletions PAMI/frequentPattern/basic/Aprioribitset.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def _creatingItemSets(self):
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")

if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
Expand Down
3 changes: 3 additions & 0 deletions PAMI/frequentPattern/basic/ECLAT.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def _creatingItemSets(self) -> float:
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")
if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
data = _ab._urlopen(self._iFile)
Expand Down
3 changes: 3 additions & 0 deletions PAMI/frequentPattern/basic/ECLATDiffset.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def _creatingItemSets(self):
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")
if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
data = _ab._urlopen(self._iFile)
Expand Down
3 changes: 3 additions & 0 deletions PAMI/frequentPattern/basic/ECLATbitset.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def _creatingItemSets(self):
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")

if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
Expand Down
4 changes: 4 additions & 0 deletions PAMI/frequentPattern/basic/FPGrowth.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def __creatingItemSets(self) -> None:
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self.__Database = self._iFile['Transactions'].tolist()
self.__Database = [x.split(self._sep) for x in self.__Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")


#print(self.Database)
if isinstance(self._iFile, str):
Expand Down
4 changes: 4 additions & 0 deletions PAMI/frequentPattern/closed/CHARM.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def _creatingItemsets(self):
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [i.split(self._sep) for i in self._Database]

else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")
for i in self._Database:
self._lno += 1
for j in i:
Expand Down
4 changes: 4 additions & 0 deletions PAMI/frequentPattern/maximal/MaxFPGrowth.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ def _creatingItemSets(self):
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")

if isinstance(self._iFile, str):
if _ab._validators.url(self._iFile):
data = _ab._urlopen(self._iFile)
Expand Down
3 changes: 3 additions & 0 deletions PAMI/frequentPattern/topk/FAE.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def _creatingItemSets(self):
i = self._iFile.columns.values.tolist()
if 'Transactions' in i:
self._Database = self._iFile['Transactions'].tolist()
self._Database = [x.split(self._sep) for x in self._Database]
else:
print("The column name should be Transactions and each line should be separated by tab space or a seperator specified by the user")

# print(self.Database)
if isinstance(self._iFile, str):
Expand Down

0 comments on commit 04a903d

Please sign in to comment.