Identifying model drift
Now you'll plot the model scores over time to visualize when drift occurs. By adding the threshold line and RMSE rolling windows, you can see how the trailing error lines indicate performance degradation.
The fc_log dataset with calculated moving averages, rmse_threshold, and Plotly as go have been pre-loaded for you.
Den här övningen är en del av kursen
Designing Forecasting Pipelines for Production
Interaktiv övning med praktiskt arbete
Testa den här övningen genom att slutföra den här exempelkoden.
p = go.Figure()
# Add RMSE line
p.add_trace(go.Scatter(x=fc_log["forecast_start"], y=fc_log["____"],
mode='lines',
name='RMSE',
line=dict(color='royalblue', width=2)))
# Add the RMSE rolling windows for 7 and 14 days
p.add_trace(go.Scatter(x=fc_log["forecast_start"], y=fc_log["____"],
mode='lines',
name='7 Days MA',
line=dict(color='green', width=2)))
p.add_trace(go.Scatter(x=fc_log["forecast_start"], y=fc_log["____"],
mode='lines',
name='14 Days MA',
line=dict(color='orange', width=2)))
p.add_trace(go.Scatter(x=[fc_log["forecast_start"].min(), fc_log["forecast_start"].max()],
y=[rmse_threshold, rmse_threshold],
name="Threshold",
line=dict(color="red", width=2, dash="dash")))
# Add plot titles and show the plot
p.update_layout(title="Forecast Error Rate Over Time",
xaxis_title="____",
yaxis_title="____",
height=400,
title_x=0.5,
margin=dict(t=50, b=50, l=50, r=50))
p.show()