'Get prediction confidence through Decision Tree Regression in sklearn
Is there a way I can attach some sort of confidence with my predictions from Decision Tree Regression output in python?
from sklearn.tree import DecisionTreeRegressor
dt = DecisionTreeRegressor(random_state=0, criterion="mae")
dt_fit = dt.fit(X_train, y_train)
y_pred = dt_fit.predict(X_test)
Solution 1:[1]
you can use dt_fit.predict_proba(X_test)
Solution 2:[2]
df_fit.predict_prob() is for classification problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | YUNJIA ZHANG |
Solution 2 | Bhushan |