你需要把代码提供的更清楚一些,这样更方便别人回答,比如你是用哪个库来做什么
make moons 和 make_circles 有什么用呢?
实际应用中的例子是什么?
不知道说的这两个函数是哪的函数,所以不太好回复。需要将问题描述的清晰一些。比如在什么情况下遇到的这个函数,是自定义的还是某个库里面的。
from sklearn.datasets import make_moons
feature,target = make_moons(n_samples=100,noise=0.05)
from matplotlib import pyplot
from pandas import DataFrame
df = DataFrame(dict(x=feature[:,0],y=feature[:,1],label=target))
colors={0:'red',1:'blue'}
fig,ax= pyplot.subplots()
grouped = df.groupby('label')
for key,group in grouped:
group.plot(ax=ax,kind='scatter',x='x',y='y',label=key,color=colors[key])
pyplot.show()
from sklearn.datasets import make_circles
feature,target = make_circles(n_samples=100,noise=0.05)
from matplotlib import pyplot
from pandas import DataFrame
df = DataFrame(dict(x=feature[:,0],y=feature[:,1],label=target))
colors={0:'green',1:'blue'}
fig,ax= pyplot.subplots()
grouped = df.groupby('label')
for key,group in grouped:
group.plot(ax=ax,kind='scatter',x='x',y='y',label=key,color=colors[key])
pyplot.show()
有make_moons 和 make_cricles ,他们最终展示的图形样式不一样。但是实际应用中是用来做什么的?