Skip to content

Commit

Permalink
# bug resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
udayRage committed Nov 8, 2024
1 parent fe95e29 commit d209215
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions PAMI/extras/syntheticDataGenerator/TemporalDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ class TemporalDatabase:
Format:
(.venv) $ python3 TemporalDatabase.py <numOfTransactions> <avgLenOfTransactions> <numItems> <outputFile> <percentage> <sep> <typeOfFile> <occurrenceProbabilityAtSameTimestamp> <occurrenceProbabilityToSkipSubsequentTimestamp>
(.venv) $ python3 TemporalDatabase.py <numOfTransactions> <avgItemsPerTransaction> <numItems> <outputFile> <percentage> <sep> <typeOfFile> <occurrenceProbabilityAtSameTimestamp> <occurrenceProbabilityToSkipSubsequentTimestamp>
Example Usage:
(.venv) $ python3 TemporalDatabase.py 50 10 100 temporal.txt 50 \t database 0.1 0.1
:param numOfTransactions: int
:param databaseSize: int
Number of transactions to generate.
:param avgLenOfTransactions: int
:param avgItemsPerTransaction: int
Average length of transactions.
:param numItems: int
Expand Down Expand Up @@ -190,7 +190,7 @@ def create(self) -> None:

self.current_timestamp = 0 # Initialize current timestamp

for i in range(self.numOfTransactions):
for i in range(self.databaseSize):
if self.performCoinFlip(self.occurrenceProbabilityAtSameTimestamp):
timestamp = self.current_timestamp
else:
Expand All @@ -204,15 +204,15 @@ def create(self) -> None:
if self.performCoinFlip(self.percentage):
lineSize.append([i, 0])

sumRes = self.numOfTransactions * self.avgLenOfTransactions
sumRes = self.databaseSize * self.avgItemsPerTransaction

self.tuning(lineSize, sumRes)

for i in range(len(lineSize)):
if lineSize[i][1] > self.numItems:

raise ValueError(
"Error: Either increase numItems or decrease avgLenOfTransactions or modify percentage")
"Error: Either increase numItems or decrease avgItemsPerTransaction or modify percentage")
line = np.random.choice(range(1, self.numItems + 1), lineSize[i][1], replace=False)
db[lineSize[i][0]].extend(line)

Expand All @@ -233,7 +233,7 @@ def create(self) -> None:

if __name__ == '__main__':
if len(sys.argv) != 10:
print("Usage: python TemporalDatabase.py <numOfTransactions> <avgLenOfTransactions> <numItems> <outputFile> <percentage> <sep> <typeOfFile> <occurrenceProbabilityAtSameTimestamp> <occurrenceProbabilityToSkipSubsequentTimestamp>")
print("Usage: python TemporalDatabase.py <databaseSize> <avgItemsPerTransaction> <numItems> <outputFile> <percentage> <sep> <typeOfFile> <occurrenceProbabilityAtSameTimestamp> <occurrenceProbabilityToSkipSubsequentTimestamp>")
sys.exit(1)

obj = TemporalDatabase(
Expand Down

0 comments on commit d209215

Please sign in to comment.