Skip to content

Commit

Permalink
ENH: cache samples in PredictSession
Browse files Browse the repository at this point in the history
  • Loading branch information
tvandera committed Apr 9, 2021
1 parent 8e9152c commit e7b82d5
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions python/smurff/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def __init__(self, h5_file, name, num_latent):
self.no = int(self.h5_group.attrs["number"])
self.nmodes = h5_file["config/options"].attrs['num_priors']
self.num_latent = num_latent
self.latents = self.lookup_modes("latents/latents_%d")
self.betas = self.lookup_modes("link_matrices/link_matrix_%d")
self.mus = self.lookup_modes("link_matrices/mu_%d")


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

@property
def latents(self):
return self.lookup_modes("latents/latents_%d")

@property
def betas(self):
return self.lookup_modes("link_matrices/link_matrix_%d")

@property
def mus(self):
return self.lookup_modes("link_matrices/mu_%d")

@property
def beta_shape(self):
Expand Down

0 comments on commit e7b82d5

Please sign in to comment.