PAMI.extras.syntheticDataGenerator package

Submodules

PAMI.extras.syntheticDataGenerator.TemporalDatabase module

class PAMI.extras.syntheticDataGenerator.TemporalDatabase.TemporalDatabase(numOfTransactions: int, avgLenOfTransactions: int, numItems: int, outputFile: str, percentage: int = 50, sep: str = '\t', typeOfFile: str = 'Database')[source]

Bases: object

Description:

generateTemporalDatabase creates a temporal database and outputs a database or a frame depending on input

Attributes:
param numOfTransactions:

int number of transactions

param avgLenOfTransactions:

int average length of transactions

param numItems:

int number of items

param outputFile:

str output file name

param percentage:

int percentage of coinToss for TID of temporalDatabase

param sep:

str seperator for database output file

param typeOfFile:

str specify database or dataframe to get corresponding output

Methods:
getFileName():

returns filename

createTemporalFile():

creates temporal database file or dataframe

getDatabaseAsDataFrame:

returns dataframe

performCoinFlip():

Perform a coin flip with the given probability

tuning():

Tune the arrayLength to match avgLenOfTransactions

createTemporalFile():

create Temporal database or dataframe depending on input

Importing this algorithm into a python program

from PAMI.extras.generateDatabase import generateTemporalDatabase as db

numOfTransactions = 100
numItems = 15
avgTransactionLength = 6
outFileName = 'temporal_ot.txt'
sep = '     '
percent = 75
frameOrBase = "dataframe" # if you want to get dataframe as output
frameOrBase = "database" # if you want to get database/csv/file as output

temporalDB = db.generateTemporalDatabase(numOfTransactions, avgTransactionLength, numItems, outFileName, percent, sep, frameOrBase )
temporalDB.createTemporalFile()
print(temporalDB.getDatabaseAsDataFrame())
create() None[source]

create Temporal database or dataframe depending on input :return:

getDatabaseAsDataFrame() DataFrame[source]

return dataframe return: pd.dataframe

getFileName() str[source]

return filename :return:

performCoinFlip(probability: float) bool[source]

Perform a coin flip with the given probability.

tuning(array, sumRes) list[source]

Tune the array so that the sum of the values is equal to sumRes

Parameters: array: list - list of values sumRes: int - target sum

Returns: array: list - tuned array

PAMI.extras.syntheticDataGenerator.TransactionalDatabase module

class PAMI.extras.syntheticDataGenerator.TransactionalDatabase.TransactionalDatabase(numLines, avgItemsPerLine, numItems)[source]

Bases: object

:Description Generate a transactional database with the given number of lines, average number of items per line, and total number of items

Attributes:

numLines: int
  • number of lines

avgItemsPerLine: int
  • average number of items per line

numItems: int
  • total number of items

Methods:
create:

Generate the transactional database

save:

Save the transactional database to a file

getTransactions:

Get the transactional database

create() None[source]

Generate the transactional database

Returns:

generateArray(nums, avg, maxItems) list[source]

Generate a random array of length n whose values average to m

Parameters: nums: int - number of values avg: int - average value maxItems: int - maximum value

Returns: values: list - random array

getTransactions() DataFrame[source]

Get the transactional database

Returns: db: list - transactional database

save(filename) None[source]

Save the transactional database to a file

Parameters: filename: str - name of the file

tuning(array, sumRes) list[source]

Tune the array so that the sum of the values is equal to sumRes

Parameters: array: list - list of values sumRes: int - target sum

Returns: array: list - tuned array

PAMI.extras.syntheticDataGenerator.createSyntheticGeoreferentialTemporal module

class PAMI.extras.syntheticDataGenerator.createSyntheticGeoreferentialTemporal.createGeoreferentialTemporalDatabase(transactions: int, items: int, avgTransaction: int)[source]

Bases: object

This class create synthetic geo-referential temporal database.

Attribute:
totalTransactionsint

No of transactions

noOfItemsint or float

No of items

avgTransactionLengthstr

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createGeoreferentialTemporalDatabase(outputFile)

Create geo-referential temporal database and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createGeoreferentialTemporalDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticGeoreferentialTransactions module

class PAMI.extras.syntheticDataGenerator.createSyntheticGeoreferentialTransactions.createSyntheticGeoreferentialTransaction(transactions, items, avgTransaction)[source]

Bases: object

This class create synthetic geo-referential transaction database.

Attribute:
totalTransactionsint

No of transactions

itemsint

No of items

avgTransactionLengthstr

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createGeoreferentialTransactionDatabase(outputFile)

Create geo-referential transactional database and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createGeoreferentialTransactionalDatabase(outputFile)[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticGeoreferentialUncertainTransaction module

class PAMI.extras.syntheticDataGenerator.createSyntheticGeoreferentialUncertainTransaction.createSyntheticGeoreferentialUncertainTransaction(transactions: int, items: int, avgTransaction: int)[source]

Bases: object

This class is to create synthetic geo-referential uncertain transaction database.

Attribute:
totalTransactionsint

No of transactions

noOfItemsint

No of items

avgTransactionLengthint

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createGeoreferentialuncertainTransactionDatabase(outputFile)

Create geo-referential transactional database store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createGeoreferentialUncertainTransactionalDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticTemporal module

class PAMI.extras.syntheticDataGenerator.createSyntheticTemporal.createSyntheticTemporal(transactions: int, items: int, avgTransaction: int)[source]

Bases: object

This class create synthetic temporal database.

Attribute:
totalTransactionsint

No of transactions

noOfItemsint

No of items

avgTransactionLengthstr

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createTemporallDatabase(outputFile)

Create temporal database from DataFrame and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createTemporalDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticTransactions module

class PAMI.extras.syntheticDataGenerator.createSyntheticTransactions.createSyntheticTransaction(totalTransactions: int, items: int, avgTransactionLength: int)[source]

Bases: object

This class create synthetic transaction database.

Attribute:
totalTransactionsint

No of transactions

noOfItemsint

No of items

avgTransactionLengthint

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createTransactionalDatabase(outputFile)

Create transactional database and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createTransactionalDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticUncertainTemporal module

class PAMI.extras.syntheticDataGenerator.createSyntheticUncertainTemporal.createSyntheticUncertainTemporal(totalTransactions: int, items: int, avgTransaction: int)[source]

Bases: object

This class create synthetic temporal database.

Attribute:
totalTransactionsint

Total no of transactions

noOfItemsint

No of items

avgTransactionLengthint

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createUncertainTemporalDatabase(outputFile)

Create temporal database from DataFrame and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createUncertainTemporalDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticUncertainTransactions module

class PAMI.extras.syntheticDataGenerator.createSyntheticUncertainTransactions.createSyntheticUncertainTransaction(transactions: int, items: int, avgTransaction: int)[source]

Bases: object

This class create synthetic transaction database.

Attribute:
totalTransactionsint

No of transactions

noOfItemsint

No of items

avgTransactionLengthstr

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createUncertainTransactionalDatabase(outputFile)

Create uncertain transactional database and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createUncertainTransactionalDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.createSyntheticUtility module

class PAMI.extras.syntheticDataGenerator.createSyntheticUtility.createSyntheticUtility(transactions: int, items: int, maxUtilRange: int, avgTransaction: int)[source]

Bases: object

This class create synthetic utility database.

Attribute:
totalTransactionsint

No of transactions

noOfItemsint

No of items

maxUtilRange: int

Maximum utility range

avgTransactionLengthint

The length of average transaction

outputFile: str

Name of the output file.

Methods:
createUtilityDatabase(outputFile)

Create utility database from DataFrame and store into outputFile

Credits:

The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

createUtilityDatabase(outputFile: str) None[source]

create transactional database and return outputFileName

Parameters:

outputFile (str) – file name or path to store database

Returns:

outputFile name

PAMI.extras.syntheticDataGenerator.fuzzyDatabase module

PAMI.extras.syntheticDataGenerator.generateTemporal module

class PAMI.extras.syntheticDataGenerator.generateTemporal.generateTemporal(transactionSize: int, numOfItems: int, avgTransactionLength: int)[source]

Bases: object

generate() None[source]
save(outputFile: str, sep='\t') None[source]

PAMI.extras.syntheticDataGenerator.generateTransactional module

class PAMI.extras.syntheticDataGenerator.generateTransactional.generateTransactional(transactionSize: int, numOfItems: int, avgTransactionLength: int)[source]

Bases: object

generate() None[source]
save(outputFile: str, sep='\t') None[source]

PAMI.extras.syntheticDataGenerator.generateUncertainTemporal module

class PAMI.extras.syntheticDataGenerator.generateUncertainTemporal.generateUncertainTemporal(transactionSize: int, numOfItems: int, avgTransactionLength: int, significant=2)[source]

Bases: object

generate() None[source]
save(outputFile: str, sep='\t') None[source]

PAMI.extras.syntheticDataGenerator.generateUncertainTransactional module

class PAMI.extras.syntheticDataGenerator.generateUncertainTransactional.generateUncertainTransactional(transactionSize: int, numOfItems: int, avgTransactionLength: int, significant=2)[source]

Bases: object

generate() None[source]
save(outputFile: str, sep='\t') None[source]

PAMI.extras.syntheticDataGenerator.generateUtilityTemporal module

class PAMI.extras.syntheticDataGenerator.generateUtilityTemporal.generateUtilityTemporal(transactionSize: int, numOfItems: int, avgTransactionLength: int, minUtilityValue: int, maxUtilityValue: int, minNumOfTimesAnItem: int, maxNumOfTimesAnItem: int)[source]

Bases: object

generate() None[source]
save(outputFile: str, sep='\t', type='utility') None[source]

PAMI.extras.syntheticDataGenerator.generateUtilityTransactional module

class PAMI.extras.syntheticDataGenerator.generateUtilityTransactional.generateUtilityTransactional(transactionSize: int, numOfItems: int, avgTransactionLength: int, minUtilityValue: int, maxUtilityValue: int, minNumOfTimesAnItem: int, maxNumOfTimesAnItem: int)[source]

Bases: object

generate() None[source]
save(outputFile: str, sep='\t', type='utility') None[source]

PAMI.extras.syntheticDataGenerator.georeferencedTemporalDatabase module

PAMI.extras.syntheticDataGenerator.georeferencedTransactionalDatabase module

PAMI.extras.syntheticDataGenerator.syntheticUtilityDatabase module

class PAMI.extras.syntheticDataGenerator.syntheticUtilityDatabase.syntheticUtilityDatabase(totalTransactions: int, numOfItems: int, maxUtilRange: int, avgTransactionLength: int)[source]

Bases: object

This class creates a synthetic utility database.

totalTransactions

Number of transactions.

Type:

int

numOfItems

Number of items.

Type:

int

maxUtilRange

Maximum utility range.

Type:

int

avgTransactionLength

The length of average transaction.

Type:

int

__init__(totalTransactions, numOfItems, maxUtilRange, avgTransactionLength)[source]

Constructor to initialize the database parameters.

createSyntheticUtilityDatabase(outputFile)[source]

Create utility database and store it in the specified output file.

createRandomNumbers(n, targetSum)[source]

Generate a list of random numbers with a specified target sum.

save(outputFile)[source]

Save the generated utility database to a CSV file.

Credits:

The complete program was written by A.Hemanth sree sai under the supervision of Professor Rage Uday Kiran.

createRandomNumbers(n: int, targetSum: int) list[float][source]

Generate a list of random numbers with a specified target sum.

Parameters:
  • n (int) – Number of random numbers to generate.

  • targetSum (int) – Target sum for the generated random numbers.

Returns:

List of generated random numbers normalized and multiplied by the target sum.

Return type:

list

createSyntheticUtilityDatabase(outputFile: str) None[source]

Create utility database and store it in the specified output file.

Parameters:

outputFile (str) – File name or path to store the database.

save(outputFile: str) None[source]

Save the generated utility database to a CSV file.

Parameters:

outputFile (str) – File name or path to store the CSV file.

PAMI.extras.syntheticDataGenerator.temporalDatabaseGen module

class PAMI.extras.syntheticDataGenerator.temporalDatabaseGen.CreateSyntheticTemporal(total_transactions: int, num_of_items: int, avg_transaction_length: int)[source]

Bases: object

This class creates a synthetic temporal database.

total_transactions

Number of transactions.

Type:

int

num_of_items

Number of items.

Type:

int

avg_transaction_length

The length of average transaction.

Type:

int

create_temporal_database(output_file)[source]

Create temporal database and store it in the specified output file.

Credits:

The complete program was written by A.Hemanth sree sai under the supervision of Professor Rage Uday Kiran.

create_temporal_database(output_file: str) None[source]

Create temporal database and store it in the specified output file.

Parameters:

output_file (str) – File name or path to store the database.

generate_random_numbers(n: int, target_sum: int) list[float][source]

Generate a list of random numbers with a specified target sum.

Parameters:
  • n (int) – Number of random numbers to generate.

  • target_sum (int) – Target sum for the generated random numbers.

Returns:

List of generated random numbers normalized and multiplied by the target sum.

Return type:

list

PAMI.extras.syntheticDataGenerator.utilityDatabase module

class PAMI.extras.syntheticDataGenerator.utilityDatabase.UtilityDataGenerator(databaseSize, numberOfItems, averageLengthOfTransaction, minimumInternalUtilityValue, maximumInternalUtilityValue, minimumExternalUtilityValue, maximumExternalUtilityValue)[source]

Bases: object

Generate()[source]
GenerateAndPrintItemPairs()[source]
GenerateExternalUtilityData()[source]
GetExternalUtilityData()[source]
GetInternalUtilityData()[source]
GetUtilityData()[source]
Save(fileName)[source]
SaveItemsInternalUtilityValues(fileName)[source]
Saveitemsexternalutilityvalues(fileName)[source]

Module contents