安装Keras模型时出错

时间:2017-05-29 22:54:01

标签: python neural-network keras

我遇到了以下使用库keras的python代码的问题,我无法在线找到解决方案:

       def model_build():
        model_mag=Sequential()
        model_mag.add(Dense(64, activation='relu', input_dim=5))  
        model_mag.add(Dropout(0.5))
        model_mag.add(Dense(64, activation='relu'))
        model_mag.add(Dropout(0.5))
        model_mag.add(Dense(64, activation='relu'))
        model_mag.add(Dense(1))
        model_mag.compile(loss=losses.mean_squared_error,optimizer='sgd')
        return model_mag
       clf = KerasRegressor(build_fn=model_build(),nb_epoch=100)
       # here is the error
       clf.fit(X_train,y_train, nb_epoch=20)

我知道上面已经很好地定义了X_train和y_train,我可以运行其他分类器方法,因此它们不是问题所在。它不断向我发出以下错误,我无法弄清楚原因:

TypeError:调用()只需要2个参数(给定1个)

我给出了两个论点。

0 个答案:

没有答案