# Build your first model

Start with a small temporal convolutional network (TCN). This example constructs a model with newly initialized weights; training data and learned weights come from your application.

## Select the backend first

Install the matching extra from [Getting started](https://ambiqai.github.io/helia-edge/getting-started/). Set the backend before importing Keras or accessing a heliaEDGE Keras component:

```python
import os
os.environ["KERAS_BACKEND"] = "tensorflow"  # Use "torch" in a Torch environment.

import keras
from helia_edge.models import ModelSpec, build, compact_tcn_params
```

Use a separate process when switching backends. See [Backend support](https://ambiqai.github.io/helia-edge/getting-started/backends/) for feature-specific limits.

## Configure and construct

```python
spec = ModelSpec(params=compact_tcn_params(filters=8, num_classes=2), input_shape=(240, 14))
model = build(spec, batch_size=1)
model.summary()
```

The input represents 240 time steps and 14 channels per example. Those dimensions and the two output classes are choices for this example, not fixed requirements of the preset. Choose dimensions and an output interpretation that match your task.

With this preset, the output shape is `(1, 240, 2)`: two logits per time step. It is a sequence output, not one classification for the entire window.

The spec (family parameters and input shape) describes the architecture. The constructed Keras model holds its layers and weights. Keep both when recording an experiment:

```python
from pathlib import Path
Path("architecture.json").write_text(spec.model_dump_json(indent=2))
model.save("model.keras")
```

This saves an initialized, untrained model. Training, data splits, objectives and evaluation remain application decisions.

## Continue with your workflow

- [Choose a model family](https://ambiqai.github.io/helia-edge/guide/architectures/): Explore architecture options and their configuration.
- [Train your model](https://ambiqai.github.io/helia-edge/guide/training/): Add callbacks and choose the objective for your task.
[Open the CIFAR-10 notebook](https://ambiqai.github.io/helia-edge/examples/train-cifar-model/)
[Save and load models](https://ambiqai.github.io/helia-edge/guide/serialization/)
