InceptionTimeClassifier
InceptionTimeClassifier
- class InceptionTimeClassifier(n_epochs=1500, batch_size=64, kernel_size=40, n_filters=32, use_residual=True, use_bottleneck=True, bottleneck_size=32, depth=6, callbacks=None, random_state=None, verbose=False, loss='categorical_crossentropy', metrics=None, class_weight=None, activation='softmax', activation_hidden='relu', activation_inception='linear')[source]
InceptionTime Deep Learning Classifier.
Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/InceptionTime/blob/master/classifiers/inception.py
Described in [1]_, InceptionTime is a deep learning model designed for time series classification. It is based on the Inception architecture for images. The model is made up of a series of Inception modules.
InceptionTimeClassifieris a single instance of InceptionTime model described in the original publication [1]_, which uses an ensemble of 5 single instances.To build an ensemble of models mirroring [1]_, use the
BaggingClassifierwithn_estimators=5,bootstrap=False, andestimatorbeing an instance of thisInceptionTimeClassifier.- Parameters:
- activationstring or a tf callable, default=”softmax”
Activation function used in the output layer. List of available activation functions: https://keras.io/api/layers/activations/
- activation_hiddenstring or a tf callable, default=”relu”
Activation function used in the hidden layers. List of available activation functions: https://keras.io/api/layers/activations/
- activation_inceptionstring or a tf callable, default=”linear”
Activation function used in the Inception modules. List of available activation functions: https://keras.io/api/layers/activations/
- n_epochsint, default=1500
- batch_sizeint, default=64
the number of samples per gradient update
- kernel_sizeint, default=40
specifying the length of the 1D convolution window
- n_filtersint, default=32
- use_residualboolean, default=True
- use_bottleneckboolean, default=True
- bottleneck_sizeint, default=32
- depthint, default=6
- callbackslist of tf.keras.callbacks.Callback objects
- random_state: int, optional, default=None
random seed for internal random number generator
- verbose: boolean, default=False
whether to print runtime information
- loss: str, default=”categorical_crossentropy”
- metrics: optional
- class_weight: dict, optional, default=None
Dictionary mapping class labels to a weight (float) value to be used during model training. For example,
{"A": 1.0, "B": 2.5}will assign a weight of 1.0 to class “A” and 2.5 to class “B”. This is passed directly to Keras’fitmethod as theclass_weightargument after converting labels to integer encoding. If None, all classes are given equal weight.
- Attributes:
is_fittedWhether
fithas been called.
Notes
..[1] Fawaz et. al, InceptionTime: Finding AlexNet for Time Series Classification, Data Mining and Knowledge Discovery, 34, 2020
Examples
Single instance of InceptionTime model: >>> from sktime.classification.deep_learning import InceptionTimeClassifier >>> from sktime.datasets import load_unit_test # doctest: +SKIP >>> X_train, y_train = load_unit_test(split=”train”) # doctest: +SKIP >>> X_test, y_test = load_unit_test(split=”test”) # doctest: +SKIP >>> clf = InceptionTimeClassifier() # doctest: +SKIP >>> clf.fit(X_train, y_train) # doctest: +SKIP InceptionTimeClassifier(…)
To build an ensemble of models mirroring [1]_, use the
BaggingClassifieras follows: >>> from sktime.classification.ensemble import BaggingClassifier >>> from sktime.classification.deep_learning import InceptionTimeClassifier >>> from sktime.datasets import load_unit_test # doctest: +SKIP >>> X_train, y_train = load_unit_test(split=”train”) # doctest: +SKIP >>> X_test, y_test = load_unit_test(split=”test”) # doctest: +SKIP >>> clf = BaggingClassifier( … InceptionTimeClassifier(), … n_estimators=5, … bootstrap=False … ) # doctest: +SKIP >>> clf.fit(X_train, y_train) # doctest: +SKIP BaggingClassifier(…)Methods
build_model(input_shape, n_classes, **kwargs)Construct a compiled, un-trained, keras model that is ready for training.
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.
summary()Summary function to return the losses/metrics for model fit.

