RobertTLange / evosax

Evolution Strategies in JAX 🦎
Apache License 2.0
475 stars 44 forks source link

maybe a bug in core/fitness.py ? #54

Closed yudonglee closed 1 year ago

yudonglee commented 1 year ago

in core/fitness.py

`def range_norm_trafo( arr: chex.Array, min_val: float = -1.0, max_val: float = 1.0 ) -> chex.Array: """Map scores into a min/max range.""" arr = jnp.clip(arr, -1e10, 1e10) normalized_arr = ( 2

The range_norm_trafo function won't correctly normalize arr value to range of (min_val, max_val)

I think it maybe a bug? It should be modified as below: `normalized_arr = ( (max_val-min_val)

RobertTLange commented 1 year ago

You are completely right -- please excuse the inconvenience. I have just pushed the fix to the main branch in af5c322 -- it will be part of the next release. Please excuse the inconvenience and thank you for pointing this out!