PAMI is a Python library containing 100+ algorithms to discover useful patterns in various databases across multiple computing platforms. (Active)
Previous | 🏠Home | Next |
The performance of a mining algorithm primarily depends on the following two key factors:
Thus, it is important to know the statistical details of a database. PAMI contains inbuilt classes and functions methods to get the statistical details of a database. In this page, we provide the details of methods to get statistical details of a transactional database.
The class to print the statistics of a transactional base is “TransactionalDatabase”. This class is located at PAMI/extras/dbStats directory. One can import this class using the following syntax:
import PAMI.extras.dbStats.TransactionalDatabase as stats
##Methods
Note: Click here to download the transactional database
# import the class file
import PAMI.extras.dbStats.TransactionalDatabase as stats
# specify the file name
inputFile = 'Transactional_T10I4D100K.csv'
obj = stats.TransactionalDatabase(inputFile, sep='\t')
obj.run()
obj.printStats()
obj.plotGraphs()
import PAMI.extras.dbStats.TransactionalDatabase as tds
inputFile = "<provide the name of a transactional database>"
# initialize the program
obj = tds.TransactionalDatabase(inputFile)
# obj = tds.TransactionalDatabase(inputFile,sep='\t') #override default tab seperator
# execute the program
obj.run()
# print the database stats
print(f'Database size : {obj.getDatabaseSize()}')
print(f'Total number of items : {obj.getTotalNumberOfItems()}')
print(f'Database sparsity : {obj.getSparsity()}')
print(f'Minimum Transaction Size : {obj.getMinimumTransactionLength()}')
print(f'Average Transaction Size : {obj.getAverageTransactionLength()}')
print(f'Maximum Transaction Size : {obj.getMaximumTransactionLength()}')
print(f'Standard Deviation Transaction Size : {obj.getStandardDeviationTransactionLength()}')
print(f'Variance in Transaction Sizes : {obj.getVarianceTransactionLength()}')
itemFrequencies = obj.getSortedListOfItemFrequencies()
transactionLength = obj.getTransanctionalLengthDistribution()
obj.save(itemFrequencies, 'itemFrequency.csv')
obj.save(transactionLength, 'transactionSize.csv')