Is there a way to incorporate multiple targets into one loss?

Currently, I work with the Sequential() API, I guess this won't be sufficient....

I work with area predictions as targets. Each sample of the Dataset has a finite area to allocate. my regression often overestimates the total sample area... I want to implement an area restriction into a loss. This would be the sum of all true target values for a sample. I want to separately penalize the overestimation of the area.

I know Keras does automatically average losses like this :

1.trained on batch -->

2.for all targets: loss (target) -->

3.mean loss over all targets

But i need something like this:

1.trained on batch -->

2.loss(sum all predicted areas, sum of true areas)& for all targets: loss (target)-->

3.mean loss overall targets and areasumloss

The current solution was a feature engineering approach :

total area per sample got added to the feature list but did not enhance the result. The sum of individual areas is still overestimated

Is there a way to do this with the Sequential() API or do i need to use the Functional API?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.