Skip to content
Advertisement

Tag: constraints

How to implement a constrained linear fit in Python?

I’m trying to fit a linear model to a set of data, with the constraint that all the residuals (model – data) are positive – in other words, the model should be the “best overestimate”. Without this constraint, linear models can be easily found with numpy’s polyfit as shown below. example1 Is there an efficient way to implement a linear

Inequality Constraint for a PYMC3 Model

I want to define an inequality constraint for a PYMC3 model. I found this post about defining an equality constraint (i.e., a+b1+b2=1) using pm.Potential. Does anyone know how to change that equality constraint into an inequality constraint like 0.9<a+b1+b2<1? Thanks! Answer The post you mention uses pm.math.eq which stands for “equal”. There are also pm.math.lt (lower than) and pm.math.le (lower

Advertisement