以下是我的代码
fullx=[]
fsx=[]
C=np.arange(0.01,10.01,0.5)
for i in C:
LR=LR(solver='liblinear',C=i,random_state=420)
fullx.append(cross_val_score(LR_,data.data,data.target,cv=10).mean())
x_embedded=SelectFromModel(LR_,norm_order=1).fit_transform(data,data.target)
fsx.append(cross_val_score(LR_, x_embedded,data.target,cv=10).mean())
print(max(fsx),C[fsx.index(max(fsx))])
plt.figure(figsize=(20,5))
plt.plot(C,fullx,label='full')
plt.plot(C,fsx,label='feature selection')
plt.xticks(threshold)
plt.legend()
plt.show()
以下是报错内容
AttributeError Traceback (most recent call last)
<ipython-input-115-6eb11e4df9b0> in <module>
1 fullx=[]
2 fsx=[]
----> 3 C=np.arange(0.01,10.01,0.5)
4
5
AttributeError: module 'matplotlib.pyplot' has no attribute 'arange'