schrodinger.math.multi_parameter_optimization module

Utility functions for MPO (Multi-Parameter Optimization). These provide a way to score the desirability of some sort of object on a 0-1 scale based on individual desirability scores of multiple properties of that object.

Use the get_sigmoid and get_double_sigmoid functions to get Sigmoid objects which can be called with a parameter value to get the score. A list of scores and weights can then be passed to get_weighted_score to compute an overall MPO score.

class schrodinger.math.multi_parameter_optimization.Transition(center, rate)

Bases: tuple

center

Alias for field number 0

rate

Alias for field number 1

class schrodinger.math.multi_parameter_optimization.Sigmoid(transition)

Bases: object

A sigmoid transformation using a transition that determines the inflection point and the rate of change.

Larger rate values lead to a faster transition.

example usage: transition = Transition(2.5, 10.0) # a steep 0 to 1 transition transform = Sigmoid(transition) transformed_valued = transform(original_value)

Variables

transition (Transition) – the transition

rate positive                rate negative
1      ---                   1 ---
      /                                   0  ---                       0     ---
   0 1 2 3 4...                0 1 2 3 4...
__init__(transition)
class schrodinger.math.multi_parameter_optimization.DoubleSigmoid(transition_a, transition_b)

Bases: object

A double sigmoid transformation using a left and right transition to determine the inflection points and the rate of change. The left and right transitions are expected to have opposite signs for the rates.

Larger rate values lead to a faster transition.

example usage: a_side = Transform(1.5, 50.0) # a very steep 0 to 1 transition b_side = Transition(10.0, -1.0) # a regular 1 to 0 transition mpo = DoubleSigmoid(a_side, b_side) transformed_valued = mpo(original_value)

Variables
  • transition_a (Transition) – the ‘left-hand side’ transition

  • transition_b (Transition) – the ‘right-hand side’ transition

__init__(transition_a, transition_b)
schrodinger.math.multi_parameter_optimization.get_intersection(transition_a, transition_b)

Get the intersection point of two logistic functions given their center (inflection) points and rate constants.

!!! Rate of transition_a and transition_b cannot be equal or a ZeroDivisionError will be raised. (Two curves with same rates will never intersect unless their centers are equal)

Return type

float

schrodinger.math.multi_parameter_optimization.get_rate(good, bad)

Get the rate for the logistic function given the x values corresponding to the “good” and “bad” thresholds.

Parameters
  • good (float) – The x value corresponding to the good threshold (GOOD_Y)

  • bad (float) – The x value corresponding to the bad threshold (BAD_Y)

Returns

The rate

Return type

float

schrodinger.math.multi_parameter_optimization.get_center(good, bad)

Get the center (inflection point) for the logistic function given the x values corresponding to the “good” and “bad” thresholds.

Parameters
  • good (float) – The x value corresponding to the good threshold (GOOD_Y)

  • bad (float) – The x value corresponding to the bad threshold (BAD_Y)

Returns

The center point

Return type

float

schrodinger.math.multi_parameter_optimization.get_sigmoid(good, bad)

Get a sigmoid logistic function using the given “good” and “bad” cutoffs

Parameters
  • good (float) – The x value corresponding to the good threshold (GOOD_Y)

  • bad (float) – The x value corresponding to the bad threshold (BAD_Y)

Returns

a sigmoid function which can be called with an x value to get the desirability

Return type

Sigmoid

schrodinger.math.multi_parameter_optimization.get_double_sigmoid(good1, bad1, good2, bad2)

Get a double sigmoid function comprised of two logistic functions that fit two points on either function.

Parameters
  • good1 (float) – The x value corresponding to the good threshold (GOOD_Y) of the first sigmoid

  • bad1 (float) – The x value corresponding to the bad threshold (BAD_Y) of the first sigmoid

  • good2 (float) – The x value corresponding to the good threshold (GOOD_Y) of the second sigmoid

  • bad2 (float) – The x value corresponding to the bad threshold (BAD_Y) of the second sigmoid

Returns

the double sigmoid function which can be called with an x value to get the desirability

Return type

DoubleSigmoid

schrodinger.math.multi_parameter_optimization.get_weighted_score(scores, weights)

Return the weighted geometric mean of the given score

Return type

float