Skip to content

Commit e7b82d5

Browse files
committed
ENH: cache samples in PredictSession
1 parent 8e9152c commit e7b82d5

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

python/smurff/predict.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def __init__(self, h5_file, name, num_latent):
1313
self.no = int(self.h5_group.attrs["number"])
1414
self.nmodes = h5_file["config/options"].attrs['num_priors']
1515
self.num_latent = num_latent
16+
self.latents = self.lookup_modes("latents/latents_%d")
17+
self.betas = self.lookup_modes("link_matrices/link_matrix_%d")
18+
self.mus = self.lookup_modes("link_matrices/mu_%d")
19+
1620

1721
@property
1822
def predStats(self):
@@ -33,17 +37,6 @@ def lookup_mode(self, templ, mode):
3337
def lookup_modes(self, templ):
3438
return [ self.lookup_mode(templ, i) for i in range(self.nmodes) ]
3539

36-
@property
37-
def latents(self):
38-
return self.lookup_modes("latents/latents_%d")
39-
40-
@property
41-
def betas(self):
42-
return self.lookup_modes("link_matrices/link_matrix_%d")
43-
44-
@property
45-
def mus(self):
46-
return self.lookup_modes("link_matrices/mu_%d")
4740

4841
@property
4942
def beta_shape(self):

0 commit comments

Comments
 (0)