def linear_terms(draw): coef = draw(coefficients()) return (coef, C.Linear)
def constant_terms(draw): coef = draw(coefficients()) return coef, M.Constant
def concave_terms(draw): coef = draw(coefficients()) if coef < 0: return (coef, C.Convex) else: return (coef, C.Concave)
def nonincreasing_terms(draw): coef = draw(coefficients()) if coef < 0: return coef, M.Nondecreasing return coef, M.Nonincreasing