
実現したいこと
plot_decision_regionsを使い、データ分類のグラフを出力する
前提
機械学習を用いて領域分類した結果を可視化するプログラムを書いています。
グラフを出力する段階でエラーが出てしまいます。
何がご教授いただければ幸いです。
発生している問題・エラーメッセージ
TypeError Traceback (most recent call last)
<ipython-input-398-3f46b22e1377> in <cell line: 17>()
15
16 # Plotting decision regions
---> 17 plot_decision_regions(X, y, clf=svm, legend=2)
18
19 # Adding axes annotations
1 frames
/usr/local/lib/python3.10/dist-packages/matplotlib/axes/_base.py in axis(self, arg, emit, **kwargs)
2125 self.set_ylim(ymin, ymax, emit=emit, auto=yauto)
2126 if kwargs:
-> 2127 raise _api.kwarg_error("axis", kwargs)
2128 return (*self.get_xlim(), *self.get_ylim())
2129
TypeError: axis() got an unexpected keyword argument 'y_min'
該当のソースコード
from mlxtend.plotting import plot_decision_regions
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.svm import SVC
iris = datasets.load_iris()
X = iris.data[:, [0, 2]]
y = iris.target
svm = SVC(C=0.5, kernel='linear')
svm.fit(X, y)
plot_decision_regions(X, y, clf=svm, legend=2)
plt.xlabel('sepal length [cm]')
plt.ylabel('petal length [cm]')
plt.title('SVM on Iris')
plt.show()
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
mlxtend
0.14.0

0 コメント