LoslegenKostenlos loslegen

Generating a complex dataset - part 1

In this exercise you will create a dataset that has two attributes x1 and x2, with x1 normally distributed (mean = -0.5, sd = 1) and x2 uniformly distributed in (-1, 1).

Diese Übung ist Teil des Kurses

Support Vector Machines in R

Kurs anzeigen

Anleitung zur Übung

  • Generate a data frame df with 1000 points (x1, x2) distributed as follows:
  • x1 - normally distributed with mean = -0.5 and std deviation 1.
  • x2 uniformly distributed in (-1, 1).

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

#number of data points
n <- ___

#set seed
set.seed(1)

#create dataframe
df <- data.frame(x1 = ___(n, mean = ___, ___ = 1), 
                 x2 = runif(n, ___ = ___, ___ = ___))
Code bearbeiten und ausführen