시작하기무료로 시작하기

What are the coefficients?

To get a good feel for the difference between fitted model parameters and hyperparameters, we are going to take a closer look at those fitted parameters: in our simple linear model, the coefficients. The dataset breast_cancer_data has already been loaded for you and the linear model call was run as in the previous lesson, so you can directly access the object linear_model.

In our linear model, we can extract the coefficients in the following way: linear_model$coefficients. And we can visualize the relationship we modeled with a plot.

Remember, that a linear model has the basic formula: y = x * slope + intercept

이 연습은 강의의 일부입니다

Hyperparameter Tuning in R

강의 보기

연습 안내

  • Explore the coefficients of the linear_model in the console.
  • Plot the regression line with ggplot2.
  • Assign the correct coefficients to slope and intercept.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

library(ggplot2)

# Plot linear relationship.
ggplot(data = breast_cancer_data, 
        aes(x = symmetry_mean, y = concavity_mean)) +
  geom_point(color = "grey") +
  ___(slope = ___$___[___], 
      intercept = ___$___[___])
코드 편집 및 실행