【发布时间】:2021-09-12 18:46:02
【问题描述】:
这里是sklearn.ensemble.RandomForestClassifier.fit() 的帮助。目前尚不清楚当 X 和 y 按标签排序时是否会出现问题。我的初步测试表明 X 和 y 是否排序无关紧要。
知道实现的人可以确认我的结论是否正确吗?
Help on class RandomForestClassifier in module sklearn.ensemble._forest:
class RandomForestClassifier(ForestClassifier)
...
| Build a forest of trees from the training set (X, y).
|
| Parameters
| ----------
| X : {array-like, sparse matrix} of shape (n_samples, n_features)
| The training input samples. Internally, its dtype will be converted
| to ``dtype=np.float32``. If a sparse matrix is provided, it will be
| converted into a sparse ``csc_matrix``.
|
| y : array-like of shape (n_samples,) or (n_samples, n_outputs)
| The target values (class labels in classification, real numbers in
| regression).
【问题讨论】:
-
通过打乱数据来破坏这种排序总是是个好主意,因为非常普遍的原因与 RF 无关;在Data shuffling for Image Classification、Confusion Matrix : Shuffle vs Non-Shuffle 和Cross_val_score is not working with roc_auc and multiclass 中查看自己的答案
-
我对射频特别感兴趣。我想了解 RF 的正常工作是否需要随机有序输入或排序输入仍然同样有效。您提到的所有链接都不能证明
sklearn.ensemble.RandomForestClassifier.fit需要对输入进行改组。 -
因为它本身并不像已经暗示的那样;但是还有许多其他原因可以让您这样做。这就是为什么在几乎所有 ML 管道中都经常包含改组的原因,无论使用何种算法。
-
另一方面,究竟你在问这里吗?当数据按标签排序时,有什么理由相信算法可能有问题?您的帖子中没有任何内容可以远程暗示可能是这种情况,那么您需要什么样的确认?
-
为什么这个问题被关闭了?我认为这是一个非常明确的问题。并且已经有了答案。以不清楚的方式结束这个问题是没有意义的。
标签: scikit-learn random-forest