trink / symtseries

C Library providing means of symbolic analysis on time series data currently based on iSAX paper (http://www.cs.ucr.edu/~eamonn/iSAX/iSAX.html)
Mozilla Public License 2.0
3 stars 3 forks source link

Symbolic time series representations

Means of representing your time series data in a convenient way for your task.

Overview

The codebase under this repository is supposed to be operated in one of three ways:

Installation

Prerequisites

CMake Build Instructions

git clone https://github.com/Quadrocube/symtseries.git
cd symtseries
mkdir release
cd release
cmake .. -DCMAKE_BUILD_TYPE=Release && make
ctest

SAX (Symbolic Aggregate approXimation)

Latest SAX paper

iSAX 2.0

Overview

SAX is the method of time series data representation which provides a user with several interesting capabilities:

Example Usage

API functions

window.new(n, w, c)

require "sax"
local window = sax.window.new(150, 10, 8)

Import sax module via the Lua 'require' function. The module is globally registered and returned by the require function.

Arguments

Return

word.new[(v, w, c), (s, c)]

local a = sax.word.new({10.3, 7, 1, -5, -5, 7.2}, 2, 8)
local b = sax.word.new("FC", 8)
print(a == b)
-- prints true

Arguments

OR

Return

mindist(a, b)

local a = sax.word.new({10.3, 7, 1, -5, -5, 7.2}, 2, 8)
local values = {-9, -8, -7, -5, -5, 7.2}
local b = sax.window.new(#values, 2, 8)
for i=1,#values do b:add(values[i]) end
local distance, above, below = sax.mindist(a, b)
-- distance == 1.560325
-- above == 1.103316
-- below == 1.103316

Arguments

Return

version()

print(sax.version())

Return

Window methods

add(val)

local window = sax.window.new(4, 2, 4)
local values = {1, 2, 3, 10.1}
local a = sax.word.new(values, 2, 4)

for i=1,4 do window:add(values[i]) end

print(a == window)
window:add({-10, 1, 2, 3, 10.1}) -- it only copies n last values if given more than n
print(a == window)

-- prints true true

Arguments

Return

get_word()

Return

clear()

local window = sax.window.new(4, 2, 4)
local values = {1, 2, 3, 10.1}

for i=1,4 do window:add(values[i]) end

print(window)
window:clear()
print(window)

-- prints AD##

Return

__tostring

local win = sax.window.new(4, 2, 4)
for i=1,4 do win:add(1.5) end
print(win)
-- prints CC

Return

__eq

local window = sax.window.new(4, 2, 4)
local values = {1, 2, 3, 10.1}
local a, b

for i=1,4 do window:add(values[i]) end

b = sax.word.new(values, 2, 4)

print(window:get_word() == b)
print(window == b)
-- prints true true

Return

Word methods

__tostring

local a = sax.word.new({10.3, 7, 1, -5, -5, 7.2}, 2, 8)
print(a)
-- prints FC

Return

__eq

See window.__eq