Skip to content

Instantly share code, notes, and snippets.

@alexrutherford
Created December 13, 2019 16:50
Show Gist options
  • Save alexrutherford/5dc4e6cb9b6911e314c72dd71efe9a18 to your computer and use it in GitHub Desktop.
Save alexrutherford/5dc4e6cb9b6911e314c72dd71efe9a18 to your computer and use it in GitHub Desktop.
def rescale(p,rho = 0.001):
rhoAbs = abs(rho)
if abs(rho) > 10.001:
print('Error in rho ')
sys.exit(1)
out = np.zeros_like(p)
out = p**(1. + rhoAbs)
out = out/out.sum()
if rho < 0.0:
out = p - (out - p)
# out = p + (p-out)
# If rho is -ve then flip super linear scaling
# out = p - (out - p)
return out
@alexrutherford
Copy link
Author

rescale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment