Quantcast
Channel: Machine Learning
Viewing all articles
Browse latest Browse all 62921

Stupid question about generating a dataset

$
0
0

This is from the caltech course. I am having trouble figuring out how to generate this dataset.

"In this problem you will create your own target function f and data set D to see how the Perceptron Learning Algorithm works. Take d = 2 so you can visualize the problem, and choose a random line in the plane as your target function f (do this by taking two random uniformly distributed points on [−1, 1] × [−1, 1] and taking the line passing through them), where one side of the line maps to +1 and the other maps to −1. Choose the inputs xn of the data set as random points in the plane, and evaluate the target function on each xn to get the corresponding output yn"

In R, x1 = runif(100, -1, 1) x2 = runif(100, -1, 1) point1 = runif(2, -1, 1) point2 =runif(2, -1, 1)

Now how can I draw a line between these 2 points and mark everything on the left side as -1? I am probably over thinking this but I am beat.

submitted by randomevent827
[link] [2 comments]

Viewing all articles
Browse latest Browse all 62921

Trending Articles