SHUFIM

class PAMI.highUtilityGeoreferencedFrequentPattern.basic.SHUFIM.SHUFIM(iFile, nFile, minUtil, minSup, sep='\t')[source]

Bases: _utilityPatterns

Description:

Spatial High Utility Frequent ItemSet Mining (SHUFIM) aims to discover all itemSets in a spatioTemporal database that satisfy the user-specified minimum utility, minimum support and maximum distance constraints

Reference:

10.1007/978-3-030-37188-3_17

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 frequent patterns

nFilefile

Name of the Neighbours file that contain neighbours of items

oFilefile

Name of the output file to store complete set of frequent 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

minSupfloat

The user given minSup value

highUtilityFrequentSpatialItemSets: map

set of high utility itemSets

candidateCount: int

Number of candidates

utilityBinArrayLU: list

A map to hold the pmu 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 to hold the subtree utility values of the items is database

newNamesToOldNames: list

A map to store the old name corresponding to new name

Neighboursmap

A dictionary to store the neighbours of a item

maxMemory: float

Maximum memory used by this program for running

patternCount: int

Number of SHUFI’s (Spatial High Utility Frequent Itemsets)

itemsToKeep: list

keep only the promising items ie items whose supersets can be required patterns

itemsToExplore: list

keep items that subtreeUtility grater than minUtil

:Methods :

mine()

Mining process will start from here

getPatterns()

Complete set of patterns will be retrieved with this function

save(oFile)

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

getPatternsAsDataFrame()

Complete set of frequent 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

calculateNeighbourIntersection(self, prefixLength)

A method to return common Neighbours of items

backtrackingEFIM(transactionsOfP, itemsToKeep, itemsToExplore, prefixLength)

A method to mine the SHUIs Recursively

useUtilityBinArraysToCalculateUpperBounds(transactionsPe, j, itemsToKeep, neighbourhoodList)

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 ave a 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

intersection(lst1, lst2)

A method that return the intersection of 2 list

useUtilityBinArrayToCalculateSubtreeUtilityFirstTime(dataset)

Scan the initial database to calculate the subtree utility of each items using a utility-bin array

sortDatabase(self, transactions)

A Method to sort transaction in the order of PMU

sortTransaction(self, trans1, trans2)

A Method to sort transaction in the order of PMU

useUtilityBinArrayToCalculateLocalUtilityFirstTime(self, dataset)

A method to scan the database using utility bin array to calculate the pmus

Executing the code on terminal :

Format:

(.venv) $ python3 SHUFIM.py <inputFile> <outputFile> <Neighbours> <minUtil> <minSup> <sep>

Example Usage:

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

Note

minSup will be considered in percentage of database transactions

Sample run of importing the code:

from PAMI.highUtilityGeoreferencedFrequentPattern.basic import SHUFIM as alg

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

obj.mine()

patterns = obj.getPatterns()

print("Total number of Spatial 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()[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()[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()[source]

Function to send the set of patterns after completion of the mining process

Returns:

returning patterns

Return type:

dict

getPatternsAsDataFrame()[source]

Storing final patterns in a dataframe :return: returning patterns in a dataframe :rtype: pd.DataFrame

getRuntime()[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()[source]

High Utility Frequent Pattern mining start here

printResults()[source]

This function is used to print the results

save(outFile)[source]

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

Parameters:

outFile (csv file) – name of the output file

startMine()[source]

High Utility Frequent Pattern mining start here

PAMI.highUtilityGeoreferencedFrequentPattern.basic.SHUFIM.main()[source]