3

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

I didn't find the dataset of two circles? Could you please help me find that?

2
  • 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

1 Answer 1

3

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()

enter image description here

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

n = 200;
step = 1/n;
radius = 0.5;
ratio = 0.4;

ang=0:step:2*pi; 
xp=radius*cos(ang);
yp=radius*sin(ang);

hold on;

% blue circle
idx = randsample(length([xp;yp]),n);
bluex = xp+(rand(length(xp),1)*radius/10)';
bluey = yp+(rand(length(yp),1)*radius/10)';
scatter(bluex(:,idx),bluey(:,idx),'b','o');

% red circle
idx = randsample(length([xp;yp]),n);
redx = ratio*xp+(rand(length(xp),1)*radius/10)';
redy = ratio*yp+(rand(length(yp),1)*radius/10)';
scatter(redx(:,idx),redy(:,idx),'r','+');

enter image description here

2
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.