Xử lý dữ liệu không dừng
Trong bài tập này, bạn sẽ tiếp tục trực quan hóa mức biến thiên của điểm số mô hình, nhưng lần này là với dữ liệu có thống kê thay đổi theo thời gian.
Một đối tượng mô hình Linear regression được lưu trong model, đối tượng cross-validation trong cv, và dữ liệu trong X và y.
Bài tập này là một phần của khóa học
Machine Learning cho Dữ liệu Chuỗi thời gian bằng Python
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.
# Pre-initialize window sizes
window_sizes = [25, 50, 75, 100]
# Create an empty DataFrame to collect the stores
all_scores = ____(index=times_scores)
# Generate scores for each split to see how the model performs over time
for window in window_sizes:
# Create cross-validation object using a limited lookback window
cv = ____(n_splits=100, max_train_size=window)
# Calculate scores across all CV splits and collect them in a DataFrame
this_scores = ____(____, ____, ____, cv=cv, scoring=my_pearsonr)
all_scores['Length {}'.format(window)] = this_scores