Newer
Older
Alex Rubinsteyn
committed
def from_ic50(ic50, max_ic50=50000.0):
Alex Rubinsteyn
committed
"""
Convert ic50s to regression targets in the range [0.0, 1.0].
Alex Rubinsteyn
committed
Parameters
----------
ic50 : numpy.array of float
Returns
-------
numpy.array of float
Alex Rubinsteyn
committed
"""
x = 1.0 - (numpy.log(numpy.maximum(ic50, 1e-12)) / numpy.log(max_ic50))
Alex Rubinsteyn
committed
def to_ic50(x, max_ic50=50000.0):
"""
Convert regression targets in the range [0.0, 1.0] to ic50s in the range
[0, 50000.0].
Alex Rubinsteyn
committed
Parameters
----------
Alex Rubinsteyn
committed
Alex Rubinsteyn
committed
"""
return max_ic50 ** (1.0 - x)