PAMI.coveragePattern.basic package
Submodules
PAMI.coveragePattern.basic.CMine module
- class PAMI.coveragePattern.basic.CMine.CMine(iFile, minRF, minCS, maxOR, sep='\t')[source]
Bases:
_coveragePatterns
- Description:
CMine algorithms aims to discover the coverage patterns in transactional databases.
- Reference:
Bhargav Sripada, Polepalli Krishna Reddy, Rage Uday Kiran: Coverage patterns for efficient banner advertisement placement. WWW (Companion Volume) 2011: 131-132 __https://dl.acm.org/doi/10.1145/1963192.1963259
- Parameters:
iFile – str : Name of the Input file to mine complete set of coverage patterns
oFile – str : Name of the output file to store complete set of coverage patterns
minRF – str: Controls the minimum number of transactions in which every item must appear in a database.
minCS – str: Controls the minimum number of transactions in which at least one time within a pattern must appear in a database.
maxOR – str: Controls the maximum number of transactions in which any two items within a pattern can reappear.
sep – str : This variable is used to distinguish items from one another in a transaction. The default seperator is tab space. However, the users can override their default separator.
- Attributes:
- startTimefloat
To record the start time of the mining process
- endTimefloat
To record the completion time of the mining process
- finalPatternsdict
Storing the complete set of patterns in a dictionary variable
- memoryUSSfloat
To store the total amount of USS memory consumed by the program
- memoryRSSfloat
To store the total amount of RSS memory consumed by the program
- Databaselist
To store the transactions of a database in list
Methods to execute code on terminal
Format: (.venv) $ python3 CMine.py <inputFile> <outputFile> <minRF> <minCS> <maxOR> <' '> Example Usage: (.venv) $ python3 CMine.py sampleTDB.txt patterns.txt 0.4 0.7 0.5 ' '
Importing this algorithm into a python program
from PAMI.coveragePattern.basic import CMine as alg obj = alg.CMine(iFile, minRF, minCS, maxOR, seperator) obj.mine() coveragePattern = obj.getPatterns() print("Total number of coverage Patterns:", len(coveragePattern)) obj.save(oFile) Df = obj.getPatternsAsDataFrame() 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)
Credits:
The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.
- creatingCoverageItems() Dict[str, List[str]] [source]
This function creates coverage items from _database. :return: coverageTidData that stores coverage items and their tid list. :rtype: dict
- genPatterns(prefix: Tuple[str, int], tidData: List[Tuple[str, int]]) None [source]
This function generate coverage pattern about prefix. :param prefix: String :param tidData: list :return: None
- generateAllPatterns(coverageItems: Dict[str, int]) None [source]
This function generates all coverage patterns. :param coverageItems: coverage items :return: None
- getMemoryRSS() float [source]
Total amount of RSS memory consumed by the mining process will be retrieved from this function :return: returning RSS memory consumed by the mining process :rtype: float
- getMemoryUSS() float [source]
Total amount of USS memory consumed by the mining process will be retrieved from this function
- Returns:
returning USS memory consumed by the mining process
- Return type:
float
- getPatterns() Dict[str, int] [source]
Function to send the set of coverage patterns after completion of the mining process :return: returning coverage patterns :rtype: dict
- getPatternsAsDataFrame() DataFrame [source]
Storing final coverage patterns in a dataframe :return: returning coverage patterns in a dataframe :rtype: pd.DataFrame
- getRuntime() float [source]
Calculating the total amount of runtime taken by the mining process :return: returning total amount of runtime taken by the mining process :rtype: float
PAMI.coveragePattern.basic.CPPG module
- class PAMI.coveragePattern.basic.CPPG.CPPG(iFile, minRF, minCS, maxOR, sep='\t')[source]
Bases:
_coveragePatterns
- Description:
CPPG algorithm discovers coverage patterns in a transactional database.
- Reference:
Gowtham Srinivas, P.; Krishna Reddy, P.; Trinath, A. V.; Bhargav, S.; Uday Kiran, R. (2015). Mining coverage patterns from transactional databases. Journal of Intelligent Information Systems, 45(3), 423–439. https://link.springer.com/article/10.1007/s10844-014-0318-3
- Parameters:
iFile – str : Name of the Input file to mine complete set of coverage patterns
oFile – str : Name of the output file to store complete set of coverage patterns
minRF – str: Controls the minimum number of transactions in which every item must appear in a database.
minCS – str: Controls the minimum number of transactions in which at least one time within a pattern must appear in a database.
maxOR – str: Controls the maximum number of transactions in which any two items within a pattern can reappear.
sep – str : This variable is used to distinguish items from one another in a transaction. The default seperator is tab space. However, the users can override their default separator.
- Attributes:
- startTimefloat
To record the start time of the mining process
- endTimefloat
To record the completion time of the mining process
- finalPatternsdict
Storing the complete set of patterns in a dictionary variable
- memoryUSSfloat
To store the total amount of USS memory consumed by the program
- memoryRSSfloat
To store the total amount of RSS memory consumed by the program
- Databaselist
To store the transactions of a database in list
Methods to execute code on terminal
Format: (.venv) $ python3 CPPG.py <inputFile> <outputFile> <minRF> <minCS> <maxOR> <' '> Example Usage: (.venv) $ python3 CPPG.py sampleTDB.txt patterns.txt 0.4 0.7 0.5 ','
Note
minSup will be considered in percentage of database transactions
Importing this algorithm into a python program
from PAMI.coveragePattern.basic import CPPG as alg obj = alg.CPPG(iFile, minRF, minCS, maxOR) obj.mine() coveragePattern = obj.getPatterns() print("Total number of coverage Patterns:", len(coveragePattern)) obj.save(oFile) Df = obj.getPatternsAsDataFrame() 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)
Credits:
The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.
- getMemoryRSS() float [source]
Total amount of RSS memory consumed by the mining process will be retrieved from this function
- Returns:
returning RSS memory consumed by the mining process
- Return type:
float
- getMemoryUSS() float [source]
Total amount of USS memory consumed by the mining process will be retrieved from this function
- Returns:
returning USS memory consumed by the mining process
- Return type:
float
- getPatterns() Dict[str, List[int]] [source]
Function to send the set of periodic-frequent patterns after completion of the mining process
- Returns:
returning periodic-frequent patterns
- Return type:
dict
- getPatternsAsDataFrame() DataFrame [source]
Storing final periodic-frequent patterns in a dataframe
- Returns:
returning periodic-frequent patterns in a dataframe
- Return type:
pd.DataFrame
- getRuntime() float [source]
Calculating the total amount of runtime taken by the mining process
- Returns:
returning total amount of runtime taken by the mining process
- Return type:
float