📜  如何用给定的阈值训练 Longistic 回归 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:13.133000             🧑  作者: Mango

代码示例1
from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(random_state = 2)
clf.fit(X_train,y_train)
# y_pred = clf.predict(X_test)  # default threshold is 0.5
y_pred = (clf.predict_proba(X_test)[:,1] >= 0.3).astype(bool) # set threshold as 0.3