GRUFCNNClassifier
GRUFCNNClassifier
- class GRUFCNNClassifier(hidden_dim: int, gru_layers: int, batch_first: bool = False, bias: bool = True, init_weights: bool = True, dropout: float = 0.0, gru_dropout: float = 0.0, bidirectional: bool = False, conv_layers: list = [128, 256, 128], kernel_sizes: list = [7, 5, 3], num_epochs: int = 10, batch_size: int = 8, optimizer: str = 'Adam', criterion: str = None, criterion_kwargs: dict = None, optimizer_kwargs: dict = None, lr: float = 0.01, verbose: bool = False, random_state: int = None)[source]
GRU-FCN for time series classification.
The network used in this classifier is originally defined in [1]. The current implementation uses PyTorch and references the TensorFlow implementations in [2] and [3].
- Parameters:
- hidden_dimint
Number of features in the hidden state.
- gru_layersint
Number of recurrent layers.
- batch_firstbool
If True, then the input and output tensors are provided as (batch, seq, feature), default is False.
- biasbool
If False, then the layer does not use bias weights, default is True.
- init_weightsbool
If True, then the weights are initialized, default is True.
- dropoutfloat
Dropout rate to apply inside gru cell. default is 0.0
- gru_dropoutfloat
Dropout rate to apply to the gru output layer. default is 0.0
- bidirectionalbool
If True, then the GRU is bidirectional, default is False.
- conv_layerslist
List of integers specifying the number of filters in each convolutional layer. default is [128, 256, 128].
- kernel_sizeslist
List of integers specifying the kernel size in each convolutional layer. default is [7, 5, 3].
- num_epochsint, optional (default=10)
The number of epochs to train the model.
- optimizerstr, optional (default=None)
The optimizer to use. If None, Adam will be used.
- activationstr, optional (default=”relu”)
The activation function to use. Options: [“relu”, “softmax”].
- batch_sizeint, optional (default=8)
The size of each mini-batch during training.
- criterioncallable, optional (default=None)
The loss function to use. If None, CrossEntropyLoss will be used.
- criterion_kwargsdict, optional (default=None)
Additional keyword arguments to pass to the loss function.
- optimizer_kwargsdict, optional (default=None)
Additional keyword arguments to pass to the optimizer.
- lrfloat, optional (default=0.001)
The learning rate to use for the optimizer.
- verbosebool, optional (default=False)
Whether to print progress information during training.
- random_stateint, optional (default=None)
Seed to ensure reproducibility.
- Attributes:
is_fittedWhether
fithas been called.
References
[1]Elsayed, et al. “Deep Gated Recurrent and Convolutional Network Hybrid Model for Univariate Time Series Classification.” arXiv preprint arXiv:1812.07683 (2018).
Methods
check_is_fitted([method_name])Check if the estimator has been fitted.
clone()Obtain a clone of the object with same hyper-parameters and config.
clone_tags(estimator[, tag_names])Clone tags from another object as dynamic override.
create_test_instance([parameter_set])Construct an instance of the class, using first test parameter set.
create_test_instances_and_names([parameter_set])Create list of all test instances and a list of names for them.
fit(X, y)Fit time series classifier to training data.
fit_predict(X, y[, cv, change_state])Fit and predict labels for sequences in X.
fit_predict_proba(X, y[, cv, change_state])Fit and predict labels probabilities for sequences in X.
get_class_tag(tag_name[, tag_value_default])Get class tag value from class, with tag level inheritance from parents.
get_class_tags()Get class tags from class, with tag level inheritance from parent classes.
get_config()Get config flags for self.
get_fitted_params([deep])Get fitted parameters.
get_param_defaults()Get object's parameter defaults.
get_param_names([sort])Get object's parameter names.
get_params([deep])Get a dict of parameters values for this object.
get_tag(tag_name[, tag_value_default, ...])Get tag value from instance, with tag level inheritance and overrides.
get_tags()Get tags from instance, with tag level inheritance and overrides.
get_test_params([parameter_set])Return testing parameter settings for the estimator.
is_composite()Check if the object is composed of other BaseObjects.
load_from_path(serial)Load object from file location.
load_from_serial(serial)Load object from serialized memory container.
predict(X)Predicts labels for sequences in X.
predict_proba(X)Predicts labels probabilities for sequences in X.
reset()Reset the object to a clean post-init state.
save([path, serialization_format])Save serialized self to bytes-like object or to (.zip) file.
score(X, y)Scores predicted labels against ground truth labels on X.
set_config(**config_dict)Set config flags to given values.
set_params(**params)Set the parameters of this object.
set_random_state([random_state, deep, ...])Set random_state pseudo-random seed parameters for self.
set_tags(**tag_dict)Set instance level tag overrides to given values.

