Skill Tracer
Skills › Scientific Agent Skills › aeon › networks.md

networks.md

296 lines · skills/aeon/references/networks.md at 5f2bc03

Open on GitHub
1# Deep Learning Networks
2
3Aeon 1.6 provides TensorFlow/Keras network building blocks. This reference was checked against release source; all deep-training snippets are illustrative and were not executed during this review. Install the estimator's TensorFlow dependency separately rather than downloading all optional stacks. Estimator inputs use `(cases, channels, timepoints)` and wrappers transpose internally to Keras layouts.
4

Deep Learning Networks

Aeon 1.6 provides TensorFlow/Keras network building blocks. This reference was checked against release source; all deep-training snippets are illustrative and were not executed during this review. Install the estimator's TensorFlow dependency separately rather than downloading all optional stacks. Estimator inputs use (cases, channels, timepoints) and wrappers transpose internally to Keras layouts.

Raw lines 1 to 4
5## Core Network Architectures
6

Core Network Architectures

Raw lines 5 to 6
7### Convolutional Networks
8
9**FCNNetwork** - Fully Convolutional Network
10- Three convolutional blocks with batch normalization
11- Global average pooling for dimensionality reduction
12- **Use when**: Need simple yet effective CNN baseline
14**ResNetNetwork** - Residual Network
15- Residual blocks with skip connections
16- Prevents vanishing gradients in deep networks
17- **Use when**: Deep networks needed, training stability important
19**InceptionNetwork** - Inception Modules
20- Multi-scale feature extraction with parallel convolutions
21- Different kernel sizes capture patterns at various scales
22- **Use when**: Patterns exist at multiple temporal scales
24**TimeCNNNetwork** - Standard CNN
25- Basic convolutional architecture
26- **Use when**: Simple CNN sufficient, interpretability valued
28**DisjointCNNNetwork** - Separate Pathways
29- Disjoint convolutional pathways
30- **Use when**: Different feature extraction strategies needed
32**DCNNNetwork** - Dilated CNN
33- Dilated convolutions for large receptive fields
34- **Use when**: Long-range dependencies without many layers

Convolutional Networks

FCNNetwork - Fully Convolutional Network

  • Three convolutional blocks with batch normalization
  • Global average pooling for dimensionality reduction
  • Use when: Need simple yet effective CNN baseline

ResNetNetwork - Residual Network

  • Residual blocks with skip connections
  • Prevents vanishing gradients in deep networks
  • Use when: Deep networks needed, training stability important

InceptionNetwork - Inception Modules

  • Multi-scale feature extraction with parallel convolutions
  • Different kernel sizes capture patterns at various scales
  • Use when: Patterns exist at multiple temporal scales

TimeCNNNetwork - Standard CNN

  • Basic convolutional architecture
  • Use when: Simple CNN sufficient, interpretability valued

DisjointCNNNetwork - Separate Pathways

  • Disjoint convolutional pathways
  • Use when: Different feature extraction strategies needed

DCNNNetwork - Dilated CNN

  • Dilated convolutions for large receptive fields
  • Use when: Long-range dependencies without many layers
Raw lines 7 to 35
36### Recurrent Networks
38**RecurrentNetwork** - RNN/LSTM/GRU
39- `rnn_type` supports `"simple"`, `"lstm"`, and `"gru"`
40- Sequential modeling of temporal dependencies
41- **Use when**: Sequential dependencies are important

Recurrent Networks

RecurrentNetwork - RNN/LSTM/GRU

  • rnn_type supports "simple", "lstm", and "gru"
  • Sequential modeling of temporal dependencies
  • Use when: Sequential dependencies are important
Raw lines 36 to 42
43### Temporal Convolutional Network
45**TCNNetwork** - Temporal Convolutional Network
46- Dilated causal convolutions
47- Large receptive field without recurrence
48- **Use when**: Long sequences, need parallelizable architecture

Temporal Convolutional Network

TCNNetwork - Temporal Convolutional Network

  • Dilated causal convolutions
  • Large receptive field without recurrence
  • Use when: Long sequences, need parallelizable architecture
Raw lines 43 to 49
50### Multi-Layer Perceptron
52**MLPNetwork** - Basic Feedforward
53- Simple fully-connected layers
54- Flattens time series before processing
55- **Use when**: Baseline needed, computational limits, or simple patterns

Multi-Layer Perceptron

MLPNetwork - Basic Feedforward

  • Simple fully-connected layers
  • Flattens time series before processing
  • Use when: Baseline needed, computational limits, or simple patterns
Raw lines 50 to 56
57## Encoder-Based Architectures
59Networks designed for representation learning and clustering.

Encoder-Based Architectures

Networks designed for representation learning and clustering.

Raw lines 57 to 60
61### Autoencoder Variants
63**EncoderNetwork** - Convolutional Encoder
64- Convolutional layers and attention-based encoding
65- **Use when**: Custom encoding needed
67**AEFCNNetwork** - FCN-based Autoencoder
68- Fully convolutional encoder-decoder
69- **Use when**: Need convolutional representation learning
71**AEResNetNetwork** - ResNet Autoencoder
72- Residual blocks in encoder-decoder
73- **Use when**: Deep autoencoding with skip connections
75**AEDCNNNetwork** - Dilated CNN Autoencoder
76- Dilated convolutions for compression
77- **Use when**: Need large receptive field in autoencoder
79**AEDRNNNetwork** - Dilated RNN Autoencoder
80- Dilated recurrent connections
81- **Use when**: Sequential patterns with long-range dependencies
83**AEBiGRUNetwork** - Bidirectional GRU
84- Bidirectional recurrent encoding
85- **Use when**: Context from both directions helpful
87**AEAttentionBiGRUNetwork** - Attention + BiGRU
88- Attention mechanism on BiGRU outputs
89- **Use when**: Need to focus on important time steps

Autoencoder Variants

EncoderNetwork - Convolutional Encoder

  • Convolutional layers and attention-based encoding
  • Use when: Custom encoding needed

AEFCNNetwork - FCN-based Autoencoder

  • Fully convolutional encoder-decoder
  • Use when: Need convolutional representation learning

AEResNetNetwork - ResNet Autoencoder

  • Residual blocks in encoder-decoder
  • Use when: Deep autoencoding with skip connections

AEDCNNNetwork - Dilated CNN Autoencoder

  • Dilated convolutions for compression
  • Use when: Need large receptive field in autoencoder

AEDRNNNetwork - Dilated RNN Autoencoder

  • Dilated recurrent connections
  • Use when: Sequential patterns with long-range dependencies

AEBiGRUNetwork - Bidirectional GRU

  • Bidirectional recurrent encoding
  • Use when: Context from both directions helpful

AEAttentionBiGRUNetwork - Attention + BiGRU

  • Attention mechanism on BiGRU outputs
  • Use when: Need to focus on important time steps
Raw lines 61 to 90
91## Specialized Architectures
93**LITENetwork** - Lightweight Inception Time Ensemble
94- Efficient inception-based architecture
95- LITEMV variant for multivariate series
96- **Use when**: Need efficiency with strong performance
98**DeepARForecaster** - Probabilistic forecasting (use via `aeon.forecasting.deep_learning`)
99- Autoregressive RNN for forecasting
100- Point output by default; `use_probabilistic=True` requests mean/scale output. Validate loss and calibration for uncertainty use
101- **Use when**: Need forecast uncertainty quantification

Specialized Architectures

LITENetwork - Lightweight Inception Time Ensemble

  • Efficient inception-based architecture
  • LITEMV variant for multivariate series
  • Use when: Need efficiency with strong performance

DeepARForecaster - Probabilistic forecasting (use via aeon.forecasting.deep_learning)

  • Autoregressive RNN for forecasting
  • Point output by default; use_probabilistic=True requests mean/scale output. Validate loss and calibration for uncertainty use
  • Use when: Need forecast uncertainty quantification
Raw lines 91 to 102
103## Usage with Estimators
105Networks are typically used within estimators, not directly:
107```python
108from aeon.classification.deep_learning import FCNClassifier
109from aeon.regression.deep_learning import ResNetRegressor
110from aeon.clustering.deep_learning import AEFCNClusterer
112# Classification with FCN
113clf = FCNClassifier(n_epochs=100, batch_size=16)
114clf.fit(X_train, y_train)
116# Regression with ResNet
117reg = ResNetRegressor(n_epochs=100)
118reg.fit(X_train, y_train)
120# Clustering with autoencoder
121from sklearn.cluster import KMeans
122clusterer = AEFCNClusterer(
123 estimator=KMeans(n_clusters=3, random_state=42), n_epochs=100
125labels = clusterer.fit_predict(X_train)
126```

Usage with Estimators

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
from sklearn.cluster import KMeans
clusterer = AEFCNClusterer(
    estimator=KMeans(n_clusters=3, random_state=42), n_epochs=100
)
labels = clusterer.fit_predict(X_train)
Raw lines 103 to 127
128## Custom Network Configuration
130Many networks accept configuration parameters:
132```python
133# Configure FCN layers and the optimizer (no learning_rate constructor field)
134from tensorflow.keras.optimizers import Adam
135clf = FCNClassifier(
136 n_epochs=200,
137 batch_size=32,
138 kernel_size=[7, 5, 3], # Kernel sizes for each layer
139 n_filters=[128, 256, 128], # Filters per layer
140 optimizer=Adam(learning_rate=0.001)
142```

Custom Network Configuration

Many networks accept configuration parameters:

# Configure FCN layers and the optimizer (no learning_rate constructor field)
from tensorflow.keras.optimizers import Adam
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
    optimizer=Adam(learning_rate=0.001)
)
Raw lines 128 to 143
144## Base Classes
146- `BaseDeepLearningNetwork` - Abstract base for all networks
147- `BaseDeepRegressor` - Base for deep regression
148- `BaseDeepClassifier` - Base for deep classification
149- `BaseDeepForecaster` - Base for deep forecasting
151Extend these to implement custom architectures.

Base Classes

  • BaseDeepLearningNetwork - Abstract base for all networks
  • BaseDeepRegressor - Base for deep regression
  • BaseDeepClassifier - Base for deep classification
  • BaseDeepForecaster - Base for deep forecasting

Extend these to implement custom architectures.

Raw lines 144 to 152
153## Training Considerations

Training Considerations

Raw lines 153 to 154
155### Hyperparameters
157Key hyperparameters to tune:
159- `n_epochs` - Training iterations (50-200 typical)
160- `batch_size` - Samples per batch (16-64 typical)
161- Learning rate belongs to the Keras `optimizer`; it is not an FCNClassifier parameter
162- Network-specific: layers, filters, kernel sizes

Hyperparameters

Key hyperparameters to tune:

  • n_epochs - Training iterations (50-200 typical)
  • batch_size - Samples per batch (16-64 typical)
  • Learning rate belongs to the Keras optimizer; it is not an FCNClassifier parameter
  • Network-specific: layers, filters, kernel sizes
Raw lines 155 to 163
164### Callbacks
166Many estimators support callbacks. FCNClassifier.fit does not pass a validation set to Keras; use training `loss` for these callbacks, and evaluate generalization on independent validation data:
168```python
169from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
171clf = FCNClassifier(
172 n_epochs=200,
173 callbacks=[
174 EarlyStopping(monitor="loss", patience=20, restore_best_weights=True),
175 ReduceLROnPlateau(monitor="loss", patience=10, factor=0.5)
176 ]
178```

Callbacks

Many estimators support callbacks. FCNClassifier.fit does not pass a validation set to Keras; use training loss for these callbacks, and evaluate generalization on independent validation data:

from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau

clf = FCNClassifier(
    n_epochs=200,
    callbacks=[
        EarlyStopping(monitor="loss", patience=20, restore_best_weights=True),
        ReduceLROnPlateau(monitor="loss", patience=10, factor=0.5)
    ]
)
Raw lines 164 to 179
180### GPU Acceleration
182Deep learning networks benefit from GPU:
184```python
185import os
186os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set before importing TensorFlow
187from aeon.classification.deep_learning import InceptionTimeClassifier
189# TensorFlow uses a supported GPU when its platform backend is configured
190clf = InceptionTimeClassifier(n_epochs=100)
191clf.fit(X_train, y_train)
192```

GPU Acceleration

Deep learning networks benefit from GPU:

import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'  # Set before importing TensorFlow
from aeon.classification.deep_learning import InceptionTimeClassifier

# TensorFlow uses a supported GPU when its platform backend is configured
clf = InceptionTimeClassifier(n_epochs=100)
clf.fit(X_train, y_train)
Raw lines 180 to 193
194## Architecture Selection

Architecture Selection

Raw lines 194 to 195
196### By Task:
198**Classification**: InceptionNetwork, ResNetNetwork, FCNNetwork
199**Regression**: InceptionNetwork, ResNetNetwork, TCNNetwork
200**Forecasting**: TCNForecaster, DeepARForecaster
201**Clustering**: AEFCNNetwork, AEResNetNetwork, AEAttentionBiGRUNetwork

By Task:

Classification: InceptionNetwork, ResNetNetwork, FCNNetwork Regression: InceptionNetwork, ResNetNetwork, TCNNetwork Forecasting: TCNForecaster, DeepARForecaster Clustering: AEFCNNetwork, AEResNetNetwork, AEAttentionBiGRUNetwork

Raw lines 196 to 202
203### By Data Characteristics:
205**Long sequences**: TCNNetwork, DCNNNetwork (dilated convolutions)
206**Short sequences**: MLPNetwork, FCNNetwork
207**Multivariate**: InceptionNetwork, FCNNetwork, LITENetwork
208**Variable length**: Check estimator `capability:unequal_length`; a recurrent architecture does not imply that its aeon wrapper supports ragged data
209**Multi-scale patterns**: InceptionNetwork

By Data Characteristics:

Long sequences: TCNNetwork, DCNNNetwork (dilated convolutions) Short sequences: MLPNetwork, FCNNetwork Multivariate: InceptionNetwork, FCNNetwork, LITENetwork Variable length: Check estimator capability:unequal_length; a recurrent architecture does not imply that its aeon wrapper supports ragged data Multi-scale patterns: InceptionNetwork

Raw lines 203 to 210
211### By Computational Resources:
213**Limited compute**: MLPNetwork, LITENetwork
214**Moderate compute**: FCNNetwork, TimeCNNNetwork
215**High compute available**: InceptionNetwork, ResNetNetwork
216**GPU available**: Any deep network (major speedup)

By Computational Resources:

Limited compute: MLPNetwork, LITENetwork Moderate compute: FCNNetwork, TimeCNNNetwork High compute available: InceptionNetwork, ResNetNetwork GPU available: Any deep network (major speedup)

Raw lines 211 to 217
218## Best Practices

Best Practices

Raw lines 218 to 219
220### 1. Data Preparation
222Normalize input data:
224```python
225from aeon.transformations.collection import Normalizer
227normalizer = Normalizer()
228X_train_norm = normalizer.fit_transform(X_train)
229X_test_norm = normalizer.transform(X_test)
230```

1. Data Preparation

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)
Raw lines 220 to 231
232### 2. Training/Validation Split
234Hold out validation cases (or whole subjects/groups when measurements are related). FCNClassifier.fit accepts only `(X, y)`, not `validation_data=`:
236```python
237from sklearn.model_selection import train_test_split
239X_train_fit, X_val, y_train_fit, y_val = train_test_split(
240 X_train, y_train, test_size=0.2, stratify=y_train
243clf = FCNClassifier(n_epochs=200)
244clf.fit(X_train_fit, y_train_fit)
245validation_accuracy = clf.score(X_val, y_val)
246```

2. Training/Validation Split

Hold out validation cases (or whole subjects/groups when measurements are related). FCNClassifier.fit accepts only (X, y), not validation_data=:

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_accuracy = clf.score(X_val, y_val)
Raw lines 232 to 247
248### 3. Start Simple
250Begin with simpler architectures before complex ones:
2521. Try MLPNetwork or FCNNetwork first
2532. If insufficient, try ResNetNetwork or InceptionNetwork
2543. Consider ensembles if single models insufficient

3. Start Simple

Begin with simpler architectures before complex ones:

  1. Try MLPNetwork or FCNNetwork first
  2. If insufficient, try ResNetNetwork or InceptionNetwork
  3. Consider ensembles if single models insufficient
Raw lines 248 to 255
256### 4. Hyperparameter Tuning
258Use grid search or random search:
260```python
261from sklearn.model_selection import GridSearchCV
263param_grid = {
264 'n_epochs': [100, 200],
265 'batch_size': [16, 32]
268clf = FCNClassifier()
269grid = GridSearchCV(clf, param_grid, cv=3, n_jobs=1)
270grid.fit(X_train, y_train)
271```

4. Hyperparameter Tuning

Use grid search or random search:

from sklearn.model_selection import GridSearchCV

param_grid = {
    'n_epochs': [100, 200],
    'batch_size': [16, 32]
}

clf = FCNClassifier()
grid = GridSearchCV(clf, param_grid, cv=3, n_jobs=1)
grid.fit(X_train, y_train)
Raw lines 256 to 272
273### 5. Regularization
275Prevent overfitting:
276- Use dropout (if network supports)
277- Early stopping
278- Data augmentation (if available)
279- Reduce model complexity

5. Regularization

Prevent overfitting:

  • Use dropout (if network supports)
  • Early stopping
  • Data augmentation (if available)
  • Reduce model complexity
Raw lines 273 to 280
281### 6. Reproducibility
283Set random seeds:
285```python
286import numpy as np
287import random
288import tensorflow as tf
290seed = 42
291np.random.seed(seed)
292random.seed(seed)
293tf.random.set_seed(seed)
294```
296Sources: [networks API](https://www.aeon-toolkit.org/en/stable/api_reference/networks.html), [FCN source](https://github.com/aeon-toolkit/aeon/blob/v1.6.0/aeon/classification/deep_learning/_fcn.py).

6. Reproducibility

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)

Sources: networks API, FCN source.

Raw lines 281 to 296