Hi. Im trying to create a regression model for this dataset on this contest: House Prices - Advanced Regression Techniques | Kaggle
I preprocess the dataset with normalization before fit it into the model. I also create my own loss function base on logarithm and mse. But my when I fit the dataset into the model its loss function always return nan and the accuracy remain 0. I tried to use other loss function which in keras.loss and changed some parameters but it didn’t work. Please help me.
This is my data after preprocess:
This is my code:
model = tf.keras.Sequential()
model.add(Dense(1, activation='relu'))
def loss(y_true, y_pred):
# Calculate your custom loss here
loss = tf.reduce_mean(tf.square(tf.subtract(y_true, y_pred))) # Example: Mean Squared Error
return loss
def log_rmse(y_true, y_pred):
return tf.math.sqrt(2 * loss(tf.math.log(y_true), tf.math.log(y_pred)))
model.compile(optimizer=tf.keras.optimizers.Adadelta(),
loss=log_rmse)
model.fit(train_features, train_labels, epochs=10)
Thank you for reading!