# Same data caused Division by 0 and overflow in programming from SR solution

16 views

### JY

Nov 10, 2020, 2:11:09 AM11/10/20
to HeuristicLab
Hi,

Heuristiclab helped me generate an accurate solution with just elementary operators. However, when I ran the solution with the same data, I got overflows and divide by 0 errors.

Is there a special technique that Heuristiclabs is using? It's difficult to diagnose because the excel output showed very similar values between target and predicted values, and I didn't know that there were any such issues until they were coded externally.

Were they substituted, or divided differently? How was error handled?

Thanks a lot!

### Gabriel Kronberger

Nov 10, 2020, 2:53:04 AM11/10/20
Hi,
HeuristicLab limits the outputs of SR models to prevent NaN and extremely large and small values. The range depends on the variance of your input data (in particulat of the target variable). The same limiting is applied in the Excel-Sheet when you export the solution. Go through the Excel-Formulas to find the limiting.

In your application you can handle this in the same way using something along the following:

for(i=0;i<n;i++) {
fx[i] = model(....)
if(double.IsNaN(fx[i])) fx[i] = y_avg;
else fx[i] = Math.Max(lowerLimit, Math.Min(upperLimit, fx[i]))
}

Best, Gabriel
--
You received this message because you are subscribed to the Google Groups "HeuristicLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to heuristiclab...@googlegroups.com.

### Gabriel Kronberger

Nov 10, 2020, 2:58:25 AM11/10/20
You should be aware that if you observe this kind of behaviour it means that your SR model is probably not well-suited. It is  non-smooth and probably leads to surprising and unplausible prediction results in the application.

A partial dependence plot can help to check the model and detect problematic behaviour. Ideally, you should try to re-run SR to find a better model or alternatively simplify/edit your model to remove non-smoothness.