This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |