File Exchange

image thumbnail

6 functions for generating artificial datasets

version (39.9 KB) by Jeroen Kools
6 parameterized functions that generate distinct 2D datasets for Machine Learning purposes.


Updated 23 Apr 2013

View License

* twospirals.m generates two classes representing two spirals
* clusterincluster.m generates two circular classes
* corners.m generates four classes, each corresponding to a corner shape pointing towards the center
* halfkernel.m generates two half ellipses, one inside the other
* crescentfullmoon.m generates one circular class and one larger crescent folded around it.
* outlier.m produces 2 large circular classes, and 2 smaller classes of outliers.

Inspired by the following StackOverflow question:

Cite As

Jeroen Kools (2021). 6 functions for generating artificial datasets (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Eebs Ebola

Mahmudul Hasan

Thanks a lot. It's really helpful. I used the data from twospirals.m to train a model. Is there any way I can get some test data to check the performance of my model?

Thanks for this, its very helpful

Alaa Othman

Good work. Thanks


I have a 2014a matlab, which has randi, not randintSo had to apply this patch to clusterincluster to get it going:
if ~isempty(z)
dist1 = r1 + randint(N1,1,3)/3 * r1 * w1;
dist1 = r1 + randi(3,[N1,1])/3 * r1 * w1;

Nejc Ilc

Surya Teja Chavali

Thanks a whole lot!

chang hsiung

thanks a lot, this will be very useful.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: DBSCAN

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!