> For the complete documentation index, see [llms.txt](https://robotter.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://robotter.gitbook.io/docs/robotter-app/training-a-model.md).

# Training a Model

## What is a Model?

A model, in the mathematical sense, takes an input **X** and tries to predict a variable **Y**. We defined what data we want in **X** in the previous section, but now we need to define a **prediction** **target** and a **method** to train a **model**, which will help us in trying to achieve our goal: Predict market prices.

There are many considerations when creating a **time-series** **predicting model**:

### What time frame to consider?

* The [computational complexity](https://en.wikipedia.org/wiki/Computational_complexity) of ML/DL algorithms behaves differently - depending on the model - according to a number of variables, i.e. making some models more suited for longer time frames than others.
* But all this comes with trade-offs: Modeling is an art which aims to cut through the noise by using assumptions about the data we're modeling. While some models can efficiently discover **long-time patterns** (e.g. LSTMs), others are better at analyzing **interdependencies between features** (and asset prices), like Graph Neural Networks (GNNs) and Transformers (whose complexity [strongly depends on sequence length](https://en.wikipedia.org/wiki/Transformer_\(machine_learning_model\)#Alternatives)).
* Different type of patterns -> Different models. Depending on what patterns you see in the data you try to model, you would want to use different architectures.

### What do we want to predict?

* All models use a **loss function** to measure how far off their predictions are. There exist two types of loss functions: **categorical** and **regressive** losses.
* Another aspect in time-series predictions is, what **prediction** **horizon** do we choose? Some time-frames might be more feasible than others to predict, given the data we're analyzing.&#x20;

## Standardization

Especially the last two points will need some standardization if we care about [ensembling predictions](https://en.wikipedia.org/wiki/Ensemble_learning) of several models into new models. One easy way to standardize would be:

* (What?) Predict whether the price goes up or down,
* (When?) at the end of the coming hour.

Which is a **categorical** problem (up/down) in nature.

Purely predicting the **log-return** on an asset by **regression** might give us additional information on *how large the expected move* is, but *lacks a certainty estimation* of the prediction (which we do have in the categorical case as a probability distribution).

The most versatile method to standardize predictions in time-series analysis would be to *explicitly model the probability distribution of expected log-returns* as a **Gaussian mixture**, such that any desired target can be assigned a probability ("is the next move is positive?" -> % of probability density above 0). While this might be the most versatile approach, making all ML models comply with this type of prediction might be difficult.

## Providing a Prediction Market

Nobody is perfect and nobody can perfectly time the market. The wisdom (or irrationality) of the crowds always beats you. So what to do?

Ensembling methods are used to simulate this exact wisdom of the crowds. The more people independently make an estimate, the closer will be the mean of the estimates to the actual value.

Accordingly, the overarching goal is to make algorithmic traders on Solana better informed than ever. Aggregating/ensembling predictions of dozens or hundreds of different AIs is bound to create better and more stable **meta-predictions**.

To enable an easy interfacing with all these predictions and create a marketplace for modelers to **monetize** their predictions, we want to create an **oracle-like service** like *Chainlink* or *Pyth*, with the exemption that buyers gain access to certain live feeds (aggregated by asset) and individual modelers or AIs predictions by paid subscriptions. In order to ensure the highest quality of predictions, their **backtest** and **live performance** will be **verified and stored on-chain**.
