My goal is to tune the Classifier with probability predict_proba() < threshold
. Therefore, I need to get the threshold.
The problem is sklearn.metrics.PrecisionRecallDisplay
do not give me the threshold.
The code:
# Model Definition
rf_pipe_tuned = Pipeline(steps=[
('composer', composer),
('clf', RandomForestClassifier(
max_depth=17, max_features=9, min_samples_split= 7, n_estimators=27
))
])
# Model Training
rf_pipe_tuned.fit(X=X_train, y=y_train)
print("done")
def isolate():
display = PrecisionRecallDisplay.from_estimator(
estimator=rf_pipe_tuned, X=X_test, y=y_test, name="RandomForestClassifier",
pos_label="Attrited Customer"
)
_ = display.ax_.set_title("2-class Precision-Recall curve")
isolate()