giotto.ml.database package

Submodules

giotto.ml.database.classifier module

class giotto.ml.database.classifier.MLClassifier(dictionary=None, serialized=False)[source]

Classifier base class

peak_count(data)[source]

Counts the number of peaks in given timesries data

predict(timeseries)[source]

Makes a prediction using a pre-trained classifier

A derived class should implement a prediction algorithm here.

Args:
timeseries: Timeseries data for prediction
Returns:
label: a string label as a prediction
preprocess(sensor_readings)[source]

Extracts features from timeseries data

Extracts the following features from a array of timeseries data. Averages, standard deviations, numbers of peaks, medians, minimum values, maximum values, numbers of zero-crossing, differences between max and min. If you want to implement your own feature extraction, overwrite this function in a derived class.

Args:
sensor_readings: An array of timeseries data
Returns:
f: a ndarray that contains features for each timeseries data
to_dictionary(serialized=False)[source]

Creates a dictionary that contains all properties

Creates a dictionary that contains all properties to store a classifier in a database. When serialized=True, classifier, scaler, selector, and model instance are serialized.

Args:
serialized: A flag that indicates if instances should be serialized or not
Returns:
dic: A dictionary that contains all properties, typically used to store
a classifier in a database
to_json()[source]

Returns a JSON representation of a MLClassifier instance

train(dataset)[source]

Trains a classifier using the dataset as a training set

A derived class should implement a training algorithm that creates and train classifier, scaler, selector, and model here.

Args:
dataset: A dictionary that holds a training set
{
‘data’: An array of training samples
[
{
‘timeseries’: An array of timeseries data arrays ‘label’: A string label for the timeseries data

}, { more samples }

]

‘labels’: An array of string labels ‘sampling_period’: An average duration of samples

}

Returns:
Nothing
zero_crossing(data)[source]

Counts the number of zero-crossing in given timesries data

giotto.ml.database.manager module

giotto.ml.database.sample module

Machine learning sample class for the machine learning layer

class giotto.ml.database.sample.MLSample(dictionary=None)[source]
to_dictionary()[source]

Returns a dictionary representation of a MLSample instance

to_json()[source]

Returns a JSON representation of a MLSample instance

giotto.ml.database.sensor module

Machine learning sensor class for the machine learning layer

class giotto.ml.database.sensor.MLSensor(dictionary=None)[source]
to_dictionary()[source]

Returns a dictionary representation of a MLSensor instance

to_json()[source]

Returns a JSON representation of a MLSensor instance

Module contents