I am trying to participate in my first competition in Cuggle, where it RMSLEis given as a function of losses. I did not find anything, how to implement this loss functionI tried to install RMSE. I know this has been a part of Kerasthe past, is there a way to use it in the latest version, perhaps using a custom function through backend?
This is my developed NN:
from keras.models import Sequential
from keras.layers.core import Dense , Dropout
from keras import regularizers
model = Sequential()
model.add(Dense(units = 128, kernel_initializer = "uniform", activation = "relu", input_dim = 28,activity_regularizer = regularizers.l2(0.01)))
model.add(Dropout(rate = 0.2))
model.add(Dense(units = 128, kernel_initializer = "uniform", activation = "relu"))
model.add(Dropout(rate = 0.2))
model.add(Dense(units = 1, kernel_initializer = "uniform", activation = "relu"))
model.compile(optimizer = "rmsprop", loss = "root_mean_squared_error")#, metrics =["accuracy"])
model.fit(train_set, label_log, batch_size = 32, epochs = 50, validation_split = 0.15)
I tried a customized function root_mean_squared_errorthat I found on GitHub, but for everyone I know, the syntax is not what is required. I think that y_trueu y_predshould be defined before passing back, but I have no idea how exactly, I just started with programming in python, and I'm really not so good at math ...
from keras import backend as K
def root_mean_squared_error(y_true, y_pred):
return K.sqrt(K.mean(K.square(y_pred - y_true), axis=-1))
:
ValueError: ('Unknown loss function', ':root_mean_squared_error')
, !