0
まず、Xとyを定義しましたが、その一部を以下に示します。学習曲線をテストデータを一定に保ちます
#First separation of test data
X_train_prev, X_test_prev, y_train_prev, y_test_prev = train_test_split(X, y, test_size = 0.2)
#storing test and training error in dictionary as a function of decreasing test size
array = np.arange(0.01,0.9,0.025)
dicto = {}
for i in array:
X_train, _, y_train, _ = train_test_split(X_train_prev, y_train_prev, test_size = i)
clf.fit(X_train,y_train)
#use the previous test data...
test = clf.score(X_test_prev, y_test_prev)
train = clf.score(X_train, y_train)
dicto[i] = test, train
print(dicto)
私の学習曲線は、次のようになります:
from sklearn import svm
from sklearn.cross_validation import train_test_split
X = array([[11.8, 0., 3.4, 5.7, 0., 5.7],
[33.4, 6.8, 0., 5.7, 0., 5.7],
[33.4, 6.8, 0., 5.7, 0., 5.7])
y = array([ 1., 1., 0.])
私は以下のコードで作成した辞書と学習曲線をプロットしています
問題は、テストエラーが独立していることですモデル上にこれはどのように可能ですか?テストエラーが訓練されたモデルに依存するようにコードを変更するにはどうすればよいですか?
あなたは完全に働くスニペットを提供できますか、理想的にはsklearnで提供されるサンプルデータセット –
私の投稿を編集しました。あなたのコメントmichael_j_ward – Papie
のおかげで、スニペットを働かせて、私はコピーし、スニペットをPythonに貼り付けて、あなたが経験している結果を得ることができるはずです。私はすぐにエラーが発生しないので、分類器の設定やプロット関数のいずれかにある可能性があります。問題を診断できるように、作業用のスニペット全体が必要です。 –