from sklearn ensemble import randomforestclassifier rf randomforestclassifier(n_estimators= random_state= max_features= rf fit(x_trainy_trainrandomforestclassifier has predict_probabut not decision_function precision_rfrecall_rfthresholds_rf precision_recall_curvey_testrf predict_proba(x_test)[: ]plt plot(precisionrecalllabel="svc"plt plot(precision[close_zero]recall[close_zero]' 'markersize= label="threshold zero svc"fillstyle="none" =' 'mew= plt plot(precision_rfrecall_rflabel="rf"close_default_rf np argmin(np abs(thresholds_rf )plt plot(precision_rf[close_default_rf]recall_rf[close_default_rf]'^' =' 'markersize= label="threshold rf"fillstyle="none"mew= plt xlabel("precision"plt ylabel("recall"plt legend(loc="best"figure - comparing precision recall curves of svm and random forest from the comparison plot we can see that the random forest performs better at the extremesfor very high recall or very high precision requirements around the middle (approximately precision= )the svm performs better if we only looked at the -score to compare overall performancewe would have missed these subtleties the -score only captures one point on the precision-recall curvethe one given by the default thresholdevaluation metrics and scoring