Converting a Transaction Database to SPMF Format (SPMF documentation)
This example explains how to convert a transaction database to SPMF format using the SPMF open-source data mining library.
How to run this example?- If you are using the graphical interface, (1) choose the "Convert_a_transaction_database_to_SPMF_format" algorithm, (2) select the input file "contextCSV.txt", (3) set the output file name (e.g. "output.txt") (4) set input_format = CSV_INTEGER and sequence count = 5.(5) click "Run algorithm".
- If you want to execute this example from the command line,
then execute this command:
java -jar spmf.jar run Convert_a_transaction_database_to_SPMF_format contextCSV.txt output.txt CSV_INTEGER 5 in a folder containing spmf.jar and the example input file contextCSV.txt. - If you are using the source code version of SPMF, launch the file "MainTestConvertTransactionDatabaseCSVtoSPMF.java" in the package ca.pfv.SPMF.tests.
The tool for converting a transaction databases to SPMF format. It takes three prameters as input:
- an input file,
- the input file format database format (CSV_INTEGER),
- the number of transactions to be converted
The algorithm outputs a transaction database in SPMF format.
The CSV_INTEGER format is defined as follows:
- each line is a transaction
- each transaction is a list of items represented by positive integers (>0) separated by commas.
For example, the follwing sequence database is in CSV_INTEGER format and contains four sequences:
1,2,3,45,6,7,8
5,6,7
1,2,3
Other formats will be added eventually.