def scale(arr, mn=<NUM_LIT:0>, mx=<NUM_LIT:1>):
amn = arr.min()<EOL>amx = arr.max()<EOL>arr = (arr - amn) / (amx - amn)<EOL>if amn != mn or amx != mx:<EOL><INDENT>arr *= mx - mn<EOL>arr += mn<EOL><DEDENT>return arr<EOL>
Apply min-max scaling (normalize)
then scale to (mn,mx)