mlcourse.ai
mlcourse.ai copied to clipboard
fix OOB error description
OOB is actually the mean prediction error on each training sample xᵢ, using only the trees that did not have xᵢ in their bootstrap sample.
здравствуйте! пролейте свет, пожалуйста, на такой вопрос... если в определении out-of-bag оценки сказано, что это доля верных ответов деревьев для тех объектов, на которых они не обучались, то почему sklearn делит в итоге на ВСЕ объекты?
возьмем простой, как пять копеек, то есть объектов в выборке (0, 1, 0, 1, 1), пример и обучим на нем лес из трех деревьев... получим (причем, и самодельный, и из sklearn-а) такой ответ леса (0, 1, 0, 1, 0)
sklearn дает OOB-оценку, равную 0.4... в данном случае, кроме как делением 2 на 5 такое число не получается! теперь смотрим, как обучался самодельный лес... 2й и 3й объект из выборки побывали во ВСЕХ трех деревьях! на первом объекте ошиблось только одно дерево, на последнем - все... в итоге, лес правильно предсказал четыре объекта и ошибся только в пятом
я считаю самодельную оценку, как 2/3 (верные 1й+4й объект, деленные на 1й+4й+5й), а sklearn, получается, делит 2 верных out-of объекта на все 5
hello! wiki OOB definition says: "OOB error is the mean prediction error on each training sample xi, using only the trees that did not have xi in their bootstrap sample"... but why does sklearn
divide true predicted OOB-objects by all the sample' objects count and how should I calculate it?
for example... let's consider that we have only 5 objects in the sample and they are: (0, 1, 0, 1, 1)
we build a random forest of 3 trees and train it on this sample, get the forecast: (0, 1, 0, 1, 0)
2nd and 3rd objects take part in all bootstrapped samples! so we don't have to take them into account
1st and 4th objects have been predicted correctly by trees that were not trained on them...
thus... OOB should be 2/3 but sklearn
gives a result of 2/5