> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mathfi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Training

> Step-by-step guide to training predictive models on MathFi.ai, covering dataset creation, model training, and running predictions.

This guide outlines the core process of preparing data, train models and run predictions within MathFi.ai platform.

<br />

### Overview

You can interact with MathFi.ai in two ways:

1. **Web Dashboard** — For research, PoC, and interactive model training with hyperparameter tuning (what this guide is about)
2. **REST API/Python** — For programmatic, production-ready use of your trained models via the MathFi.ai API (see [API guide](/developers/api-overview))

All data and models are securely logged and stored on the cloud under your account.

##### How classification type is determined

* The MathFi.ai platform automatically detects whether the task is **binary or multi-class classification**.
* A balanced test set is generated using your labelled training data.
* High accuracy generally implies good **F1 Score** and **AUC** (Area Under the Curve).

<br />

### Video walkthrough

Now you can continue reading this detailed step by step guide or watch this video walkthrough (present also in the [Getting started](/quickstart) guide) on how to create datasets, training models and predict outcomes within MathFi.ai platform.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/nDPTjuxrdww?rel=0" title="Training walkthrough" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

<br />

<br />

### Dataset creation

<br />

<Note>Before proceeding, ensure your dataset CSV is formatted correctly by following [CSV Format Guide](/guides/input-csv-creation)</Note>

<br />

1. **Login to the MathFi.ai dashboard.**

2. **Click "Datasets"** in the top-right menu.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/datasets-open.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=e022d19b40347a9a39ec59d1ff611edf" alt="Step 1 - Datasets Menu" width="1378" height="249" data-path="images/guides/datasets-open.png" />

3. **Click "+ Create"** to start a new dataset.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/datasets-create.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=afebaa2e7257887741c4f92f773f22ac" alt="Step 2 - Create Dataset" width="1376" height="320" data-path="images/guides/datasets-create.png" />

4. **Enter a name** for your dataset.

5. **Set the number of buckets**: default is 20 (range: 4–100).

6. **Upload your labelled CSV file.**

7. **Click "Save"**.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/datasets-save.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=9b543b74e65bcab6ee033cbae5e0bd3c" alt="Step 3 - Save Dataset" width="1376" height="545" data-path="images/guides/datasets-save.png" />

<br />

After this, the dataset will start processing. This may take up to few minutes or hours depending on the size and complexity of the data.

<br />

### Model training

<br />

<Note>The dataset must have finished processing before attempting to train a model with it</Note>

<br />

1. Navigate to **"Trainings"** in the sidebar.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/trainings-open.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=f384e2813d0e803dfa77f0a478d772d8" alt="Step 4 - Open Trainings" width="1376" height="358" data-path="images/guides/trainings-open.png" />

2. Click **"Create"**.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/trainings-create.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=da1d9adda4a0bd5680cac8554456ae8f" alt="Step 5 - Create Training" width="1378" height="325" data-path="images/guides/trainings-create.png" />

3. Configure the training:

   * **Scaling Factor**: (default: 19, range: 8–499)
   * **Performance Threshold**: (value between 0 and 1)
   * Select your **dataset** from the dropdown.

   <br />

4. Click **"Save"**.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/trainings-save.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=6d163a6985d321513a04abc6e8c2dabd" alt="Step 6 - Save Training" width="1377" height="482" data-path="images/guides/trainings-save.png" />

<Note>The platform runs 4 algorithms in parallel and selects a new **champion model** if one outperforms the rest.</Note>

<br />

#### Understanding training results

* The accuracy reflects the performance on a **balanced, unseen 10% test set**.
* Logs and metrics are saved with the model.
* Further training with tuned hyperparameters can improve performance. See [Hyperparameter tuning guide](/guides/hyperparameter-tuning)

<br />

### Prediction running

<br />

<Note>Predictions can be run once training has been completed and the first champion model is created</Note>

<br />

1. Click **"Predictions"** in the left menu.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/predictions-open.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=192744b187015f2ec44891ad51163108" alt="Step 7 - Open Predictions" width="1378" height="460" data-path="images/guides/predictions-open.png" />

2. Click **"Create"**.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/predictions-create.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=ab939b37b42bd2aa27302b99b5621e1c" alt="Step 8 - Create Prediction" width="1380" height="373" data-path="images/guides/predictions-create.png" />

3. Select:

   * Your **original training dataset**
   * Your **batch prediction CSV** (see [CSV Format Guide](/guides/input-csv-creation) for instructions on how to create)

<br />

4. Click **"Save"**.

   <img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/predictions-save.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=86f5f054c471989766869c419d40e59e" alt="Step 9 - Save Prediction" width="1376" height="450" data-path="images/guides/predictions-save.png" />

#### Downloading results

Monitor progress on the `Predictions` listing page. Once finished, click **"Download"** to retrieve your prediction results.

<img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/predictions-download.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=c26742dd4c4a0465856a23f31fa58823" alt="Step 10 - Download Predictions" width="1377" height="376" data-path="images/guides/predictions-download.png" />

<br />

Results include **predicted labels** and their **probability scores**.

<img src="https://mintcdn.com/mathficast/vsPVxXb4l3VcjgSi/images/guides/predictions-result.png?fit=max&auto=format&n=vsPVxXb4l3VcjgSi&q=85&s=eb476aae34e53a930eb34a3a35720764" alt="Step 10 - Download Predictions" width="1914" height="903" data-path="images/guides/predictions-result.png" />

<br />

#### Recap

| Stage      | Description                                   |
| ---------- | --------------------------------------------- |
| Dataset    | Upload labelled CSV, set number of buckets    |
| Training   | Set scaling factor & threshold, train model   |
| Prediction | Upload unlabelled CSV, get prediction results |

See also: [Hyperparameter tuning](/guides/hyperparameter-tuning) to improve model performance, and real-world examples in [Healthcare](/use-cases/healthcare) and [Credit Card Approval](/use-cases/credit-card-approval).

***

### Regression use case

The MathFi.ai platform is mainly designed for classification. However, you can solve **regression** type prediction problems with high accuracy by converting continuous targets into discrete classes.

#### Example: Wind Turbine Power prediction

1. Bin the output range (e.g., 0–2000 kW) into classes:
   * 0–200 kW → Class 1
   * 200–400 kW → Class 2
   * ...
   * 1800–2000 kW → Class 10

2. Train a multi-class classifier on these buckets.

3. To increase granularity:
   * Take the winning bin (e.g., 400–600 kW)
   * Divide it further (e.g., 10 × 20 kW sub-bins)
   * Train again for finer predictions.

***

### Troubleshooting NaN predictions

Predictions may occasionally return NaN probability values when the number of buckets is insufficient for the model to make a confident prediction. To resolve this, create a new dataset with a higher number of buckets and retrain. If NaN values persist, your training dataset may need more labelled samples.
