I am trying to do this little tutorial on keras about regression: http://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/
Unfortunately I am running into an error I cannot fix. If i just copy and paste the code I get the following error when running this snippet:
import numpy
import pandas
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
# load dataset
dataframe = pandas.read_csv("housing.csv", delim_whitespace=True,header=None)
dataset = dataframe.values
# split into input (X) and output (Y) variables
X = dataset[:,0:13]
Y = dataset[:,13]
# define base mode
def baseline_model():
# create model
model = Sequential()
model.add(Dense(13, input_dim=13, init='normal', activation='relu'))
model.add(Dense(1, init='normal'))
# Compile model
model.compile(loss='mean_squared_error', optimizer='adam')
return model
# fix random seed for reproducibility
seed = 7
numpy.random.seed(seed)
# evaluate model with standardized dataset
estimator = KerasRegressor(build_fn=baseline_model, nb_epoch=100,batch_size=5, verbose=0)
kfold = KFold(n_splits=10, random_state=seed)
results = cross_val_score(estimator, X, Y, cv=kfold)
The error says:
TypeError: get_params() got an unexpected keyword argument 'deep'
Thanks for any help.
Here is the full traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\myname\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py", line 140, in cross_val_score
for train, test in cv_iter)
File "C:\Users\myname\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py", line 758, in __call__
while self.dispatch_one_batch(iterator):
File "C:\Users\myname\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py", line 603, in dispatch_one_batch
tasks = BatchedCalls(itertools.islice(iterator, batch_size))
File "C:\Users\myname\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py", line 127, in __init__
self.items = list(iterator_slice)
File "C:\Users\myname\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py", line 140, in <genexpr>
for train, test in cv_iter)
File "C:\Users\myname\Anaconda3\lib\site-packages\sklearn\base.py", line 67, in clone
new_object_params = estimator.get_params(deep=False)
TypeError: get_params() got an unexpected keyword argument 'deep'