Getting started | API
How to train ML models
Trigger the training of a site’s ML forecast models
When you upload the generation or consumption data to a site, a set of preconfigured machine learning (ML) models is created. To start the training procedure of these models, you will need to provide a number of training parameters. Currently the following parameters are supported.
Site IDs site_ids
Specify a list of site IDs for which ML models will be trained.
Example: ["8fa9ef1d-4s89-4waf-8g52-b1aww743by47"]
Training set splits splits
Specify the starting and ending periods for the training data set splits.
-
Starting period
start_date
Specify the starting timestamp.
Example:"2022-01-01T00:00Z"
-
Ending period
end_date
Specify the ending timestamp.
Example:"2022-12-31T23:00Z"
Train models
import requests
api_key = "Your API key" # Set your API key
site_id = "a923653c-26f1-1b29-955d-ffde5d182276" # Set the site ID
payload = {
"site_ids": ["8fa9ef1d-4s89-4waf-8g52-b1aww743by47"],
"splits": [
{
"start_date": "2022-01-01T00:00Z",
"end_date": "2022-12-31T23:00Z"
},
{
"start_date": "2024-01-01T00:00Z",
"end_date": "2024-06-30T23:00Z"
}
]
}
url = f"https://api.rebase.energy/platform/v2/sites/{site_id}/models/train"
headers = {"Authorization": api_key, "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
response = response.json()