I am getting the error “NaN occured in optimization” for a very simple Von Mises mixture model:
import pymc3 as pm import math import numpy as np with pm.Model() as model: mu_1 = pm.VonMises('mu_1', mu=0, kappa=1) kappa_1 = pm.Gamma('kappa_1', 1, 1) vm_1 = pm.VonMises.dist(mu=mu_1, kappa=kappa_1) w = pm.Dirichlet('w', np.ones(2)) vm_comps = [vm_1, vm_1] vm = pm.Mixture('vm', w, vm_comps) for RV in model.basic_RVs: print(RV.name, RV.logp(model.test_point)) print(model.logp(model.test_point)) # Output: # mu_1_circular__ -1.0737914249146185 # kappa_1_log__ -1.0 # w_stickbreaking__ -1.3862943611198906 # vm -1.0737914249146185 # -4.533877210949127 with model: approx = pm.fit(obj_optimizer=pm.adagrad_window(learning_rate=2e-4)) # FloatingPointError: NaN occurred in optimization.
I have tried debugging using the instructions here, but I am still getting the same error.
This model seems simpler than the ones in the issue above (it’s spiritually equivalent to a simple Von Mises model).
Are there any suggestions on how to possibly debug this error in the PyMC3 code base?