Newer
Older
Alex Rubinsteyn
committed
# Copyright (c) 2016. Mount Sinai School of Medicine
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Alex Rubinsteyn
committed
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(ic50) / numpy.log(50000))
return numpy.minimum(
1.0,
numpy.maximum(0.0, x))
Alex Rubinsteyn
committed
def to_ic50(x):
"""
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
"""