컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
오프백 평가
랜덤 포리스트에는 검증 데이터 세트가 필요하지 않습니다. 대부분의 랜덤 포리스트는 OOB 평가 (OOB 평가)라는 기법을 사용하여 모델의 품질을 평가합니다. OOB 평가는 학습 세트를 교차 검증의 테스트 세트인 것처럼 취급합니다.
앞서 설명한 대로 랜덤 포레스트의 각 결정 트리는 일반적으로 학습 예시의 약 67% 로 학습됩니다. 따라서 각 결정 트리는 학습 예시의 약 33% 를 보지 못합니다. OOB 평가의 핵심 개념은 다음과 같습니다.
- 학습 세트에서 랜덤 포레스트를 평가합니다.
- 각 예시의 경우 학습 중에 예시를 보지 못한 결정 트리만 사용합니다.
다음 표는 6개의 예시로 학습된 결정 트리 3개가 있는 랜덤 포레스트의 OOB 평가를 보여줍니다. 예, 이는 Bagging 섹션의 테이블과 동일합니다. 이 표에는 OOB 평가 중에 어떤 예시와 함께 어떤 결정 트리가 사용되는지 표시됩니다.
표 7. OOB 평가 - 숫자는 특정 예시의 학습 중에 특정 학습 예시가 사용된 횟수를 나타냅니다.
|
학습 예시 |
OOB 평가의 예 |
|
#1 | #2 | #3 | #4 | #5 | #6 |
|
원본 데이터 세트 |
1 | 1 | 1 | 1 | 1 | 1 |
결정 트리 1 |
1 | 1 | 0 | 2 | 1 | 1 |
#3 |
결정 트리 2 |
3 | 0 | 1 | 0 | 2 | 0 |
2번, 4번, 6번 |
결정 트리 3 |
0 | 1 | 3 | 1 | 0 | 1 |
#1 및 #5 |
표 7에 표시된 예시에서 학습 예시 1의 OOB 예측은 결정 트리 3으로 계산됩니다 (결정 트리 1과 2가 학습에 이 예시를 사용했기 때문). 실제로 적절한 크기의 데이터 세트와 몇 개의 결정 트리가 있는 경우 모든 예시에는 OOB 예측이 있습니다.
YDF에서는 모델이 compute_oob_performances=True
로 학습된 경우 학습 로그에서 OOB 평가를 사용할 수 있습니다.
OOB 평가는 랜덤 포레스트 모델의 순열 변수 중요도를 계산하는 데도 효과적입니다. 변수 중요도에서 배열 변수 중요도는 이 변수가 셔플될 때 모델 품질의 감소를 측정하여 변수의 중요도를 측정한다고 기억하세요. 랜덤 포레스트 'OOB 순환 변수 중요도'는 OOB 평가를 사용하여 계산된 순환 변수 중요도입니다.
YDF에서 모델이 compute_oob_variable_importances=True
로 학습된 경우 OOB 순열 변수 중요도는 학습 로그에서 사용할 수 있습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-02-25(UTC)
[null,null,["최종 업데이트: 2025-02-25(UTC)"],[[["\u003cp\u003eRandom forests utilize out-of-bag (OOB) evaluation, eliminating the need for a separate validation dataset by treating the training set as a test set in a cross-validation-like approach.\u003c/p\u003e\n"],["\u003cp\u003eOOB evaluation leverages the fact that each decision tree in the forest is trained on approximately 67% of the training data, allowing the remaining 33% to be used for evaluation, similar to a test set.\u003c/p\u003e\n"],["\u003cp\u003eDuring OOB evaluation, predictions for a specific example are generated using only the decision trees that did not include that example in their training process.\u003c/p\u003e\n"],["\u003cp\u003eYDF provides access to OOB evaluation metrics and OOB permutation variable importances within the training logs, offering insights into model performance and feature relevance.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\nOut-of-bag evaluation\n---------------------\n\nRandom forests do not require a validation dataset. Most random forests use a\ntechnique called **out-of-bag-evaluation** (**OOB** **evaluation**) to evaluate\nthe quality of the model. OOB evaluation treats the training set as if it were\non the test set of a cross-validation.\n\nAs explained earlier, each decision tree in a random forest is typically trained\non \\~67% of the training examples. Therefore, each decision tree does not see\n\\~33% of the training examples. The core idea of OOB-evaluation is as follows:\n\n- To evaluate the random forest on the training set.\n- For each example, only use the decision trees that did not see the example during training.\n\nThe following table illustrates OOB evaluation of a random forest with 3\ndecision trees trained on 6 examples. (Yes, this is the same table as in\nthe Bagging section). The table shows which decision tree is used with\nwhich example during OOB evaluation.\n\n**Table 7. OOB Evaluation - the numbers represent the number of times a given\ntraining example is used during training of the given example**\n\n| | Training examples |||||| Examples for OOB Evaluation |\n| | #1 | #2 | #3 | #4 | #5 | #6 | |\n| original dataset | 1 | 1 | 1 | 1 | 1 | 1 |\n| decision tree 1 | 1 | 1 | 0 | 2 | 1 | 1 | #3 |\n| decision tree 2 | 3 | 0 | 1 | 0 | 2 | 0 | #2, #4, and #6 |\n| decision tree 3 | 0 | 1 | 3 | 1 | 0 | 1 | #1 and #5 |\n|------------------|----|----|----|----|----|----|-----------------------------|\n\nIn the example shown in Table 7, the OOB predictions for training example 1\nwill be computed with decision tree #3 (since decision trees #1 and #2 used\nthis example for training). In practice, on a reasonable size dataset and\nwith a few decision trees, all the examples have an OOB prediction. \nYDF Code\nIn YDF, the OOB-evaluation is available in the training logs if the model is trained with `compute_oob_performances=True`.\n\nOOB evaluation is also effective to compute permutation variable importance for\nrandom forest models. Remember from [Variable\nimportances](/machine-learning/decision-forests/variable-importances) that\npermutation variable importance measures the importance of a variable by\nmeasuring the drop of model quality when this variable is shuffled. The random\nforest \"OOB permutation variable importance\" is a permutation variable\nimportance computed using the OOB evaluation. \nYDF Code\nIn YDF, the OOB permutation variable importances are available in the training logs if the model is trained with `compute_oob_variable_importances=True`."]]