I am trying to create a loss function for a sports betting model. I am having trouble bringing the odds (a third variable) into the loss function. When I do bring it in, it works for the first batch but seems to revert back to the start of my list/tensor when a new batch begins. Is it possible to iterate though the odds list as rate as the yTrue/yPred values.
odds = data_info['FRD_Open'] # Specific value for each model prediction
def custom_Loss(odds):
def customLoss(yTrue, yPred):
o = tf.convert_to_tensor(odds, dtype=tf.float32)
loss = K.mean(K.sum(K.relu((yTrue * (o - 1) - (1 - yTrue)) * yPred), axis=1))
return -loss
return customLoss
Note: data_info is a pandas dataframe of the data used to train and test the model.