- Thor::Util#snake_case: well-isolated test cases. Clear and thorough about expected behavior with potentially ambiguous input
- HTTParty.normalize_base_uri: describes behavior well for a method that might be confusing at first
- Virtus::Attribute#==: good use of intermediate variable for clarity. tests are collectively exhaustive within the scope of the method
- AASM::Core::Event#fire: good isolation of complex behavior; good use of mocks and doubles. when/then/expect division is clear (BDD). good use of context
- [Money.from_amount](https://gi
This file contains 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
This is being recorded, so we are going to upload it to Disco after. So if you need to stretch your legs or grab a cup of tea, feel free to do so. And if you're sharing this on social media, tag Dribble. We will repost everything that you guys share, okay? Without further ado, I would love to introduce our first Q&A guest speaker of this course week one. We have got Lenora, a senior product designer based in Miami. She's worked on design systems at Skillshare and Salesforce and is a super talented force to be reckoned with in the design systems world. So we're so grateful and happy that she is with us today. Start asking your questions. I already see one in there. And without further ado, we will get Lenora up. Hello everyone. Hi, you're right. I have worked on Salesforce and on Skillshare. I am now with Digital Ocean working through their systems and their design, so it's been awesome working with them. I think about four months. So yeah, nice. I guess beginning steps of working on a new system, which is awe |
This file contains 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
This is being recorded, so we are going to upload it to Disco after. So if you need to stretch your legs or grab a cup of tea, feel free to do so. And if you're sharing this on social media, tag Dribble. We will repost everything that you guys share, okay? Without further ado, I would love to introduce our first Q&A guest speaker of this course week one. We have got Lenora, a senior product designer based in Miami. She's worked on design systems at Skillshare and Salesforce and is a super talented force to be reckoned with in the design systems world. So we're so grateful and happy that she is with us today. Start asking your questions. I already see one in there. And without further ado, we will get Lenora up. Hello everyone. Hi, you're right. I have worked on Salesforce and on Skillshare. I am now with Digital Ocean working through their systems and their design, so it's been awesome working with them. I think about four months. So yeah, nice. I guess beginning steps of working on a new system, which is awe |
This file contains 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
adam_params = {"lr": 0.0005} | |
optimizer = Adam(adam_params) | |
svi = SVI(model, guide, optimizer, loss=Trace_ELBO()) | |
n_steps = 2501 | |
for step in range(n_steps): | |
svi.step(data) | |
if step % 100 == 0: | |
print_progress() |
This file contains 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
def print_progress(): | |
alphas = pyro.param("alphas") | |
betas = pyro.param("betas") | |
if torch.cuda.is_available(): | |
alphas.cuda() | |
betas.cuda() | |
means = alphas / (alphas + betas) | |
normalized_means = means / torch.sum(means) |
This file contains 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
def guide(data): | |
alphas = pyro.param('alphas', torch.tensor(6.).expand(3), constraint=constraints.positive) | |
betas = pyro.param('betas', torch.tensor(10.).expand(3), constraint=constraints.positive) | |
pyro.sample('pay_probs', dist.Beta(alphas, betas).independent(1)) |
This file contains 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
def model(data): | |
alpha = torch.tensor(6.0) | |
beta = torch.tensor(10.0) | |
pay_probs = pyro.sample('pay_probs', dist.Beta(alpha, beta).expand(3).independent(1)) | |
normalized_pay_probs = pay_probs / torch.sum(pay_probs) | |
with pyro.iarange('data_loop', len(data)): | |
pyro.sample('obs', dist.Categorical(probs=normalized_pay_probs), obs=data) |
This file contains 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
# Tiger Jason James | |
data = torch.cat((torch.zeros(9), torch.ones(7), torch.empty(4).fill_(2.))) |
This file contains 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
pyro.enable_validation(True) | |
pyro.clear_param_store() |
This file contains 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
from __future__ import print_function | |
import math | |
import os | |
import torch | |
import torch.distributions.constraints as constraints | |
import pyro | |
from pyro.optim import Adam | |
from pyro.infer import SVI, Trace_ELBO | |
import pyro.distributions as dist |