Generating two classes of points
Mostrar comentarios más antiguos
Hi,
I want to create a 100x2 feature vector set, with roughly half in class '1' and the rest in class '-1'. (As in, when I make a scatter plot of the x-y coordinates, the points should be almost linearly separable). I suppose rand or randn wouldn't help much here.
Thanks for your inputs.
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 20 de Feb. de 2018
No, but randperm() can help. Try this:
m = zeros(100, 2); % Initialize to all zero.
indexes = randperm(numel(m), numel(m)/2) % Get half of the indexes to change to 1.
m(indexes) = 1 % Change them to 1.
1 comentario
Deepayan Bhadra
el 20 de Feb. de 2018
Categorías
Más información sobre Random Number Generation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!