SkillAgentSearch skills...

Spmf Software

The official repository of the popular SPMF Open Source Pattern Mining Software/Library. It offers implementations of 300+ data mining algorithms for pattern mining, including tasks such as association rule mining, itemset mining, sequential pattern mining, sequential rule mining.

Install / Use

npx skills add philfv9/spmf-software

Installs into whichever agent you are using.

README

License Release Stars Made with Java SPMF

<div align="center"> <h1>The SPMF Open-Source Pattern Mining Sofware</h1> <img src="images/spmf.png" alt="SPMF Logo" width="200"> </div>

SPMF is a popular and highly efficient data mining software written in Java, specialized in pattern mining. It provides over 300 algorithms for various tasks for analyzing data such as:

  • Frequent itemset mining
  • Association rule mining
  • Sequential pattern mining
  • Sequential rule mining
  • High-utility itemset mining
  • Episode mining
  • Graph mining
  • Time series analysis
  • and others

SPMF offers a graphical user interface (GUI), a command-line interface (CLI), and a server for alternatively running data mining algorithms through REST queries from a Python or Web client. SPMF can also be integrated in Python, R and other languages through wrappers and its CLI, or used as a Java library in Java projects. SPMF is lightweight, actively developed and has no external dependencies.

The latest release is SPMF version v2.66, released on the 15th June 2026.

The official website of SPMF with full documentation, tutorials, and other resources is: http://philippe-fournier-viger.com/spmf/


Table of Contents


Quickstart

There are five ways to use SPMF, depending on your needs:


1 — Graphical User Interface (GUI)

<div align="center"> <img src="/images/case1.png" alt="SPMF GUI use case" width="600"> </div>

The most simple way to use SPMF is through its integrated GUI. To run the GUI:

  1. Download the files spmf.jar and test_files.zip to your computer and make sure that Java is installed on your computer. Alternatively, if you do not want to install Java or cannot install it, an EXE version of SPMF is available for Windows on the release page, which includes the Java runtime and behaves in the same way as spmf.jar .
  2. Uncompress the file test_files.zip on your desktop. It will create a folder containing some example data files that you can use with the algorithms to try the examples from the documentation.
  3. Launch the GUI of SPMF by double-clicking on the file spmf.jar. If it does not work and you are using Windows, right-click on spmf.jar and select "open with..." and then select "Java Platform". If this option is not there, perhaps that Java is not installed on your computer, or that the PATH environment variable does not include your Java installation.
  4. If the previous step succeeds, the graphical interface of SPMF will open:
<div align="center"> <img src="/images/gui.png" alt="SPMF GUI" width="600"> </div>
  1. Then, from the user interface, you can select input files, choose an algorithm from more than 300 algorithms, sets its parameters, and run the algorithms. For example, let's say that you want to run the CM-SPAM algorithm. In the documentation, it is the CM-SPAM example. To run that example:
  • Click on the combo box beside "Choose an algorithm" and select "CM-SPAM".
  • Click on "Choose input file" and select contextPrefixSpan.txt from the test_files folder.
  • Click on "Choose output file", select a location (e.g., Desktop), enter result.txt, and click "OK".
  • Set the parameter minsup (%) to 0.5 (as in the example).
  • Other parameters are optional and can be ignored for this example.
  • Click on "Run algorithm".
  • A new window will open showing the results.
  • The results correspond to the patterns discovered by CM-SPAM (see the CM-SPAM example of the documentation for interpretation). That’s all. To run another algorithm, follow the same steps.

2 — Command Line

<div align="center"> <img src="/images/case2.png" alt="SPMF command line case" width="600"> </div>

The second to use SPMF is through its command line interface (CLI) from the console. To run the SPMF using the CLI:

  1. Download the files spmf.jar and test_files.zip to your computer and make sure that Java is installed on your computer. Alternatively, if you do not want to install Java or cannot install it, an EXE version of SPMF is available for Windows on the release page, which includes the Java runtime and behaves in the same way as spmf.jar .

  2. Uncompress the file test_files.zip on your desktop. It will create a folder containing some example data files that you can use with the algorithms.

  3. To run an algorithm, go to the documentation of SPMF find the example corresponding to the algorithm that you want to run. For example, let's say that you want to run the PrefixSpan algorithm. It is this example in the documentation.

  4. Open the command prompt (if you are using Windows) or the terminal (if you are using Linux). Then, type the command specified in the example. For example, for PrefixSpan, the command is:

    java -jar spmf.jar run PrefixSpan contextPrefixSpan.txt output.txt 50%

This command means to run the algorithm named "PrefixSpan" to use the input file named "contextPrefixSpan.txt" to set the output file for the results as "output.txt" to set the parameter of the algorithm (minsup) to 50 %. After executing this command, the file output.txt will be created. It will contain the result.

<div align="center"> <img src="/images/cmd.png" alt="SPMF console" width="600"> </div>

The input and output file format of each algorithm is described in the documentation.

That's all. If you want to run another algorithm, then follow the same steps.


3 — Java API

<div align="center"> <img src="/images/case3.png" alt="SPMF Java API use case" width="600"> </div>

The third way to use SPMF is by integrating it into Java projects. For this, you can download spmf.jar and include it in the classpath of your Java project, and then call the classes from SPMF from your Java program. Or alternatively, you can download spmf.zip or clone the project to obtain SPMF source code. To get a good grasp of how the source code of SPMF is organized, you may read the developers guide.

In general, each algorithm in SPMF is organized in its own package containing the main implementation files. Some utility classes are shared across multiple algorithms and are located in common directories such as ca/pfv/spmf/input/ and ca/pfv/spmf/patterns/. To how to run one algorithm from the source code, consider the SPAM algorithm. It is implemented in the package ca/pfv/spmf/algorithms/sequentialpatterns/spam, which is itself a subpackage of ca/pfv/spmf/algorithms/sequentialpatterns/, reflecting the fact that SPAM belongs to the family of sequential pattern mining algorithms.

Each algorithm follows a consistent design pattern. There is a main class whose name starts with Algo, and this class provides a method called runAlgorithm() to execute the algorithm. For example, the SPAM algorithm is implemented in the class AlgoSPAM.java. Its runAlgorithm() method expects three parameters: the path to the input file, the path to the output file, and a minimum support threshold. To understand how an algorithm is executed in practice, one can examine the example files located in the directory ca/pfv/spmf/test/. This directory contains demonstration code intended for developers. Each algorithm typically has at least one corresponding test file named MainTestXXXX.java, where XXXX is the name of the algorithm.

In the case of SPAM, the relevant example is MainTestSPAM_saveToFile.java.

Example code of how to run the SPAM algorithm:

// Load a sequence database
String input = fileToPath("contextPrefixSpan.txt");
String output = ".//output.txt";

// Create an instance of the algorithm
AlgoSPAM algo = new AlgoSPAM();

// Execute the algorithm with minsup = 2 sequences (50%)
algo.runAlgorithm(input, output, 0.5);
algo.printStatistics();

In this example, the input file contextPrefixSpan.txt corresponds to the dataset used in the official documentation and can be found in the ca/pfv/spmf/tests/ directory. The output file is written to .//output.txt, although this path can be replaced by any valid location on the user’s system. The call to runAlgorithm() triggers the execution of the algorithm. The value 0.5 represents the minimum support threshold, whose exact interpretation is described in the SPAM documentation. Finally, each algorithm is associated with a description class located in the package ca/pfv/spmf/algorithmmanager/descriptions. These classes provide metadata such as the authors of the

Related Skills

View on GitHub
GitHub Stars29
CategoryDevelopment
Updated3d ago
Forks1

Languages

Java

Security Score

95/100

Audited on Aug 4, 2026

No findings