chapter six

6 Forecasting your company’s monthly power usage

 

This chapter covers:

  • Using pandas to prepare your data for time-series analysis
  • Visualizing data in your Jupyter notebook
  • Using a neural network to generate forecasts from time-series data
  • Using AWS SageMaker’s DeepAR model to generate power consumption forecasts

Kiara works for a retail chain that has 48 locations around the country. She is an engineer, and every month her boss asks her how much energy they will consume in the next month. Kiara follows the procedure taught to her by the previous engineer in her role: She looks at how much energy they consumed in the same month last year, weights it by the number of locations they have gained or lost, and provides that number to her boss. Her boss sends this estimate to the facilities management teams to help plan their activities and then to Finance to forecast expenditure. The problem is that Kiara’s estimates are always wrong—sometimes by a lot.

As an engineer, she reckons there must be a better way to approach this problem. In this chapter, you’ll use SageMaker to help Kiara produce better estimates of her company’s upcoming power consumption.

6.1  What are you making decisions about?

6.1.1  Introduction to time-series data

6.1.2  Kiara’s time-series data: Daily power consumption

6.2  Load the Jupyter notebook for working with time-series data

6.3  Preparing the dataset: Charting time-series data

6.4  What is a neural network?

6.5  Getting ready to build the model

6.5.1  Upload a dataset to S3

6.5.2  Set up a notebook on SageMaker

6.6  The code

6.6.1  Part 1: Load and examine the data

6.6.2  Part 2: Get the data into the right shape

6.6.3  Part 3: Create training and test datasets

6.6.4  Part 4: Train the model

6.6.5  Part 5: Host the model

6.6.6  Part 6: Make predictions and plot results

6.7  Delete the endpoint and shut down your notebook instance

6.7.1  Deleting the endpoint