Convert into Dummy Variables

This tutorial walks you through creating a price forecast model with dummy variables


Tutorial Overview

In this tutorial, you will create and deploy a Linear Regression price model that uses dummy variables for each hour of the day as features. The resulting forecast will be generated every hour on an ongoing basis.

Create your NoTS

For this tutorial, you will leverage the client library to create your NoTS. This NoTS will use a Linear Regression model with hour of day features encoded as dummy variables. Your graph will forecast the day-ahead locational marginal price (DA LMP) for the DLAP PGAE-APND price node. We will be using the Yes Energy DataSignals API to access historical price data.


Model Performance

Note that the model we are using in this tutorial is not optimized. The goal of this tutorial is to show you how to create and deploy a price forecasting model with dummy variables. We do not recommend using this model in production.

Client Library

To create the NoTS in the client library, you can use the following code.

import myst
import numpy as np
from myst.connectors.model_connectors import linear_regression
from myst.connectors.operation_connectors import get_dummies
from myst.connectors.source_connectors import time_trends
from myst.connectors.source_connectors import yes_energy


# Create a new project.
project = myst.Project.create(title="My Project")

# Create an hour of day time series from a time trends source.
time_trends_source = project.create_source(
    title="Time Trends",
hour_of_day_time_series = time_trends_source.create_time_series(
    title="Hour of Day",

# Create the get dummies operation.
get_dummies_operation = project.create_operation(
    title="Dummy Hour Of Day",
get_dummies_operation.create_input(hour_of_day_time_series, group_name=get_dummies.GroupName.OPERANDS)

# Create a time series for each of the hour of day dummies.
dummy_hour_of_day_time_series = [
        title=f"Hour of Day ({index})", sample_period=myst.TimeDelta("PT1H"), label_indexer=index
    for index in range(24)

# Create a DLAP time series using a Yes Energy source.
yes_energy_source = project.create_source(
    title="Yes Energy",
            yes_energy.YesEnergyItem(datatype="DALMP", object_id=20000004194)  # CAISO DLAP PGAE - APND
dalmp_time_series = yes_energy_source.create_time_series(
    title="Historical DALMP",

# Create a linear regression model.
model = project.create_model(title="DALMP Model", connector=linear_regression.LinearRegression())

# Add the time series as inputs to the model.
for time_series in dummy_hour_of_day_time_series:
    model.create_input(time_series, group_name=linear_regression.GroupName.FEATURES)
model.create_input(dalmp_time_series, group_name=linear_regression.GroupName.TARGETS)

# Add a fit policy to the model.

# Create a time series with the model predictions.
forecast_time_series = model.create_time_series(
    title="DALMP Forecast", sample_period=myst.TimeDelta("PT1H")

# Add a run policy to the time series.

Deploy your NoTS

Once you've finished creating your NoTS, you can deploy your Project.

Web Application

To create a new Deployment, click the Deploy button in the top right corner of the Project Create page. Specify a title for your Deployment and then click the Deploy button.

Once you’ve deployed a project, your Model Fit Policy and Time Series Run Policy will begin to run according to their schedules. This means that your Model will be fitted once a day and your Time Series will be run every hour. Note that these Policies will run indefinitely, until you deactivate your Deployment.

To track and verify the results of your Deployment, navigate to the Project Monitor space by clicking on the Monitor tab at the top of the Project page. The results table shows a list of ongoing results that are being generated by your policy. You can refresh the table by clicking on the refresh icon.

Client Library

The code below will deploy your project, creating a first model fit and time series run immediately.

# Deploy the project.
project.deploy("My Deployment")

# Create ad hoc model fit job.
model_fit_job =

# Create ad hoc time series node run job.
time_series_run_job =


Tutorial Complete

You are now generating 48-hour forecasts for the DA LMP for DLAP PGAE-APND using a linear regression model with hour-of-day dummy variables. See the section on Query Time Series Data to learn more about how to query your stored forecasts.