Skip to content
Snippets Groups Projects
Commit 9b8b3f34 authored by Matthew Johnson's avatar Matthew Johnson
Browse files

make HMM.predict handle 1D data

parent f13dc2a0
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,8 @@ class _HMMBase(Model): ...@@ -109,7 +109,8 @@ class _HMMBase(Model):
return sum(s.log_likelihood() for s in self.states_list) return sum(s.log_likelihood() for s in self.states_list)
def predict(self,seed_data,timesteps,**kwargs): def predict(self,seed_data,timesteps,**kwargs):
full_data = np.vstack((seed_data,np.nan*np.ones((timesteps,seed_data.shape[1])))) padshape = (timesteps, seed_data.shape[1]) if seed_data.ndim == 2 else timesteps
full_data = np.concatenate((seed_data,np.nan*np.ones(padshape)))
self.add_data(full_data,**kwargs) self.add_data(full_data,**kwargs)
s = self.states_list.pop() s = self.states_list.pop()
s.resample() # fills in states s.resample() # fills in states
......
...@@ -84,7 +84,7 @@ names = ['.'.join(os.path.split(p)) for p in paths] ...@@ -84,7 +84,7 @@ names = ['.'.join(os.path.split(p)) for p in paths]
ext_modules = [ ext_modules = [
Extension( Extension(
name, sources=[path + '.cpp'], name, sources=[path + '.cpp'],
include_dirs=[os.path.join('deps')], include_dirs=['deps'],
extra_compile_args=['-O3','-std=c++11','-DNDEBUG','-w','-DHMM_TEMPS_ON_HEAP']) extra_compile_args=['-O3','-std=c++11','-DNDEBUG','-w','-DHMM_TEMPS_ON_HEAP'])
for name, path in zip(names,paths)] for name, path in zip(names,paths)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment