RMSE 단계별 계산
이 연습 문제에서는 미리 만들어진 모델의 전반적인 "적합도(goodness-of-fit)"를 정량화하기 위해, 가장 널리 쓰이는 모델 품질 지표 중 하나인 RMSE를 단계별로 계산해 볼 거예요.
사전 로드된 x_data와 y_data에서 시작해, 미리 정의된 모델링 함수 model_fit_and_predict()를 사용하세요.

이 연습은 강의의 일부입니다
Python으로 배우는 선형 모델 입문
연습 안내
model_fit_and_predict(x_data, y_data)로부터y_model값을 계산하세요.y_model과y_data의 차이를residuals로 계산하세요.np.sum()과np.square()를 사용해RSS를 구하고,len(residuals)로 나누어MSE를 얻으세요.MSE에np.sqrt()를 적용해RMSE를 계산하고, 모든 결과를 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Build the model and compute the residuals "model - data"
y_model = model_fit_and_predict(x_data, y_data)
residuals = ____ - ____
# Compute the RSS, MSE, and RMSE and print the results
RSS = np.____(np.____(residuals))
MSE = ____/len(residuals)
RMSE = np.____(____)
print('RMSE = {:0.2f}, MSE = {:0.2f}, RSS = {:0.2f}'.format(RMSE, MSE, RSS))