# Spice Models

Spice Models enable the training and use of ML models natively on the Spice platform.

The platform currently supports time-series forecasting models, with other categories of models planned.

Hosted models have first-class access to co-located data for training and inferencing including: Spice managed datasets, [user managed datasets](https://github.com/spicehq/docs/blob/trunk/portal/external-data-sources.md), and [custom datasets and views](https://github.com/spicehq/docs/blob/trunk/portal/datasets-and-views.md). Additionally, [Spice Firecache](https://docs.spice.ai/features/federated-sql-query) can be leveraged to train and infer up to 10x faster.

## Defining a Model

Models are defined using a model manifest YAML file. Model details such as data requirements, architecture, training parameters, and other important hyperparameters are defined in the `model.yaml.`

Add a `model.yaml` file to the repository path `/models/[model_name]/model.yaml` of a [GitHub connected Spice app](https://github.com/spicehq/docs/blob/trunk/portal/apps/connect-github.md), replacing `[model_name]` with the desired model name.

Refer to the Models YAML specification for all available configuration options.

For example model manifests, see the [models samples repo](https://github.com/spiceai/samples/tree/trunk/.spice/models).

## Training a Model

In the [spice.ai Portal](/content/site-root.html), navigate to the **Models** tab of the Spice app.

`model.yaml` files committed to the connected repository will be automatically detected and imported as Spice Models.

Navigating to a specific Model will show detailed information as defined in the `model.yaml`.

A training run can be started using the **Train** button.

**Training runs** in progress will be shown and updated, along with historical training runs.

The **Training Status** will be updated to `Complete` for successfully completed training runs. Details and the Training Report, are available on the **Training Run** page.

### Running Model Predictions

Spice Models (beta) currently supports **time-series forecasting**.

Additional categories of data science and machine learning are on our roadmap.

A successfully trained model can be used to make predictions.

The lookback data (inferencing data) is automatically provided by the platform and wired up to the inference, enabling a prediction to be made using a simple API call.

### AI Predictions in the Playground

Navigate to **AI Predictions** in the **Playground**.

Successfully trained models will be available for selection from the model selector drop down on the right.

Clicking **Predict** will demonstrate calling the predictions API using lookback data within the Spice platform. A graph of the predicted value(s) along with the lookback data will be displayed.

### Predictions by API

The **Training Runs** page provides training details including a copyable `curl` command to make a prediction from the command line.

For details on the API, see Prediction Documentation.

---

Last updated 3 months ago.
