Skip to content

Instantly share code, notes, and snippets.

@alexbw
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbw/def1b5159d1bb51459a0 to your computer and use it in GitHub Desktop.
Save alexbw/def1b5159d1bb51459a0 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-9d64abf5b3b8> in <module>()
11 kappa=kappa,
12 train_experiments=train_experiments,
---> 13 test_experiments=test_experiments)
/home/dattalab/Code/pymouse/scripts/train_model_generalAR.py in hmm(out_file, params, store_name, train_experiments, test_experiments, datadimension, n_cpu, n_iter, max_frames_per_mouse, pca, use_ard, windowsize, featurefn, random_seed, model_dtype, **kwargs)
182 samples = []
183 for itr in progprint_xrange(n_iter):
--> 184 model.resample_model()
185 scores.append(model.log_likelihood())
186 samples.append(np.concatenate(model.stateseqs))
/home/dattalab/Code/pyhsmm/models.pyc in resample_model(self, joblib_jobs)
199 @line_profiled
200 def resample_model(self,joblib_jobs=0):
--> 201 self.resample_parameters()
202 self.resample_states(joblib_jobs=joblib_jobs)
203
/home/dattalab/Code/pyhsmm/models.pyc in resample_parameters(self)
205 def resample_parameters(self):
206 self.resample_obs_distns()
--> 207 self.resample_trans_distn()
208 self.resample_init_state_distn()
209
/home/dattalab/Code/pyhsmm/models.pyc in resample_trans_distn(self)
214
215 def resample_trans_distn(self):
--> 216 self.trans_distn.resample([s.stateseq for s in self.states_list])
217 self._clear_caches()
218
/home/dattalab/Code/pyhsmm/internals/transitions.pyc in resample(self, stateseqs, trans_counts, ms)
311 trans_counts = self._count_transitions(stateseqs) if trans_counts is None \
312 else trans_counts
--> 313 ms = self._get_m(trans_counts) if ms is None else ms
314
315 self._resample_beta(ms)
/home/dattalab/Code/pyhsmm/internals/transitions.pyc in _get_m(self, trans_counts)
409 def _get_m(self,trans_counts):
410 # NOTE: this thins the m's
--> 411 ms = super(_WeakLimitStickyHDPHMMTransitionsGibbs,self)._get_m(trans_counts)
412 newms = ms.copy()
413 if ms.sum() > 0:
/home/dattalab/Code/pyhsmm/internals/transitions.pyc in _get_m(self, trans_counts)
324 def _get_m(self,trans_counts):
325 if not (0 == trans_counts).all():
--> 326 m = sample_crp_tablecounts(self.alpha,trans_counts,self.beta)
327 else:
328 m = np.zeros_like(trans_counts)
/home/dattalab/Code/pyhsmm/util/cstats.so in pyhsmm.util.cstats.__pyx_fused_cpdef (util/cstats.c:4598)()
TypeError: Function call with ambiguous argument types
> /home/dattalab/Code/pymouse/notebooks/ar/pyhsmm/util/cstats.pyx(48)pyhsmm.util.cstats.__pyx_fused_cpdef (util/cstats.c:4598)()
ipdb> u
> /home/dattalab/Code/pyhsmm/internals/transitions.py(326)_get_m()
325 if not (0 == trans_counts).all():
--> 326 m = sample_crp_tablecounts(self.alpha,trans_counts,self.beta)
327 else:
ipdb> self.alpha
5
ipdb> self.beta
array([ 0.01324573, 0.00764844, 0.00830479, 0.01196715, 0.00947099,
0.00902378, 0.0139963 , 0.01104444, 0.00750179, 0.0165399 ,
0.01721792, 0.01437373, 0.01406835, 0.01230822, 0.0080702 ,
0.01475746, 0.01256791, 0.01926623, 0.01655779, 0.00920015,
0.01554387, 0.00959171, 0.01677196, 0.02013 , 0.00851041,
0.01139545, 0.01082287, 0.01070915, 0.01584855, 0.01036786,
0.01448423, 0.01043519, 0.01600824, 0.01348913, 0.01440669,
0.00923952, 0.01428523, 0.00941661, 0.01283545, 0.01085134,
0.00703075, 0.01168132, 0.00789517, 0.01489451, 0.00866879,
0.00969832, 0.00930663, 0.00878434, 0.01034597, 0.01743593,
0.01155116, 0.0181796 , 0.01567178, 0.01861947, 0.00924245,
0.01775789, 0.02124287, 0.01031241, 0.01146914, 0.0094428 ,
0.0096245 , 0.01503354, 0.01664794, 0.01181219, 0.01878717,
0.01538124, 0.00840209, 0.01316507, 0.01338268, 0.00827685,
0.00683635, 0.01123835, 0.01157375, 0.01302618, 0.01199513,
0.01263046, 0.01242606, 0.01150784, 0.01687055, 0.00987602])
ipdb> trans_counts
array([[ 12, 7, 0, ..., 0, 0, 0],
[ 11, 0, 0, ..., 0, 0, 2],
[ 0, 45, 0, ..., 0, 0, 20],
...,
[ 0, 0, 0, ..., 0, 0, 0],
[ 0, 0, 1064, ..., 0, 2, 0],
[ 0, 0, 4, ..., 357, 0, 7]], dtype=int32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment