简体   繁体   中英

What is model.predict(x.head) really predicting when using DecisionTreeRegressor from sklearn.tree?

I used predict from scikit-learn DecisionTreeRegressor to try to model some March Madness stats, but I don't really know what my result means.

What does the predict function predict? Is it an estimate of what comes next in the columns or is solving it like you would a matrix?

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 predicts values based on the feature using the model fitted above. In this specific case its a DecisionTreeClassifier which builds a Decision Tree . During prediction phase, tree built is used to predict on which leaf node each of the feature vector falls in and the class label in that leaf node is outputted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM