# TwoCircles Dataset

I am analysing an article dealing with: "Semi-supervised Graph Clustering: A Kernel Approach" I need to reproduce figure 1 on page 7. http://www.cs.utexas.edu/users/inderjit/public_papers/kernel_icml.pdf

• Do you need the exact same dataset, or just something similar?
– tomp
Jan 18, 2016 at 23:44
• Just something similar. Jan 19, 2016 at 0:04

You could generate a similar dataset in Python using scikit-learn's make_circles function.

``````from sklearn.datasets import make_circles
import matplotlib.pyplot as plt

n_samples = 400

samples, labels = make_circles(n_samples=n_samples, factor=.3, noise=.05)

bluecircle = samples[labels==0]
redcircle  = samples[labels==1]

plt.figure()
plt.scatter(bluecircle[:, 0], bluecircle[:, 1], c='b', marker='o', s=10)
plt.scatter(redcircle[:, 0], redcircle[:, 1], c='r', marker='+', s=30)
plt.show()
``````

In Matlab you could could generate the dataset with something like:

``````n = 200;
step = 1/n;
ratio = 0.4;

ang=0:step:2*pi;

hold on;

% blue circle
idx = randsample(length([xp;yp]),n);
scatter(bluex(:,idx),bluey(:,idx),'b','o');

% red circle
idx = randsample(length([xp;yp]),n);
scatter(redx(:,idx),redy(:,idx),'r','+');
``````

• Thanks that helped me a lot, how could I generate the same graph with Matlab ? Jan 19, 2016 at 1:10
• I've updated the answer with an example in Matlab
– tomp
Jan 20, 2016 at 2:37