Get startedGet started for free

Defining the forecasting models

As a data science consultant, you've been tasked with predicting US hourly electricity demand. Before diving into training and testing, you first need to define your machine learning models: ElasticNet, KNeighborsRegressor, and MLPRegressor. Then, you'll initialize the MLForecast object with key parameters.

To capture temporal dependencies, you'll regress the time series against the last 24 lags and include seasonal features like the day of the week and hour of the day. This setup will form the foundation for building robust forecasts.

This exercise is part of the course

Designing Forecasting Pipelines for Production

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import necessary libraries
from sklearn.linear_model import ____  # ElasticNet regression model
from sklearn.neighbors import ____  # k-Nearest Neighbors regressor
from sklearn.neural_network import ____  # Multi-layer Perceptron regressor

# Define machine learning models for forecasting
ml_models = {"knn": ____(), "mlp": ____(), "enet": ____()} 
Edit and Run Code