Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standard format #428

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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