あるプログラムの一部分なのですが、
from sklearn.cross_validation import ShuffleSplit
ShuffleSplit(
n=len(X), n_iter=1, test_size=0.3, indices=True, random_state=0)
とあって実行すると
TypeError: init() got an unexpected keyword argument 'indices'
とエラーが起きます。
おそらくindices=Trueのところがいけないと思うのですが、上記のプログラムは参考書のサンプルプログラムなので間違いではないと思います。
しかし公式ページで確認すると
http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.ShuffleSplit.html
indice=Trueは入れられない気がします。
また「train_size=数値」に変更しても下記のようにエラーが生じます。
0.3の場合
ValueError: Found array with 0 sample(s) (shape=(0, 1000)) while a minimum of 1 is required.
1の場合
ValueError: This solver needs samples of at least 2 classes in the data, but the data contains only one class: 0
2の場合
ValueError: train_size=2 should be smaller than the number of samples 2
何がいけないのでしょうか?
よろしくお願いします。
もし前後のプログラムが必要であれば載せます。ちなみに2つのグループに分類しようと思っています。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/07/21 06:49
2016/07/21 13:07 編集
2016/07/22 05:19