PAMI.highUtilityFrequentPattern.basic package

Submodules

PAMI.highUtilityFrequentPattern.basic.HUFIM module

class PAMI.highUtilityFrequentPattern.basic.HUFIM.HUFIM(iFile: str, minUtil: int | float, minSup: int | float, sep: str = '\t')[source]

Bases: _utilityPatterns

Description:

HUFIM (High Utility Frequent Itemset Miner) algorithm helps us to mine High Utility Frequent ItemSets (HUFIs) from transactional databases.

Reference:

Kiran, R.U., Reddy, T.Y., Fournier-Viger, P., Toyoda, M., Reddy, P.K., & Kitsuregawa, M. (2019). Efficiently Finding High Utility-Frequent Itemsets Using Cutoff and Suffix Utility. PAKDD 2019. DOI: 10.1007/978-3-030-16145-3_15

Parameters:
  • iFile – str : Name of the Input file to mine complete set of Geo-referenced frequent sequence patterns

  • oFile – str : Name of the output file to store complete set of Geo-referenced frequent sequence 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. Otherwise, it will be treated as float.

  • minUtil – int : The user given minUtil value.

  • candidateCount – int Number of candidates

  • maxMemory – int Maximum memory used by this program for running

  • nFile – str : Name of the input file to mine complete set of Geo-referenced frequent sequence patterns

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

Name of the input file to mine complete set of patterns

oFilefile

Name of the output file to store complete set of patterns

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

minUtilint

The user given minUtil value

minSupfloat

The user given minSup value

highUtilityFrequentItemSets: map

set of high utility frequent itemSets

candidateCount: int

Number of candidates

utilityBinArrayLU: list

A map to hold the local utility values of the items in database

utilityBinArraySU: list

A map to hold the subtree utility values of the items is database

oldNamesToNewNames: list

A map which contains old names, new names of items as key value pairs

newNamesToOldNames: list

A map which contains new names, old names of items as key value pairs

singleItemSetsSupport: map

A map which maps from single itemsets (items) to their support

singleItemSetsUtility: map

A map which maps from single itemsets (items) to their utilities

maxMemory: float

Maximum memory used by this program for running

patternCount: int

Number of RHUI’s

itemsToKeep: list

keep only the promising items i.e items that can extend other items to form RHUIs

itemsToExplore: list

list of items that needs to be explored

Methods:
mine()

Mining process will start from here

getPatterns()

Complete set of patterns will be retrieved with this function

save(oFile)

Complete set of patterns will be loaded in to a output file

getPatternsAsDataFrame()

Complete set of patterns will be loaded in to a dataframe

getMemoryUSS()

Total amount of USS memory consumed by the mining process will be retrieved from this function

getMemoryRSS()

Total amount of RSS memory consumed by the mining process will be retrieved from this function

getRuntime()

Total amount of runtime taken by the mining process will be retrieved from this function

backTrackingHUFIM(transactionsOfP, itemsToKeep, itemsToExplore, prefixLength)

A method to mine the RHUIs Recursively

useUtilityBinArraysToCalculateUpperBounds(transactionsPe, j, itemsToKeep)

A method to calculate the sub-tree utility and local utility of all items that can extend itemSet P and e

output(tempPosition, utility)

A method to output a relative-high-utility itemSet to file or memory depending on what the user chose

isEqual(transaction1, transaction2)

A method to Check if two transaction are identical

useUtilityBinArrayToCalculateSubtreeUtilityFirstTime(dataset)

A method to calculate the sub tree utility values for single items

sortDatabase(self, transactions)

A Method to sort transaction

sortTransaction(self, trans1, trans2)

A Method to sort transaction

useUtilityBinArrayToCalculateLocalUtilityFirstTime(self, dataset)

A method to calculate local utility values for single itemSets

Executing the code on terminal

Format:

(.venv) $ python3 HUFIM.py <inputFile> <outputFile> <minUtil> <sep>

Example Usage:

(.venv) $ python3 HUFIM.py sampleTDB.txt output.txt 35 20

(.venv) $ python3 HUFIM.py sampleTDB.txt output.txt 35 20

Note

minSup will be considered in percentage of database transactions

Sample run of importing the code

from PAMI.highUtilityFrequentPattern.basic import HUFIM as alg

obj=alg.HUFIM("input.txt", 35, 20)

obj.mine()

Patterns = obj.getPatterns()

print("Total number of high utility frequent Patterns:", len(Patterns))

obj.save("output")

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 pradeep pallikila 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[str, List[int | float]][source]

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

getPatternsAsDataFrame() DataFrame[source]

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

High Utility Frequent Pattern mining start here :return: None

printResults() None[source]

This function is used to print the results

save(outFile: str) None[source]

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

startMine() None[source]

High Utility Frequent Pattern mining start here :return: None

PAMI.highUtilityFrequentPattern.basic.abstract module

Module contents