在两个圆圈之间获取一些样本
我想在两个圆圈之间获得200个样本,仅限于半径4和9,而在两个圆之间,
我尝试使用sklearn.datasets.make_circles的两个圆圈中的其他200个样本,但我不知道如何完全限制它们之间的这些样本radii
from sklearn.datasets import make_circles
n_samples = (200,200)
noise = (0.2,0.2)
features, labels = make_circles(n_samples=n_samples, noise=noise, factor = 0.000001)
#center of circles = (1.5,0)
for i in range(len(features)):
features[i][0]+= 1.5
df = pd.DataFrame(dict(x=features[:,0], y=features[:,1], label=labels))
grouped = df.groupby('label')
colors = {0:'red', 1:'blue'}
fig, ax = plt.subplots(figsize=(5, 5))
for key, group in grouped:
group.plot(ax=ax, kind='scatter', x='x', y='y', marker='.', label=key, color=colors[key])
I want to get 200 samples between two circles limited to radii 4 and 9, and another 200 samples between two circles limited to radii 0 and 6
I tried with sklearn.datasets.make_circles but I do'nt know how to exactly limited them between those radii
from sklearn.datasets import make_circles
n_samples = (200,200)
noise = (0.2,0.2)
features, labels = make_circles(n_samples=n_samples, noise=noise, factor = 0.000001)
#center of circles = (1.5,0)
for i in range(len(features)):
features[i][0]+= 1.5
df = pd.DataFrame(dict(x=features[:,0], y=features[:,1], label=labels))
grouped = df.groupby('label')
colors = {0:'red', 1:'blue'}
fig, ax = plt.subplots(figsize=(5, 5))
for key, group in grouped:
group.plot(ax=ax, kind='scatter', x='x', y='y', marker='.', label=key, color=colors[key])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SET
因子
make_circles的参数
与圆的半径比率,并按外圆的半径扩展点。Set
factor
parameter ofmake_circles
to the ratio of radii of the circles and scale the points by the radii of the outer circle.