lstnet_models#
Source code: sensai/torch/torch_models/lstnet/lstnet_models.py
- 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, NNOptimiserParams]] = None)[source]#
Bases:
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.
- 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: DataFrame, y_data: DataFrame, num_classes)[source]#
Bases:
DataUtil
- model_output_dim() int [source]#
- Returns:
the dimensionality that is to be output by the model to be trained
- split_into_tensors(fractional_size_of_first_set)[source]#
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_output_tensor_scaler() TensorScaler [source]#
Gets the scaler with which to scale model outputs
- Returns:
the scaler
- get_input_tensor_scaler() TensorScaler [source]#
Gets the scaler with which to scale model inputs
- Returns:
the scaler