2017 © Pedro Peláez
 

library apriori

Apriori data analysing algorithm written within PHP.

image

codedheartinside/apriori

Apriori data analysing algorithm written within PHP.

  • Wednesday, May 18, 2016
  • by codedheartinside
  • Repository
  • 1 Watchers
  • 7 Stars
  • 1,753 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 9 Open issues
  • 9 Versions
  • 38 % Grown

The README.md

PHP Apriori

Run Unit Tests, (*1)

This package is meant for implementing the Apriori algorithm as a microservice., (*2)

Installation:

Enable composer in your project

curl -s http://getcomposer.org/installer | php

Add the package to your composer.json file, (*3)

{
    "require": {
        "codedheartinside/apriori": "1.*"
    }
}

Load the files and create the autoload file

Download the files, (*4)

php composer.phar install

Add the autoloader for the files into your project, (*5)

require 'vendor/autoload.php';

Set up the running environment

To set up the running environment for the package, run the installer, (*6)

$installer = new \CodedHeartInside\DataMining\Apriori\Installer();
$installer->createRunningEnvironment();

Usage

Configuration

You first need to create a configuration with the rules for the algorithm, (*7)

$aprioriConfiguration = new \CodedHeartInside\DataMining\Apriori\Configuration();

// Configuring the boundries is optional
$aprioriConfiguration->setDisplayDebugInformation();
$aprioriConfiguration->setMinimumThreshold(2) // Default is 2
    ->setMinimumSupport(0.2) // Default is 0.1
    ->setMinimumConfidence(5) // Default is 0.2
;

Defining the data set

After that, all is set to run the algorithm on a data set. The data set can be added through the addDataSet function., (*8)

$dataSet = array(
    array(1, 3, 4),
    array(2, 4, 6),
    array(1, 2),
    array(5),
);

$dataInput = new \CodedHeartInside\DataMining\Apriori\Data\Input($aprioriConfiguration);
$dataInput->flushDataSet()
    ->addDataSet($dataSet)
    ->addDataSet($dataSet) // In this case, the data set is added twice to create more testing data
;

Running the algorithm

To run the the algorithm on the data set, provide the Apriori class with the configuration and call the run function., (*9)

$aprioriClass = new \CodedHeartInside\DataMining\Apriori\Apriori($aprioriConfiguration);
$aprioriClass->run();

Retrieving the data

After running the algorithm, the records with the statistics for support and confidence become retrievable., (*10)

Support is the time a item combination occurs in all of the provided item sets., (*11)

To get the records with the support statistics:, (*12)

foreach ($aprioriClass->getSupportRecords() as $record) {
    print_r($record);
    // Outputs:
    // Array
    // (
    //     [itemIds] => Array
    //     (
    //         [0] => 1
    //         [1] => 4
    //         [2] => 6
    //         [3] => 7
    //     )
    //
    //     [support] => 0.060606060606061
    // )
}

Confidence is the times a article occurs in combination with the other items, (*13)

To get the records with the confidence statistics, (*14)

foreach ($aprioriClass->getConfidenceRecords() as $record) {
    print_r($record);
    // Outputs
    // Array
    // (
    //     [if] => Array
    //     (
    //       [0] => 1
    //       [1] => 7
    //     )
    //
    //     [then] => 3
    //     [confidence] => 1
    // )
}

The Versions

18/05 2016

dev-master

9999999-dev https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

18/05 2016

dev-develop

dev-develop https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

18/05 2016

1.1.3

1.1.3.0 https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

15/04 2016

1.1.2

1.1.2.0 https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

14/04 2016

dev-feature/installer-update

dev-feature/installer-update https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

09/12 2015

1.1.1

1.1.1.0 https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

07/12 2015

1.1.0

1.1.0.0 https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

07/12 2015

1.0.1

1.0.1.0 https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori

07/12 2015

1.0.0

1.0.0.0 https://github.com/codedheartinside/php-apriori.git

Apriori data analysing algorithm written within PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Wim Ulkeman

data mining apriori