Skip to content Skip to sidebar Skip to footer

Conditional Calculation In Python

I'm attempting to use my own modified version of the logsumexp() from here: https://github.com/scipy/scipy/blob/v0.14.0/scipy/misc/common.py#L18 On line 85, is this calculation: o

Solution 1:

There is a conditional inline statement in Python:

Value1 if Conditionelse Value2

Your formula transforms to:

out=log(sum(exp(threshold if a - a_max < threshold else a - a_max), axis =0))

Solution 2:

Post a Comment for "Conditional Calculation In Python"