Path: blob/master/site/ja/probability/examples/Learnable_Distributions_Zoo.ipynb
25118 views
Kernel: Python 3
Copyright 2019 The TensorFlow Probability Authors.
Licensed under the Apache License, Version 2.0 (the "License");
In [ ]:
Learnable Distributions Zoo (学習可能な分布を構築するためのさまざまな例)
このコラボでは、学習可能な (「トレーニング可能な」) 分布を構築するさまざまな例を示します。(分布については説明せず、構築する方法を示すだけです。)
In [ ]:
In [ ]:
chol(Cov)
のスケーリングされたアイデンティティを持つ学習可能な多変量正規
In [ ]:
tfp.distributions.Independent("learnable_mvn_scaled_identity", batch_shape=[], event_shape=[4], dtype=float32)
(<tf.Variable 'loc:0' shape=(4,) dtype=float32, numpy=array([0., 0., 0., 0.], dtype=float32)>, <tf.Variable 'scale:0' shape=(1,) dtype=float32, numpy=array([0.], dtype=float32)>)
chol(Cov)
の対角を持つ学習可能な多変量正規
In [ ]:
tfp.distributions.Independent("learnable_mvn_diag", batch_shape=[], event_shape=[4], dtype=float32)
(<tf.Variable 'loc:0' shape=(4,) dtype=float32, numpy=array([0., 0., 0., 0.], dtype=float32)>, <tf.Variable 'scale:0' shape=(4,) dtype=float32, numpy=array([0.54132485, 0.54132485, 0.54132485, 0.54132485], dtype=float32)>)
多変量正規 (球形) の混合
In [ ]:
tfp.distributions.MixtureSameFamily("learnable_mix_mvn_scaled_identity", batch_shape=[], event_shape=[4], dtype=float32)
(<tf.Variable 'logits:0' shape=(3,) dtype=float32, numpy=array([-0., -0., -0.], dtype=float32)>, <tf.Variable 'loc:0' shape=(3, 4) dtype=float32, numpy=
array([[ 0.21316044, 0.18825649, 1.3055958 , -1.4072137 ],
[-1.6604203 , -0.9415946 , -1.1349488 , -0.4928658 ],
[-0.9672405 , 0.45094398, -2.615817 , 3.7891428 ]],
dtype=float32)>, <tf.Variable 'scale:0' shape=(3, 1) dtype=float32, numpy=
array([[9.999954],
[9.999954],
[9.999954]], dtype=float32)>)
多変量正規 (球形) と学習不可能な最初の混合重みの混合
In [ ]:
tfp.distributions.MixtureSameFamily("learnable_mix_mvndiag_first_fixed", batch_shape=[], event_shape=[4], dtype=float32)
(<tf.Variable 'Variable:0' shape=(2,) dtype=float32, numpy=array([-0.4054651, -0.8109302], dtype=float32)>, <tf.Variable 'loc:0' shape=(3, 4) dtype=float32, numpy=
array([[ 1., 1., -1., -1.],
[ 1., -1., 1., 1.],
[-1., 1., -1., -1.]], dtype=float32)>, <tf.Variable 'scale:0' shape=(3, 1) dtype=float32, numpy=
array([[9.999954],
[9.999954],
[9.999954]], dtype=float32)>)
多変量正規分布の混合 (完全なCov
)
In [ ]:
tfp.distributions.MixtureSameFamily("learnable_mix_mvntril", batch_shape=[], event_shape=[4], dtype=float32)
(<tf.Variable 'loc:0' shape=(3, 4) dtype=float32, numpy=
array([[0., 0., 0., 0.],
[0., 0., 0., 0.],
[0., 0., 0., 0.]], dtype=float32)>, <tf.Variable 'scale_tril:0' shape=(3, 10) dtype=float32, numpy=
array([[9.999945, 0. , 0. , 0. , 9.999945, 9.999945,
0. , 0. , 0. , 9.999945],
[9.999945, 0. , 0. , 0. , 9.999945, 9.999945,
0. , 0. , 0. , 9.999945],
[9.999945, 0. , 0. , 0. , 9.999945, 9.999945,
0. , 0. , 0. , 9.999945]], dtype=float32)>, <tf.Variable 'logits:0' shape=(3,) dtype=float32, numpy=array([-0., -0., -0.], dtype=float32)>)
多変量正規分布 (完全なCov
) と学習不可能な最初の混合および最初の要素の混合
In [ ]:
tfp.distributions.MixtureSameFamily("learnable_mix_mvntril_fixed_first", batch_shape=[], event_shape=[4], dtype=float32)
(<tf.Variable 'loc:0' shape=(2, 4) dtype=float32, numpy=
array([[0., 0., 0., 0.],
[0., 0., 0., 0.]], dtype=float32)>, <tf.Variable 'scale_tril:0' shape=(2, 10) dtype=float32, numpy=
array([[9.999945, 0. , 0. , 0. , 9.999945, 9.999945,
0. , 0. , 0. , 9.999945],
[9.999945, 0. , 0. , 0. , 9.999945, 9.999945,
0. , 0. , 0. , 9.999945]], dtype=float32)>, <tf.Variable 'logits:0' shape=(2,) dtype=float32, numpy=array([-0., -0.], dtype=float32)>)