CCSI-Toolset / FOQUS

FOQUS: Framework for Optimization and Quantification of Uncertainty and Surrogates
https://foqus.readthedocs.io
Other
46 stars 53 forks source link

Potential Issue with Unscaling Formula from nodeVars.py #1233

Closed franflame closed 1 month ago

franflame commented 1 month ago

During development for #1197, we found a potential mathematical inconsistency in the formula for the "Log" unscaling function. https://github.com/CCSI-Toolset/FOQUS/blob/fb0777c385d6c24286129e25bca2da6f1557e6a5/foqus_lib/framework/graph/nodeVars.py#L727-L728

For #1197, we found that the following alternative seems to work:

def unscale_log(array_in, lo, hi):
    result = lo * np.power(hi / lo, array_in)
    return result

For reference, a plot of the scaling formulas can be found here: https://www.desmos.com/calculator/dxyj2nmpln

bpaul4 commented 1 month ago

@franflame thank you for opening this issue. You are correct and I agree with your suggested form. The original scaled form is

$scaled = 10 \frac{\log unscaled - \log min}{\log max - \log min}$

Solving for $unscaled$ yields

$\log \frac{unscaled}{min} = \frac{scaled}{10} \log \frac{max}{min}$

$unscaled = min (10 \log \frac{max}{min})^\frac{scaled}{10} = min (\frac{max}{min})^\frac{scaled}{10}$

which matches your alternative formula.

sotorrio1 commented 1 month ago

I concur with @bpaul4, the math checks out.