MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / _sample_thetas

Method _sample_thetas

numpy_ml/rl_models/agents.py:350–358  ·  view source on GitHub ↗

Sample `n_samples_per_episode` thetas from a multivariate Gaussian with mean `theta_mean` and covariance `diag(theta_var)`

(self)

Source from the content-addressed store, hash-verified

348 P["theta_var"] = np.var(D["theta_samples"][top_idxs], axis=0)
349
350 def _sample_thetas(self):
351 """
352 Sample `n_samples_per_episode` thetas from a multivariate Gaussian with
353 mean `theta_mean` and covariance `diag(theta_var)`
354 """
355 P, N = self.parameters, self.n_samples_per_episode
356 Mu, Sigma = P["theta_mean"], np.diag(P["theta_var"])
357 samples = np.random.multivariate_normal(Mu, Sigma, N)
358 self.derived_variables["theta_samples"] = samples
359
360 def greedy_policy(self, max_steps, render=True):
361 """

Callers 1

run_episodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected