python
1 2weights, params = [], [] 3 4for c in np.arange(-5, 5): 5 lr = LogisticRegression(C=10**c, random_state=0) 6 lr.fit(X_train_std, y_train) 7 weights.append(lr.coef_[1]) 8 params.append(10**c) 9 10weights = np.array(weights) 11plt.plot(params, weights[:, 0], 12 label='petal length') 13plt.plot(params, weights[:, 1], linestyle='--', 14 label='petal width') 15plt.ylabel('weight coefficient') 16plt.xlabel('C') 17plt.legend(loc='upper left') 18plt.xscale('log') 19# plt.savefig('./figures/regression_path.png', dpi=300) 20plt.show() 21コード
Traceback (most recent call last):
File "<ipython-input-43-8167fc659482>", line 4, in <module>
lr = LogisticRegression(C=10**c, random_state=0)
ValueError: Integers to negative integer powers are not allowed.
https://github.com/rasbt/python-machine-learning-book/blob/870838e4b95ab84e5777e2516677abe7f4969a50/code/ch03/ch03.ipynbのコードで実行できないところがあります。どうしたら実行できるようになりますか?
環境はanaconda 4.4.0を使っています
このCh3ではほかにも実行できないところや、マーカーのoがつかなかったりします。パソコン側に問題があるのでしょうか

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。