采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
error message如下
‘NoneType' object has no attribute 'loss'
老师,请问这个问题怎么解决?
model没有compile?
def build_model(hidden_layers = 1, layer_size = 30, learning_rate = 3e-3): model = keras.models.Sequential() model.add(keras.layers.Dense(layer_size, activation='relu', input_shape=x_train.shape[1:])) for _ in range(hidden_layers - 1): model.add(keras.layers.Dense(layer_size, activation = 'relu')) model.add(keras.layers.Dense(1)) optimizer = keras.optimizers.SGD(learning_rate) model.compile(loss = 'mse', optimizer = optimizer) return model sklearn_model = KerasRegressor(build_fn = build_model)
非常感谢!
登录后可查看更多问答,登录/注册
Tensorflow2.0实战—以实战促理论的方式学习深度学习
2.8k 1
1.3k 3
1.2k 19
1.3k 13
2.0k 7