我如何输出单个预测正确的概率?

How do i output the probability of a single prediction being correct?

我在 titanic 数据集上使用随机森林分类器。我不想输出乘客是否幸存,而是想输出乘客幸存的概率。这可能使用随机森林吗?

当前输出为 0 或 1。我希望响应为例如:87% 的生存机会。

我猜你使用的是.predict()方法?相反,您可以使用 .predict_proba()

Predict class probabilities for X.

https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.predict_proba