无法从机器学习的 senddex 教程中理解有关线性回归的部分代码

Unable to understand a part of code about Linear Regression from sentdex tutorials on machine learning

正在关注 youtube 中的 Sentdex 机器学习教程。在第 5 部分他这样做了

forecast_out = int(math.ceil(0.01*len(df)))
print(forecast_out)

df['label'] = df[forecast_col].shift(-forecast_out)

X = np.array(df.drop(['label'],1))
X = preprocessing.scale(X)
X = X[:-forecast_out]
X_lately = X[-forecast_out:]


df.dropna(inplace=True)
y = np.array(df['label'])
y = np.array(df['label'])

我完全不知道他在这里想做什么。在 int(math.ceil(0.01*len(df))) 中,他试图获得他想要找到预测的天数。在那之后,他做了 df[forecast_col].shift(-forecast_out) 而我在那之后什么也做不了。

这里没有足够的信息,但如果这是一个时间序列预测问题,那么我认为 df[forecast_col].shift(-forecast_out) 将预测列向上移动 'forecast_out' 天数,以便特定日期的标签列将是您需要预测的数字(即从未来转移的数字)。