scientific-skills/aeon/references/networks.md
Aeon provides neural network architectures specifically designed for time series tasks. These networks serve as building blocks for classification, regression, clustering, and forecasting.
FCNNetwork - Fully Convolutional Network
ResNetNetwork - Residual Network
InceptionNetwork - Inception Modules
TimeCNNNetwork - Standard CNN
DisjointCNNNetwork - Separate Pathways
DCNNNetwork - Dilated CNN
RecurrentNetwork - RNN/LSTM/GRU
TCNNetwork - Temporal Convolutional Network
MLPNetwork - Basic Feedforward
Networks designed for representation learning and clustering.
EncoderNetwork - Generic Encoder
AEFCNNetwork - FCN-based Autoencoder
AEResNetNetwork - ResNet Autoencoder
AEDCNNNetwork - Dilated CNN Autoencoder
AEDRNNNetwork - Dilated RNN Autoencoder
AEBiGRUNetwork - Bidirectional GRU
AEAttentionBiGRUNetwork - Attention + BiGRU
LITENetwork - Lightweight Inception Time Ensemble
DeepARNetwork - Probabilistic Forecasting
Networks are typically used within estimators, not directly:
from aeon.classification.deep_learning import FCNClassifier
from aeon.regression.deep_learning import ResNetRegressor
from aeon.clustering.deep_learning import AEFCNClusterer
# Classification with FCN
clf = FCNClassifier(n_epochs=100, batch_size=16)
clf.fit(X_train, y_train)
# Regression with ResNet
reg = ResNetRegressor(n_epochs=100)
reg.fit(X_train, y_train)
# Clustering with autoencoder
clusterer = AEFCNClusterer(n_clusters=3, n_epochs=100)
labels = clusterer.fit_predict(X_train)
Many networks accept configuration parameters:
# Configure FCN layers
clf = FCNClassifier(
n_epochs=200,
batch_size=32,
kernel_size=[7, 5, 3], # Kernel sizes for each layer
n_filters=[128, 256, 128], # Filters per layer
learning_rate=0.001
)
BaseDeepLearningNetwork - Abstract base for all networksBaseDeepRegressor - Base for deep regressionBaseDeepClassifier - Base for deep classificationBaseDeepForecaster - Base for deep forecastingExtend these to implement custom architectures.
Key hyperparameters to tune:
n_epochs - Training iterations (50-200 typical)batch_size - Samples per batch (16-64 typical)learning_rate - Step size (0.0001-0.01)Many networks support callbacks for training monitoring:
from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
clf = FCNClassifier(
n_epochs=200,
callbacks=[
EarlyStopping(patience=20, restore_best_weights=True),
ReduceLROnPlateau(patience=10, factor=0.5)
]
)
Deep learning networks benefit from GPU:
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Use first GPU
# Networks automatically use GPU if available
clf = InceptionTimeClassifier(n_epochs=100)
clf.fit(X_train, y_train)
Classification: InceptionNetwork, ResNetNetwork, FCNNetwork Regression: InceptionNetwork, ResNetNetwork, TCNNetwork Forecasting: TCNNetwork, DeepARNetwork, RecurrentNetwork Clustering: AEFCNNetwork, AEResNetNetwork, AEAttentionBiGRUNetwork
Long sequences: TCNNetwork, DCNNNetwork (dilated convolutions) Short sequences: MLPNetwork, FCNNetwork Multivariate: InceptionNetwork, FCNNetwork, LITENetwork Variable length: RecurrentNetwork with masking Multi-scale patterns: InceptionNetwork
Limited compute: MLPNetwork, LITENetwork Moderate compute: FCNNetwork, TimeCNNNetwork High compute available: InceptionNetwork, ResNetNetwork GPU available: Any deep network (major speedup)
Normalize input data:
from aeon.transformations.collection import Normalizer
normalizer = Normalizer()
X_train_norm = normalizer.fit_transform(X_train)
X_test_norm = normalizer.transform(X_test)
Use validation set for early stopping:
from sklearn.model_selection import train_test_split
X_train_fit, X_val, y_train_fit, y_val = train_test_split(
X_train, y_train, test_size=0.2, stratify=y_train
)
clf = FCNClassifier(n_epochs=200)
clf.fit(X_train_fit, y_train_fit, validation_data=(X_val, y_val))
Begin with simpler architectures before complex ones:
Use grid search or random search:
from sklearn.model_selection import GridSearchCV
param_grid = {
'n_epochs': [100, 200],
'batch_size': [16, 32],
'learning_rate': [0.001, 0.0001]
}
clf = FCNClassifier()
grid = GridSearchCV(clf, param_grid, cv=3)
grid.fit(X_train, y_train)
Prevent overfitting:
Set random seeds:
import numpy as np
import random
import tensorflow as tf
seed = 42
np.random.seed(seed)
random.seed(seed)
tf.random.set_seed(seed)