In July 2011 I moved to Harvard University to join the School of Engineering and Applied Sciences. My new web page is here.

This MATLAB function generates little two-dimensional datasets that are spirals of noisy data. They look like pinwheels, hence the name. They are just Gaussian data that has been rotated. You also get back the labels that tell you what arm each one belongs to.

Here is the idea:

This was generated from:

X = pinwheel(0.3, 0.3, 3, 1000, 0.25);
subplot(2,2,1);
plot(X(:,1), X(:,2), '.');
grid;
ylim([-2 2]);
xlim([-2 2]);
title('pinwheel(0.3, 0.3, 3, 1000, 0.25);');

X = pinwheel(0.1, 0.3, 5, 1000, 0.25);
subplot(2,2,2);
plot(X(:,1), X(:,2), '.');
grid;
ylim([-2 2]);
xlim([-2 2]);
title('pinwheel(0.1, 0.3, 5, 1000, 0.25);');

X = pinwheel(0.1, 0.2, 4, 1000, 0.5);
subplot(2,2,3);
plot(X(:,1), X(:,2), '.');
grid;
ylim([-2 2]);
xlim([-2 2]);
title('pinwheel(0.1, 0.2, 4, 1000, 0.25);');

X = pinwheel(0.1, 0.3, 2, 1000, 1);
subplot(2,2,4);
plot(X(:,1), X(:,2), '.');
grid;
ylim([-2 2]);
xlim([-2 2]);
title('pinwheel(0.1, 0.3, 2, 1000, 0.5);');

Here is the documentation:


 [features labels] = PINWHEEL( radial_std, tangential_std, num_classes,
                               num_per_class, rate )

 This function generates a "pinwheel" data set.  It has as many arms as
 classes.  It generates them by taking Gaussian distributions,
 stretching them and then rotating them appropriately.  The centers are
 equidistant around the unit circle.

 INPUT:
   - radial_std:     the standard deviation in the radial direction
   - tangential_std: the standard deviation in the tangential direction
   - num_classes:    how many arms and classes to generate
   - num_per_class:  how many of each class to generate
   - rate:           how many radians to turn per exp(radius)

 OUTPUT:
   - features: the 2d locations in space
   - labels:   the actual class labels

 Reasonable usage example:
  >> X = pinwheel(0.3, 0.3, 3, 1000, 0.25);
  >> plot(X(:,1), X(:,2), '.');

 Copyright: Ryan Prescott Adams, 2008
 This is released under the GNU Public License.
 http://www.gnu.org/licenses/gpl-2.0.txt

download pinwheel.m