ComeçarComece de graça

Visualizing transformed radially separable data

In this exercise you will transform the radially separable dataset you created earlier in this chapter and visualize it in the x1^2-x2^2 plane. As a reminder, the separation boundary for the data is the circle x1^2 + x2^2 = 0.64(radius = 0.8 units). The dataset has been loaded for you in the dataframe df.

Este exercício faz parte do curso

Support Vector Machines in R

Ver curso

Instruções do exercício

  • Transform data to x1^2-x2^2 plane.
  • Visualize data in terms of transformed coordinates.
  • Add a boundary that is linear in terms of transformed coordinates.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

#transform data
df1 <- data.frame(x1sq = df$x1^2, x2sq = ___, y = df$y)

#plot data points in the transformed space
plot_transformed <- ggplot(data = df1, aes(x = ___, y = x___, color = y)) + 
    geom_point()+ guides(color = "none") + 
    scale_color_manual(values = c("red", "blue"))

#add decision boundary and visualize
plot_decision <- plot_transformed + geom_abline(slope = -1, intercept = ___)
plot_decision
Editar e executar o código