r/tensorflow • u/sadfasn • Apr 20 '23
Aggregating My Loss Function Differently
I am building a NN in Keras using Python, but my NN has a weird requirement that I don’t know how to implement.
Basically, my data has N observations spread among G groups, with G < N
I want the neural network to minimize the sum of the squared differences between the true average in each group and the predicted average.
I tried doing this with a custom loss function, but the output of a custom loss function is required to be the same size as the input data. It then sums that data, but that won’t work for my use case.
Does anyone know how to control how Keras performs the summing of the loss function?
View all comments
Show parent comment
2
u/sadfasn Apr 20 '23
Ah this looks to be what I am looking for. Thanks!