3

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

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

Thanks everyone

  • Do you need the exact same dataset, or just something similar? – tomp Jan 18 '16 at 23:44
  • Just something similar. – Kened Yassine Jan 19 '16 at 0:04
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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