IoTPy.modules.ML package

Submodules

IoTPy.modules.ML.plot module

IoTPy.modules.ML.plot.plot(lst, state, plot_func, num_features)[source]

This function plots data using the plot_func

Parameters:

lst : list

Data to plot

state : object

State used for predict and plot

plot_func : function

A function that processes the data for usage such as visualization. This function takes parameters x and y data, a model object, a state object, and returns an updated state object. This function has the signature (np.ndarray np.ndarray Object Object tuple) -> (Object). The first numpy array x has dimensions i x num_features, where min_window_size <= i <= max_window_size. The second numpy array y has dimensions i x num_outputs, where num_outputs refers to the number of y outputs for an input. The third parameter is the model object defined by train_func. The fourth parameter is a state object defined by this function.

num_features : int

An int that describes the number of features in the data.

IoTPy.modules.ML.predict module

IoTPy.modules.ML.predict.predict(lst, state, predict_func, num_features)[source]

This function predicts values using predict_func

Parameters:

lst : list

Data to predict

state : object

State for model

predict_func : function

A function that takes as input 2 tuples corresponding to 1 row of data and a model and returns the prediction output. This function has the signature (tuple tuple Object) -> (Object). The first tuple x has num_features values and the second tuple y has num_outputs values, where num_outputs refers to the number of y outputs for an input. In the case of unsupervised learning, y is empty.

num_features : int

An int that describes the number of features in the data.

IoTPy.modules.ML.train module

IoTPy.modules.ML.train.train(lst, state, train_func, num_features)[source]

This function trains a model using train_func

Parameters:

lst : list

Data to train on

state : object

State for train

train_func : function

A function that trains a model. This function takes parameters x and y data, a model object, and a window_state tuple, and returns a trained model object. In the case of data_train as a Stream, this function has the signature (numpy.ndarray numpy.ndarray Object) -> (Object). The first parameter x will have dimensions i x num_features, where min_window_size <= i <= max_window_size. The second parameter y will have dimensions i x num_outputs, where num_outputs refers to the number of y outputs for an input. For example, num_outputs is 1 for 1 scalar output. For unsupervised learning, num_outputs is 0. In the case of data_train as a numpy array, this function has the signature (numpy.ndarray numpy.ndarray Object) -> (Object). The first parameter x will have dimensions N x num_features, where N refers to the total number of training examples. The second parameter y will have dimensions N x num_outputs where num_outputs is defined as before. If data_train is none of the above, the function has the signature (Object None Object) -> (Object). The first parameter is data_train. The third parameter is a model defined by this function. The fourth parameter is a window_state tuple with the values (current_window_size, steady_state, reset, step_size, max_window_size), where current_window_size describes the number of points in the window, steady_state is a boolean that describes whether the window has reached max_window_size, and reset is a boolean that can be set to True to reset the window.

num_features : int

An int that describes the number of features in the data.

Module contents