TypeError:__ init __()得到了一个意外的关键字参数'test_fraction'

时间:2014-10-07 08:30:25

标签: python

回溯:

Traceback (most recent call last):
  File "C:\Source Code\Thesis(FINAL)\Music Genre Classifier\classifier_fft.py", line 117, in <module>
    train_avg, test_avg, cms = train_model(None, X, y, "Log Reg FFT", plot=True)
  File "C:\Source Code\Thesis(FINAL)\Music Genre Classifier\classifier_fft.py", line 36, in train_model
    cv = ShuffleSplit( n=len(X), n_iterations=1, test_fraction=0.3, indices=True, random_state=0)
TypeError: __init__() got an unexpected keyword argument 'test_fraction'

代码:

cv = ShuffleSplit( n=len(X), n_iterations=1, test_fraction=0.3, indices=True, random_state=0)

train_avg, test_avg, cms = train_model(None, X, y, "Log Reg FFT", plot=True)

有人可以帮我这个吗?

1 个答案:

答案 0 :(得分:0)

假设您正在使用sklearn.cross_validation.ShuffleSplit(我们无法告知您发布的内容),您应该阅读文档:http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.ShuffleSplit.html - 似乎没有参数{{ 1}},但有test_fraction。您可以从旧版本的库中获取示例代码。