[英]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.