Skip to content

Instantly share code, notes, and snippets.

@trungnt13
Created January 22, 2019 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trungnt13/7fdcd611e460182b7678d092ce46793e to your computer and use it in GitHub Desktop.
Save trungnt13/7fdcd611e460182b7678d092ce46793e to your computer and use it in GitHub Desktop.
from __future__ import print_function, division, absolute_import
import tensorflow as tf
tf.enable_eager_execution()
from tensorflow_probability.python.distributions import NegativeBinomial
from zero_inflated import ZeroInflated
nb = NegativeBinomial(total_count=10, probs=0.5)
zfnb = ZeroInflated(dist=nb, pi=0.9)
# denoised values
print(nb.mean())
# matching values of imputed data
print(zfnb.mean())
print(zfnb.log_prob(10))
# Note: zfnb.sample is not working recently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment