Nhận diện model drift
Bây giờ bạn sẽ vẽ điểm số của mô hình theo thời gian để trực quan hóa thời điểm drift xảy ra. Bằng cách thêm đường ngưỡng và các cửa sổ cuộn RMSE, bạn có thể thấy các đường lỗi phía sau cho thấy hiệu năng suy giảm.
Bộ dữ liệu fc_log với các giá trị trung bình trượt đã được tính sẵn, rmse_threshold, và Plotly dưới tên go đã được nạp sẵn cho bạn.
Bài tập này là một phần của khóa học
Thiết kế Pipeline Dự báo cho Môi trường Production
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
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()