maml_zoo.policies.distributions package¶
Submodules¶
maml_zoo.policies.distributions.base module¶
-
class
meta_policy_search.policies.distributions.base.
Distribution
[source]¶ Bases:
object
General methods for a generic distribution
-
dim
¶
-
dist_info_keys
¶
-
dist_info_specs
¶
-
entropy
(dist_info)[source]¶ Compute the entropy of the distribution
Parameters: dist_info (dict) – dict of distribution parameters as numpy array Returns: entropy Return type: (numpy array)
-
entropy_sym
(dist_info_vars)[source]¶ Symbolic entropy of the distribution
Parameters: dist_info (dict) – dict of distribution parameters as tf.Tensor Returns: entropy Return type: (tf.Tensor)
-
kl
(old_dist_info, new_dist_info)[source]¶ Compute the KL divergence of two distributions
Parameters: - old_dist_info (dict) – dict of old distribution parameters as numpy array
- new_dist_info (dict) – dict of new distribution parameters as numpy array
Returns: kl divergence of distributions
Return type: (numpy array)
-
kl_sym
(old_dist_info_vars, new_dist_info_vars)[source]¶ Symbolic KL divergence of two distributions
Parameters: - old_dist_info_vars (dict) – dict of old distribution parameters as tf.Tensor
- new_dist_info_vars (dict) – dict of new distribution parameters as tf.Tensor
Returns: Symbolic representation of kl divergence (tensorflow op)
Return type: (tf.Tensor)
-
likelihood_ratio
(x_var, old_dist_info, new_dist_info)[source]¶ Compute the likelihood ratio p_new(x)/p_old(x) of two distributions
Parameters: - x_var (numpy array) – variable where to evaluate the likelihood ratio p_new(x)/p_old(x)
- old_dist_info_vars (dict) – dict of old distribution parameters as numpy array
- new_dist_info_vars (dict) – dict of new distribution parameters as numpy array
Returns: likelihood ratio
Return type: (numpy array)
-
likelihood_ratio_sym
(x_var, old_dist_info_vars, new_dist_info_vars)[source]¶ Symbolic likelihood ratio p_new(x)/p_old(x) of two distributions
Parameters: - x_var (tf.Tensor) – variable where to evaluate the likelihood ratio p_new(x)/p_old(x)
- old_dist_info_vars (dict) – dict of old distribution parameters as tf.Tensor
- new_dist_info_vars (dict) – dict of new distribution parameters as tf.Tensor
Returns: likelihood ratio
Return type: (tf.Tensor)
-
log_likelihood
(xs, dist_info)[source]¶ Compute the log likelihood log p(x) of the distribution
Parameters: - x_var (numpy array) – variable where to evaluate the log likelihood
- dist_info_vars (dict) – dict of distribution parameters as numpy array
Returns: log likelihood
Return type: (numpy array)
-
maml_zoo.policies.distributions.diagonal_gaussian module¶
-
class
meta_policy_search.policies.distributions.diagonal_gaussian.
DiagonalGaussian
(dim)[source]¶ Bases:
meta_policy_search.policies.distributions.base.Distribution
General methods for a diagonal gaussian distribution of this size
-
dim
¶
-
dist_info_specs
¶
-
entropy
(dist_info)[source]¶ Compute the entropy of the distribution
Parameters: dist_info (dict) – dict of distribution parameters as numpy array Returns: entropy Return type: (numpy array)
-
entropy_sym
(dist_info_vars)[source]¶ Symbolic entropy of the distribution
Parameters: dist_info (dict) – dict of distribution parameters as tf.Tensor Returns: entropy Return type: (tf.Tensor)
-
kl
(old_dist_info, new_dist_info)[source]¶ - Compute the KL divergence of two multivariate Gaussian distribution with diagonal covariance matrices
Parameters: - old_dist_info (dict) – dict of old distribution parameters as numpy array
- new_dist_info – dict of new distribution parameters as numpy array
-
kl_sym
(old_dist_info_vars, new_dist_info_vars)[source]¶ Computes the symbolic representation of the KL divergence of two multivariate Gaussian distribution with diagonal covariance matrices
Parameters: - old_dist_info_vars (dict) – dict of old distribution parameters as tf.Tensor
- new_dist_info_vars (dict) – dict of new distribution parameters as tf.Tensor
Returns: Symbolic representation of kl divergence (tensorflow op)
Return type: (tf.Tensor)
-
likelihood_ratio_sym
(x_var, old_dist_info_vars, new_dist_info_vars)[source]¶ Symbolic likelihood ratio p_new(x)/p_old(x) of two distributions
Parameters: - x_var (tf.Tensor) – variable where to evaluate the likelihood ratio p_new(x)/p_old(x)
- old_dist_info_vars (dict) – dict of old distribution parameters as tf.Tensor
- new_dist_info_vars (dict) – dict of new distribution parameters as tf.Tensor
Returns: likelihood ratio
Return type: (tf.Tensor)
-
log_likelihood
(xs, dist_info)[source]¶ Compute the log likelihood log p(x) of the distribution
Parameters: - x_var (numpy array) – variable where to evaluate the log likelihood
- dist_info_vars (dict) – dict of distribution parameters as numpy array
Returns: log likelihood
Return type: (numpy array)
-