BaşlayınÜcretsiz Başlayın

Create a decision boundary

The dataset you created in the previous exercise is available to you in the dataframe df (recall that it consists of two uniformly distributed variables x1 and x2, lying between 0 and 1). In this exercise you will add a class variable to that dataset. You will do this by creating a variable y whose value is -1 or +1 depending on whether the point (x1, x2) lies below or above the straight line that passes through the origin and has slope 1.4.

Bu egzersiz

Support Vector Machines in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a new column y in the dataframe df with the following specs:
  • y = -1 if x2 < 1.4*x1
  • y = 1 if x2 > 1.4*x1

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

#classify data points depending on location
df$y <- factor(ifelse(df$___ - ___*df$___ < 0, -1, 1), 
    levels = c(-1, 1))
Kodu Düzenle ve Çalıştır