简体   繁体   English

如何在python中使用随机森林预测多个类?

[英]How to predict more than one class with random forest in python?

How can I predict more than one class with random forest in python? 如何在python中使用随机森林预测多个类?

I am familiar with the get probability, but how can I know to which class each probability belongs? 我对获取概率很熟悉,但是我怎么知道每个概率属于哪个类别?

According to the documentation predict returns an array of predicted classes you can use to get the most likely class for each sample. 根据文档, predict返回一系列预测类,您可以使用它们来获取每个样本最可能的类。

If you want to use predict_proba to get the probability for all classes, you need to look at the classes_ attribute. 如果要使用predict_proba获取所有类的概率,则需要查看classes_属性。 This lists the classes in the same order that predict_proba returned its probabilities. 这以与predict_proba返回其概率相同的顺序列出了这些类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM