PAMI.correlatedPattern.basic package

Submodules

PAMI.correlatedPattern.basic.CoMine module

class PAMI.correlatedPattern.basic.CoMine.CoMine(iFile: str | DataFrame, minSup: int | float | str, minAllConf: float, sep: str = '\t')[source]

Bases: _correlatedPatterns

Description:

CoMine is one of the fundamental algorithm to discover correlated patterns in a transactional database. It is based on the traditional FP-Growth algorithm. This algorithm uses depth-first search technique to find all correlated patterns in a transactional database.

Reference:

Lee, Y.K., Kim, W.Y., Cao, D., Han, J. (2003). CoMine: efficient mining of correlated patterns. In ICDM (pp. 581–584).

Parameters:
  • iFile – str : Name of the Input file to mine complete set of correlated patterns

  • oFile – str : Name of the output file to store complete set of correlated patterns

  • minSup – int or float or str : The user can specify minSup either in count or proportion of database size. If the program detects the data type of minSup is integer, then it treats minSup is expressed in count.

  • minAllConf – float : The user can specify minAllConf values within the range (0, 1).

  • 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:
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

startTime:float

To record the start time of the mining process

endTime:float

To record the completion time of the mining process

minSupint

The user given minSup

minAllConf: float

The user given minimum all confidence Ratio(should be in range of 0 to 1)

Databaselist

To store the transactions of a database in list

mapSupportDictionary

To maintain the information of item and their frequency

lnoint

it represents the total no of transactions

treeclass

it represents the Tree class

itemSetCountint

it represents the total no of patterns

finalPatternsdict

it represents to store the patterns

itemSetBufferlist

it represents the store the items in mining

maxPatternLengthint

it represents the constraint for pattern length

Methods to execute code on terminal

Format:

(.venv) $ python3 CoMine.py <inputFile> <outputFile> <minSup> <minAllConf> <sep>

Example Usage:

(.venv) $ python3 CoMine.py sampleTDB.txt output.txt 0.25 0.2

Note

minSup will be considered in percentage of database transactions

Importing this algorithm into a python program

from PAMI.correlatedPattern.basic import CoMine as alg

obj = alg.CoMine(iFile, minSup, minAllConf,sep)

obj.mine()

patterns = obj.getPatterns()

print("Total number of  Patterns:", len(patterns))

obj.savePatterns(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 B.Sai Chitra 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 :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 :return: returning USS memory consumed by the mining process :rtype: float

getPatterns() Dict[Tuple[int], List[int | float]][source]

Function to send the set of correlated patterns after completion of the mining process :return: returning correlated patterns :rtype: dict

getPatternsAsDataFrame() DataFrame[source]

Storing final correlated patterns in a dataframe :return: returning correlated 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

mine() None[source]

main method to start

printResults() None[source]

function to print the result after completing the process :return: None

save(outFile) None[source]

Complete set of correlated patterns will be saved into an output file :param outFile: name of the outputfile :type outFile: file :return: None

startMine() None[source]

main method to start

PAMI.correlatedPattern.basic.CoMinePlus module

class PAMI.correlatedPattern.basic.CoMinePlus.CoMinePlus(iFile: str | DataFrame, minSup: int | float | str, minAllConf: str, sep: str = '\t')[source]

Bases: _correlatedPatterns

Description:

CoMinePlus is one of the efficient algorithm to discover correlated patterns in a transactional database. Using Item Support Intervals technique which is generating correlated patterns of higher order by combining only with items that have support within specified interval.

Reference:

Uday Kiran R., Kitsuregawa M. (2012) Efficient Discovery of Correlated Patterns in Transactional Databases Using Items’ Support Intervals. In: Liddle S.W., Schewe KD., Tjoa A.M., Zhou X. (eds) Database and Expert Systems Applications. DEXA 2012. Lecture Notes in Computer Science, vol 7446. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-32600-4_18

Parameters:
  • iFile – str : Name of the Input file to mine complete set of correlated patterns

  • oFile – str : Name of the output file to store complete set of correlated patterns

  • minSup – int or float or str : The user can specify minSup either in count or proportion of database size. If the program detects the data type of minSup is integer, then it treats minSup is expressed in count.

  • minAllConf – str : Name of Neighbourhood file name

  • 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:
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

startTime:float

To record the start time of the mining process

endTime:float

To record the completion time of the mining process

minSupfloat

The user given minSup

minAllConf: float

The user given minimum all confidence Ratio (should be in range of 0 to 1)

Databaselist

To store the transactions of a database in list

mapSupportDictionary

To maintain the information of item and their frequency

lnoint

it represents the total no of transactions

treeclass

it represents the Tree class

itemSetCountint

it represents the total no of patterns

finalPatternsdict

it represents to store the patterns

itemSetBufferlist

it represents the store the items in mining

maxPatternLengthint

it represents the constraint for pattern length

Methods to execute code on terminal

Format:

(.venv) $ python3 CoMinePlus.py <inputFile> <outputFile> <minSup> <minAllConf> <sep>

Example Usage:

(.venv) $ python3 CoMinePlus.py sampleTDB.txt patterns.txt 0.4 0.5 ','

Note

minSup will be considered in percentage of database transactions

Importing this algorithm into a python program

from PAMI.correlatedPattern.basic import CoMinePlus as alg

obj = alg.CoMinePlus(iFile, minSup, minAllConf, sep)

obj.mine()

correlatedPatterns = obj.getPatterns()

print("Total number of correlated patterns:", len(correlatedPatterns))

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 B.Sai Chitra 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 :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 :return: returning USS memory consumed by the mining process :rtype: float

getPatterns() Dict[Tuple[str], List[int | float]][source]

Function to send the set of correlated patterns after completion of the mining process :return: returning correlated patterns :rtype: dict

getPatternsAsDataFrame() DataFrame[source]

Storing final correlated patterns in a dataframe :return: returning correlated 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

mine() None[source]

Main program to start the operation

printResults() None[source]

function to print the result after completing the process

save(outFile: str) None[source]

Complete set of correlated patterns will be loaded in to an output file :param outFile: name of the outputfile :type outFile: file :return: None

startMine() None[source]

Main program to start the operation

PAMI.correlatedPattern.basic.abstract module

Module contents