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

Pallamadhavi patch 1 #144

Merged
merged 21 commits into from
Aug 18, 2023
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
7 changes: 3 additions & 4 deletions PAMI/extras/DF2DB/DF2DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"""
from PAMI.extras.DF2DB.denseDF2DB import db
from PAMI.extras.DF2DB.sparseDF2DB import db
import sys

class DF2DB:
"""
Expand Down Expand Up @@ -119,8 +120,6 @@ def getUtility(self, outputFile) -> str:
return self.DF2DB.getFileName()


if __name__='__main__':
if __name__ == '__main__':
obj = DF2DB(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
obj.getTransactional(sys.argv[5])


obj.getTransactional(sys.argv[5])
11 changes: 7 additions & 4 deletions PAMI/extras/DF2DB/DF2DBPlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# obj.getTDB("outputFileName") # To create a temporal database
#
# obj.getUDB("outputFileName") # To craete a utility database
# obj.getUDB("outputFileName") # To create a utility database
#
#
__copyright__ = """
Expand All @@ -33,6 +33,7 @@

from PAMI.extras.DF2DB.denseDF2DBPlus import *
from PAMI.extras.DF2DB.sparseDF2DBPlus import *
import sys


class DF2DBPlus:
Expand All @@ -55,18 +56,17 @@ class DF2DBPlus:
.. code-block:: python

from PAMI.extras.DF2DB import DF2DBPlus as dfdbp

obj = dfdbp.DF2DBPlus(idf, ">=", 16)

obj.getTransactional("outputFileName") # To create a transactional database

obj.getTDB("outputFileName") # To create a temporal database

obj.getUDB("outputFileName") # To craete a utility database

"""


def __init__(self, inputDF, thresholdConditionDF, DFtype='sparse') -> None:
self.inputDF = inputDF
self.thresholdConditionDF = thresholdConditionDF
Expand Down Expand Up @@ -113,3 +113,6 @@ def getUDB(self, outputFile) -> str:
"""
self.DF2DB.createUtility(outputFile)
return self.DF2DB.getFileName()
if __name__ == '__main__':
obj = DF2DBPlus(sys.argv[1], sys.argv[2], sys.argv[3])
obj.getTransactional(sys.argv[4])
9 changes: 5 additions & 4 deletions PAMI/extras/DF2DB/createTDB.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#createTDB in this code we will create transactional Database.
# createTDB in this code we will create transactional Database.
#
# **Importing this algorithm into a python program**
# --------------------------------------------------------
Expand All @@ -9,10 +9,10 @@
#
# obj.save(oFile)
#
#

import sys


__copyright__ = """
Copyright (C) 2021 Rage Uday Kiran

Expand Down Expand Up @@ -40,7 +40,7 @@ class createTDB:
:param df: It represents the dataframe

:type df: list

:param threshold : It is the threshold value of all item.

:type threshold: int or float
Expand Down Expand Up @@ -113,7 +113,8 @@ def save(self, outFile):
s = s + j + " "
writer.write("%s \n" % s)


if __name__ == '__main__':
a = createTDB(sys.argv[1], sys.argv[3])
a.createTDB()
a.save(sys.argv[2])
a.save(sys.argv[2])
66 changes: 18 additions & 48 deletions PAMI/extras/DF2DB/denseDF2DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@
# **Importing this algorithm into a python program**
# --------------------------------------------------------
#
# from PAMI.frequentPattern.basic import FPGrowth as fp
# from PAMI.extras.DF2DB import denseDF2DB as db
#
# obj = fp.denseDF2DB(idf, ">=", 16)
# obj = db.denseDF2DB(idf, ">=", 16)
#
# obj.save(oFile)
#
# Df = obj.getPatternInDataFrame()
# obj.createTransactional("outputFileName") # To create transactional database
#
# memUSS = obj.getMemoryUSS()
#
# print("Total Memory in USS:", memUSS)
#
# memRSS = obj.getMemoryRSS()
#
# print("Total Memory in RSS", memRSS)
#
# run = obj.getRuntime()
#
# print("Total ExecutionTime in seconds:", run)
# obj.createTemporal("outputFileName") # To create temporal database
#
# obj.createMultipleTimeSeries("outputFileName") # To create Mutliple TimeSeries database
#
# obj.createUtility("outputFileName") # To create utility database
#
# obj.getFileName("outputFileName") # To get file name of the database

__copyright__ = """
Copyright (C) 2021 Rage Uday Kiran

Expand Down Expand Up @@ -66,54 +60,30 @@ class denseDF2DB:
It is condition to judge the value in dataframe
:param thresholdValue: int or float :
User defined value.
:param tids: list :
It is tids list.
:param items: list :
Store the items list
:param outputFile: str :
Creation database output to this outputFile.


:Attributes:

startTime : float
To record the start time of the mining process

endTime : float
To record the completion time of the mining process

memoryUSS : float
To store the total amount of USS memory consumed by the program

memoryRSS : float
To store the total amount of RSS memory consumed by the program



**Importing this algorithm into a python program**
--------------------------------------------------------
.. code-block:: python

from PAMI.frequentPattern.basic import FPGrowth as fp
from PAMI.extras.DF2DB import denseDF2DB as db

obj = fp.denseDF2DB(iDdf, ">=", 16 )
obj = db.denseDF2DB(iDdf, ">=", 16 )

memUSS = obj.getMemoryUSS()
obj.save(oFile)

print("Total Memory in USS:", memUSS)
obj.createTransactional("outputFileName") # To create transactional database

memRSS = obj.getMemoryRSS()
obj.createTemporal("outputFileName") # To create temporal database

print("Total Memory in RSS", memRSS)
obj.createMultipleTimeSeries("outputFileName") # To create Mutliple TimeSeries database

run = obj.getRuntime()
obj.createUtility("outputFileName") # To create utility database

print("Total ExecutionTime in seconds:", run)
obj.getFileName("outputFileName") # To get file name of the database




"""
"""


def __init__(self, inputDF, condition: str, thresholdValue: Union[int, float]) -> None:
Expand Down Expand Up @@ -252,6 +222,6 @@ def getFileName(self) -> str:

if __name__ == '__main__':
obj = denseDF2DB(sys.argv[1], sys.argv[2], sys.argv[3])
obj.createDB(sys.argv[4])
obj.createTransactional(sys.argv[4])
transactionalDB = obj.getFileName()
print(transactionalDB)
71 changes: 21 additions & 50 deletions PAMI/extras/DF2DB/denseDF2DBPlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,19 @@
# **Importing this algorithm into a python program**
# --------------------------------------------------------
#
# from PAMI.frequentPattern.basic import FPGrowth as fp
# from PAMI.extras.DF2DB import denseDF2DBPlus as db
#
# obj = fp.denseDF2DBPlus(idf, ">=", 16)
# obj = db.denseDF2DBPlus(idf, ">=", 16)
#
# obj.save(oFile)
#
# Df = obj.getPatternInDataFrame()
# obj.createTransactional("outputFileName") # To create transactional database
#
# memUSS = obj.getMemoryUSS()
# obj.createTemporal("outputFileName") # To create temporal database
#
# print("Total Memory in USS:", memUSS)
# obj.createUtility("outputFileName") # To create utility database
#
# memRSS = obj.getMemoryRSS()
#
# print("Total Memory in RSS", memRSS)
#
# run = obj.getRuntime()
#
# print("Total ExecutionTime in seconds:", run)
# obj.getFileName("outputFileName") # To get file name of the database
#
#
#
Expand All @@ -43,66 +37,38 @@
"""

import pandas as pd
import sys

class denseDF2DBPlus:
"""
:Description: This class create Data Base from DataFrame.

:param inputDF: dataframe :
It is dense DataFrame
:param condition: str :
:param thresholdConditionDF: str or int or float:
It is condition to judge the value in dataframe
:param thresholdValue: int or float :
User defined value.
:param tids: list :
It is tids list.
:param items: list :
Store the items list
:param outputFile: str :
Creation database output to this outputFile.


:Attributes:

startTime : float
To record the start time of the mining process

endTime : float
To record the completion time of the mining process

memoryUSS : float
To store the total amount of USS memory consumed by the program

memoryRSS : float
To store the total amount of RSS memory consumed by the program



**Importing this algorithm into a python program**
--------------------------------------------------------
.. code-block:: python

from PAMI.frequentPattern.basic import FPGrowth as fp

obj = fp.denseDF2DBPlus(iDdf, ">=", 16)

memUSS = obj.getMemoryUSS()

print("Total Memory in USS:", memUSS)

memRSS = obj.getMemoryRSS()
from PAMI.extras.DF2DB import denseDF2DBPlus as db

print("Total Memory in RSS", memRSS)
obj = db.denseDF2DBPlus(iDdf, ">=", 16)

run = obj.getRuntime()
obj.save(oFile)

print("Total ExecutionTime in seconds:", run)
obj.createTransactional("outputFileName") # To create transactional database

obj.createTemporal("outputFileName") # To create temporal database

obj.createUtility("outputFileName") # To create utility database

obj.getFileName("outputFileName") # To get file name of the database


"""
"""

def __init__(self, inputDF, thresholdConditionDF) -> None:
self.inputDF = inputDF.T
Expand Down Expand Up @@ -203,3 +169,8 @@ def getFileName(self) -> str:
"""

return self.outputFile

if __name__ == '__main__':
a = denseDF2DBPlus(sys.argv[1], sys.argv[3])
a.denseDF2DBPlus()

Loading