Gianni Spear
Gianni Spear

Reputation: 7924

Increase radius in make_circles method of sklearn

In Python sklearn is possible to create a circles dataset in a box [-1,1]. I am wondering if it's possible to increase the radius of the circles, for example inside a box of [-5, 5] or [-10, 10]

from sklearn import datasets
X, l = datasets.make_circles(n_samples=1000,
                                 shuffle=True,
                                 noise=0.08,
                                 random_state=42,
                                 factor=0.8)

Upvotes: 3

Views: 372

Answers (1)

sacuL
sacuL

Reputation: 51335

You can simply multiply the circles by the radius you want. For example, for a radius of 5:

X5 = X*5

plt.scatter(X[:,0], X[:,1], label = "original")
plt.scatter(X5[:,0], X5[:,1], label = "radius=5")
plt.legend()
plt.show()

enter image description here

Upvotes: 3

Related Questions