cea.demand.calibration.clustering package

Submodules

cea.demand.calibration.clustering.clustering_main module

cea.demand.calibration.clustering.sax module

Symbolic Aggregate approximation (SAX) in python. Based on the paper “A Symbolic Representation of Time Series, with Implications for Streaming Algorithms” by J. Lin, E, Keogh, S. Lonardi & B. Chiu. 2003.

Adapted from work og N. Hoffman published under MIT license. The original code can be found in https://github.com/nphoff/saxpy

The MIT License (MIT) Copyright (c) 2013 Nathan Hoffman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class cea.demand.calibration.clustering.sax.SAX(word_size=8, alphabet_size=7, epsilon=1e-06)[source]

Bases: object

This class is for computing common things with the Symbolic Aggregate approXimation method. In short, this translates a series of data to a string, which can then be compared with other such strings using a lookup table.

alphabetize(paaX)[source]

Converts the Piecewise Aggregate Approximation of x to a series of letters.

batch_compare(xStrings, refString)[source]
build_letter_compare_dict()[source]

Builds up the lookup table to determine numeric distance between two letters given an alphabet size. Entries for both ‘ab’ and ‘ba’ will be created and will have identical values.

compare_letters(la, lb)[source]

Compare two letters based on letter distance return distance between

compare_strings(sA, sB)[source]

Compares two strings based on individual letter distance Requires that both strings are the same length

normalize(x)[source]

Function will normalize an array (give it a mean of 0, and a standard deviation of 1) unless it’s standard deviation is below epsilon, in which case it returns an array of zeros the length of the original array.

set_scaling_factor(scalingFactor)[source]
set_window_size(windowSize)[source]
sliding_window(x, num_subsequences=None, overlapping_fraction=None)[source]
to_PAA(x)[source]

Function performs Piecewise Aggregate Approximation on data set, reducing the dimension of the dataset x to w discrete levels. returns the reduced dimension data set, as well as the indicies corresponding to the original data for each reduced dimension

to_letter_representation(x)[source]

Function takes a series of data, x, and transforms it to a string representation

cea.demand.calibration.clustering.sax_optimization module

Module contents