CPPG

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

mine() None[source]

Mining process will start from this function

printResults() None[source]

Function used to print the result

save(outFile: str) None[source]

Complete set of periodic-frequent patterns will be loaded in to an output file

Parameters:

outFile (file) – name of the outputfile

startMine() None[source]

Mining process will start from this function