I am predicting continuous values (regression problem) and I have limits for the true values

but sometimes algorithm predict values exceed those limits

is there a way to enforce algorithm, (whatever is) not exceeding a threshold, but instead providing the limit value?

No, not in my experience.

1 Like

Iâ€™ve never tried to do something like that either, but you get to define the output layer â€śactivation functionâ€ť. If the model output is a continuous real number and you wanted to make sure that itâ€™s never greater than 42, you could try using a function like this as the output activation:

```
def outputWithLimit(z):
return np.minimum(z, 42.)
```

Of course you would then need to keep in mind that the derivative of that function is needed as part of your gradient calculations for backprop.

Seems worth a try anyway. Let us know if this type of idea helps for whatever it is you are trying to build.

1 Like

it seems good for NN

sure I will try it

Thanks