ComenzarEmpieza gratis

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

Este ejercicio forma parte del curso

Hyperparameter Tuning in R

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

library(ggplot2)

# Plot linear relationship.
ggplot(data = breast_cancer_data, 
        aes(x = symmetry_mean, y = concavity_mean)) +
  geom_point(color = "grey") +
  ___(slope = ___$___[___], 
      intercept = ___$___[___])
Editar y ejecutar código