def r_square(y_true, y_pred):
SSR = K.mean(K.square(y_pred-K.mean(y_true)),axis=-1)
SST = K.mean(K.square(y_true-K.mean(y_true)),axis=-1)
return SSR/SST
model.compile(loss=[loss_op],optimizer='sgd',metrics=[r_square])
想知道这个y_true与y_pred怎么获得,现在输出全是nan