Closed plison closed 3 years ago
This is because you are using find_MAP
on a model with unobserved discrete variables. We use the scipy optimisers internally, and they assume that the optimisation problem is continuous, so we don't support that (discrete parameters are also typically problematic for sampling by the way. Often there are ways around using them.)
We should really give a better error message here though...
@bwengals I think you worked on this last, right?
It seems there is some code here that should switch to method="Powell"
if there are discrete parameters (this code somehow doesn't work). This still isn't the right thing though. Powell doesn't use the gradient, but it still assumes that the variables are continuous:
optimize.minimize(fun=lambda x: (x - 0.1)**2, x0=np.array([3]), method='Powell')
direc: array([[1.]])
fun: array(2.86655413e-30)
message: 'Optimization terminated successfully.'
nfev: 20
nit: 2
status: 0
success: True
x: array(0.1)
Should we just throw an error instead or at least print a warning? Can continuous values still be useful in some settings?
I get an error when computing MAP estimates:
which throws the following error in Scipy:
I'm currently running the latest development version of PyMC3 (but I also tried the stable version on anaconda, and I got the same error). The scipy version is 1.1.0.
Any clue as to why this is happening?