lstnet_models

class LSTNetworkVectorClassificationModel(num_input_time_slices, input_dim_per_time_slice, num_classes: Optional[int] = None, num_convolutions: int = 100, num_cnn_time_slices: int = 6, hid_rnn: int = 100, skip: int = 0, hid_skip: int = 5, hw_window: int = 0, hw_combine: str = 'plus', dropout=0.2, output_activation=ActivationFunction.LOG_SOFTMAX, cuda=True, nn_optimiser_params: Optional[Union[dict, sensai.torch.torch_opt.NNOptimiserParams]] = None)[source]

Bases: sensai.torch.torch_base.TorchVectorClassificationModel

Classification model for time series data using the LSTNetwork architecture.

Since the model takes a time series as input, it requires that input data frames to use special naming of columns such that the data can be interpreted correctly: Each column name must start with an N-digit prefix indicating the time slice the data pertains to (for any fixed N); the following suffix shall indicate the name of the actual feature. For each N-digit prefix, we must have the same set of suffixes in the list of columns, i.e. we must have the same features for each time slice in the input time series.

__init__(num_input_time_slices, input_dim_per_time_slice, num_classes: Optional[int] = None, num_convolutions: int = 100, num_cnn_time_slices: int = 6, hid_rnn: int = 100, skip: int = 0, hid_skip: int = 5, hw_window: int = 0, hw_combine: str = 'plus', dropout=0.2, output_activation=ActivationFunction.LOG_SOFTMAX, cuda=True, nn_optimiser_params: Optional[Union[dict, sensai.torch.torch_opt.NNOptimiserParams]] = None)
Parameters
  • num_input_time_slices – the number of input time slices

  • input_dim_per_time_slice – the dimension of the input data per time slice

  • num_classes – the number of classes considered by this classification problem; if None, determine from data

  • num_cnn_time_slices – the number of time slices considered by each convolution (i.e. it is one of the dimensions of the matrix used for convolutions, the other dimension being inputDimPerTimeSlice), a.k.a. “Ck”

  • num_convolutions – the number of separate convolutions to apply, i.e. the number of independent convolution matrices, a.k.a “hidC”; if it is 0, then the entire complex processing path is not applied.

  • hid_rnn – the number of hidden output dimensions for the RNN stage

  • skip – the number of time slices to skip for the skip-RNN. If it is 0, then the skip-RNN is not used.

  • hid_skip – the number of output dimensions of each of the skip parallel RNNs

  • hw_window – the number of time slices from the end of the input time series to consider as input for the highway component. If it is 0, the highway component is not used.

  • hw_combine – {“plus”, “product”, “bilinear”} the function with which the highway component’s output is combined with the complex path’s output

  • dropout – the dropout probability to use during training (dropouts are applied after every major step in the evaluation path)

  • output_activation – the output activation function

  • nn_optimiser_params – parameters for NNOptimiser to use for training

class DataUtil(x_data: pandas.core.frame.DataFrame, y_data: pandas.core.frame.DataFrame, num_classes)

Bases: sensai.torch.torch_data.DataUtil

__init__(x_data: pandas.core.frame.DataFrame, y_data: pandas.core.frame.DataFrame, num_classes)
input_dim()
Returns

the dimensionality of the input or None if it is variable

model_output_dim() int
Returns

the dimensionality that is to be output by the model to be trained

split_into_tensors(fractional_size_of_first_set)

Splits the data set

Parameters

fractional_size_of_first_set – the desired fractional size in

Returns

a tuple (A, B) where A and B are tuples (in, out) with input and output data

get_input_output_pair(output, input)
get_output_tensor_scaler() sensai.torch.torch_data.TensorScaler

Gets the scaler with which to scale model outputs

Returns

the scaler

get_input_tensor_scaler() sensai.torch.torch_data.TensorScaler

Gets the scaler with which to scale model inputs

Returns

the scaler