fitrauto 함수를 사용한 머신러닝 모델에서 R-squared 및 Adjusted R-squared 확인하는 방법
조회 수: 2 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1505534/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1505539/image.png)
fitrauto 함수 예제를 따라하던 중 궁금한 점이 있어서 질문드립니다.
테스트 데이터의 경우, R-squared와 Adjusted R-squared를 직접 계산하여 확인 가능한데 학습 데이터에 대해서는 어떻게 계산하는지 모르겠습니다. 지원하는 함수가 따로 있나요?
댓글 수: 0
답변 (1개)
檮杌
2023년 10월 11일
테스트 데이터의 경우 R^2를 어떻게 계산하셨나요? 해당 방법을 Training 데이터에도 그대로 적용하면 될 것 같습니다.
아래는 예시입니다.
Calculating R-Squared
SST_Train = sum((carsTrain.MPG - mean(carsTrain.MPG)).^2);
SSE_Train = sum((predict(Mdl, carsTrain) - mean(carsTrain.MPG)).^2);
R_squared_Train = 1-SSE_Train/SST_Train
R_squared_Train = 0.1367
SST_Test = sum((carsTrain.MPG - mean(carsTest.MPG)).^2);
SSE_Test = sum((predict(Mdl, carsTest) - mean(carsTest.MPG)).^2);
R_squared_Test = 1-SSE_Test/SST_Test
R_squared_Test = 0.7800
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 모델 개발과 평가에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!