当使用sklearn.tree中的DecisionTreeRegressor时,model.predict(x.head



我使用scikit learn DecisionTreeRegistor中的predict来尝试对一些三月疯狂统计数据进行建模,但我真的不知道我的结果意味着什么。

predict函数预测什么?它是对列中接下来发生的内容的估计,还是像求解矩阵一样求解?

from sklearn.tree import DecisionTreeRegressor
model = DecisionTreeRegressor(random_state=1)
model.fit(x, y)
#file_path_test = '/content/sample_data/MM_Prediction_21 - Sheet5.csv'
data_test = pd.read_csv(file_path)
x1 = data_test[features]
print(model.predict(x1.head()))

model.predict使用上面拟合的模型根据特征预测值。在这种特定情况下,它是一个DecisionTreeClassifier,它构建了一个Decision Tree。在预测阶段,使用构建的树来预测每个特征向量落在哪个叶节点上,并输出该叶节点中的类标签。

最新更新