नॉन-स्टेशनैरिटी को ध्यान में रखना
इस अभ्यास में, आप फिर से मॉडल स्कोर में होने वाले बदलावों को विज़ुअलाइज़ करेंगे, लेकिन अब ऐसे डेटा के लिए जिसकी सांख्यिकीय विशेषताएँ समय के साथ बदलती हैं।
model में Linear regression मॉडल ऑब्जेक्ट का एक इंस्टेंस दिया गया है, cv में एक cross-validation ऑब्जेक्ट, और डेटा X तथा y में है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Time Series Data के लिए Machine Learning
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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