Error: __init__() got an unexpected keyword argument 'n_splits'

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

Error: __init__() got an unexpected keyword argument 'n_splits'



I am going to perform ShuffleSplit() method for California housing dataset (Source: https://www.dcc.fc.up.pt/~ltorgo/Regression/cal_housing.html) to fit SGD regression.

However, the 'n_splits' error is occurred when method is applied.

The code is following:


ShuffleSplit()


from sklearn import cross_validation, grid_search, linear_model, metrics
import numpy as np
import pandas as pd


from sklearn.preprocessing import scale
from sklearn.cross_validation import ShuffleSplit


housing_data = pd.read_csv('cal_housing.csv', header = 0, sep = ',')
housing_data.fillna(housing_data.mean(), inplace=True)
df=pd.get_dummies(housing_data)


y_target = housing_data['median_house_value'].values
x_features = housing_data.drop(['median_house_value'], axis = 1)

from sklearn.cross_validation import train_test_split
from sklearn import model_selection

train_x, test_x, train_y, test_y = model_selection.train_test_split(x_features, y_target, test_size=0.2, random_state=4)
reg = linear_model.SGDRegressor(random_state=0)
cv = ShuffleSplit(n_splits = 10, test_size = 0.2, random_state = 0)



The error is below:


---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-22-8f8760b04f8c> in <module>()
----> 1 cv = ShuffleSplit(n_splits = 10, test_size = 0.2, random_state = 0)

TypeError: __init__() got an unexpected keyword argument 'n_splits'



I updated scikit-learn with 0.18 version.



Anaconda version: 4.5.8



Could you please advise on this issue?





Well, does ShuffleSplit accept an n_splits parameter?
– Lasse Vågsæther Karlsen
1 hour ago


ShuffleSplit


n_splits





Use n=10 instead of n_splits
– RafaelC
1 hour ago


n=10


n_splits









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

Trying to Print Gridster Items to PDF without overlapping contents

Hystrix command on request collapser fallback