Skip to content

Instantly share code, notes, and snippets.

"""
Download data from RescueTime.
Inspired by https://gist.github.com/veekas/2fe3cf30fe6375f5d121c6372a550000
Also see https://www.rescuetime.com/anapi/setup/documentation
"""
import urllib.parse
import urllib.request
import requests
@tuananhle7
tuananhle7 / rws.py
Last active February 18, 2020 04:55
import torch
from torch import nn
theta = nn.Parameter(torch.tensor(1.))
phi = nn.Parameter(torch.tensor(2.))
log_joint = theta**2
log_q = phi**2
log_weight = log_joint + log_q.detach()
theta_loss = 2 * log_weight
import pyro
import pyro.poutine as poutine
def model(z):
pyro.sample('z', pyro.distributions.Normal(0, 1), obs=z)
z = 1.2
# this evaluates log Normal(1.2 | 0, 1)
trace = poutine.trace(model).get_trace(z)