Frequent Pattern Mining Algorithms

Frequent pattern mining algorithms package

License

License

MIT
Categories

Categories

Java Languages
GroupId

GroupId

com.github.chen0040
ArtifactId

ArtifactId

java-frequent-pattern-mining
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Frequent Pattern Mining Algorithms
Frequent pattern mining algorithms package
Project URL

Project URL

https://github.com/chen0040/java-frequent-pattern-mining
Source Code Management

Source Code Management

https://github.com/chen0040/java-frequent-pattern-mining

Download java-frequent-pattern-mining

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.chen0040/java-frequent-pattern-mining/ -->
<dependency>
    <groupId>com.github.chen0040</groupId>
    <artifactId>java-frequent-pattern-mining</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.chen0040/java-frequent-pattern-mining/
implementation 'com.github.chen0040:java-frequent-pattern-mining:1.0.1'
// https://jarcasting.com/artifacts/com.github.chen0040/java-frequent-pattern-mining/
implementation ("com.github.chen0040:java-frequent-pattern-mining:1.0.1")
'com.github.chen0040:java-frequent-pattern-mining:jar:1.0.1'
<dependency org="com.github.chen0040" name="java-frequent-pattern-mining" rev="1.0.1">
  <artifact name="java-frequent-pattern-mining" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.chen0040', module='java-frequent-pattern-mining', version='1.0.1')
)
libraryDependencies += "com.github.chen0040" % "java-frequent-pattern-mining" % "1.0.1"
[com.github.chen0040/java-frequent-pattern-mining "1.0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.20
org.slf4j : slf4j-log4j12 jar 1.7.20
com.github.chen0040 : java-data-frame jar 1.0.9

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.6

test (10)

Group / Artifact Type Version
org.testng : testng jar 6.9.10
org.hamcrest : hamcrest-core jar 1.3
org.hamcrest : hamcrest-library jar 1.3
org.assertj : assertj-core jar 3.5.2
org.powermock : powermock-core jar 1.6.5
org.powermock : powermock-api-mockito jar 1.6.5
org.powermock : powermock-module-junit4 jar 1.6.5
org.powermock : powermock-module-testng jar 1.6.5
org.mockito : mockito-core jar 2.0.2-beta
org.mockito : mockito-all jar 2.0.2-beta

Project Modules

There are no modules declared in this project.

java-frequent-pattern-mining

Package provides java implementation of frequent pattern mining algorithms such as apriori, fp-growth

Build Status Coverage Status

Features

  • Apriori
  • FP-Growth

Install

Add the following dependency to your POM file:

<dependency>
  <groupId>com.github.chen0040</groupId>
  <artifactId>java-frequent-pattern-mining</artifactId>
  <version>1.0.1</version>
</dependency>

Usage

FP Growth

The sample code below shows how to use FPGrowth to obtain the frequent item sets from a list of transactions

 List<List<String>> database = new ArrayList<>();

// each line below add a new transaction to the database
database.add(Arrays.asList("f", "a", "c", "d", "g", "i", "m", "p"));
database.add(Arrays.asList("a", "b", "c", "f", "l", "m", "o"));
database.add(Arrays.asList("b", "f", "h", "j", "o", "w"));
database.add(Arrays.asList("b", "c", "k", "s", "p"));
database.add(Arrays.asList("a", "f", "c", "e", "l", "p", "m", "n"));

AssocRuleMiner method = new FPGrowth();
method.setMinSupportLevel(2);

MetaData metaData = new MetaData(database);

// obtain all frequent item sets with support level not below 2
ItemSets frequent_item_sets = method.minePatterns(database, metaData.getUniqueItems());
fis.stream().forEach(itemSet -> System.out.println("item-set: " + itemSet));

// obtain the max frequent item sets
ItemSets max_frequent_item_sets = method.findMaxPatterns(database, metaData.getUniqueItems());

Apriori

The sample code below shows how to use Apriori to obtain the frequent item sets from a list of transactions

List<List<String>> database = new ArrayList<>();

// each line below add a new transaction to the database
database.add(Arrays.asList("f", "a", "c", "d", "g", "i", "m", "p"));
database.add(Arrays.asList("a", "b", "c", "f", "l", "m", "o"));
database.add(Arrays.asList("b", "f", "h", "j", "o", "w"));
database.add(Arrays.asList("b", "c", "k", "s", "p"));
database.add(Arrays.asList("a", "f", "c", "e", "l", "p", "m", "n"));

AssocRuleMiner method = new Apriori();
method.setMinSupportLevel(2);

MetaData metaData = new MetaData(database);

// obtain all frequent item sets with support level not below 2
ItemSets frequent_item_sets = method.minePatterns(database, metaData.getUniqueItems());
fis.stream().forEach(itemSet -> System.out.println("item-set: " + itemSet));

// obtain the max frequent item sets
ItemSets max_frequent_item_sets = method.findMaxPatterns(database, metaData.getUniqueItems());

Versions

Version
1.0.1