rmatil/sax

PHP Implementation of Symbolic Aggregate Approximation

Installs: 28

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

Language:JavaScript

dev-master 2014-08-25 14:17 UTC

This package is auto-updated.

Last update: 2024-04-22 06:13:52 UTC


README

PHP Implementation of Symbolic Aggregate Approximation (SAX)

Implementation of the suffix tree is based on the idea of "makagonov" on Stackoverflow

Installation

Using composer:
$ php composer.phar require "rmatil/sax":"dev-master"

Usage

Step 1

Define a reference time series:

// time series used as reference
$referenceTimeSeries =  array(
                            array("time" => 123451, "count" => 2),
                            array("time" => 123452, "count" => 1),
                            array("time" => 123453, "count" => 6),
                            array("time" => 123454, "count" => 4),
                            array("time" => 123455, "count" => 5),
                            array("time" => 123456, "count" => 0)
                        );

Step 2

Define a single or multiple time series to analyse:

// single / multiple time series to analyse
$analysisTimeSeries = array(
                        array(
                            array("time" => 123411, "count" => -1),
                            array("time" => 123412, "count" => 1),
                            array("time" => 123413, "count" => 2),
                            array("time" => 123414, "count" => -1),
                            array("time" => 123415, "count" => 6),
                            array("time" => 123416, "count" => 30)
                        ));

// create a new instance of sax using the time series from above using the default alphabet size of 5
$sax = new SAX( $referenceTimeSeries, $analysisTimeSeries );

// or define the alphabet size by yourself ( must be greater than 2 and smaller than 11 ) 
$sax = new SAX( $referenceTimeSeries, $analysisTimeSeries, 8);

Step 3

Define a feature window length and a scanning window length:

// tarzan needs the feature window length and the scanning window length 
// as parameters
$surprises = $sax->tarzan( 1, 2 );

Documentation

An auto generated documentation can be found here.