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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func feedChannel(c chan int) { | |
//aqui vamos feedar nosso canal | |
for i := 0; i < 10; i++ { |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
func feedChannel(c chan int, wg *sync.WaitGroup) { | |
//aqui vamos feedar nosso canal | |
for i := 0; i < 10; i++ { |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
"webmotor_crawler/crawl_functions" | |
) | |
func main() { |
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
package crawl_functions | |
import ( | |
"fmt" | |
"strconv" | |
"sync" | |
) | |
func FeedChannel(page_start int, page_nmr int, c chan int, wg *sync.WaitGroup) { | |
/* |
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
package crawl_functions | |
import ( | |
"fmt" | |
"sync" | |
"webmotor_crawler/query_handler" | |
) | |
func CrawlRoutine(wg *sync.WaitGroup, c chan int) { | |
/* |
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
package query_handler | |
import ( | |
"net/http" | |
"net/url" | |
"golang.org/x/net/proxy" | |
) | |
type QueryClient struct { |
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
package query_handler | |
import ( | |
"compress/gzip" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
) |
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
import torch | |
from torch import nn | |
from blitz.modules import BayesianLinear | |
class BayesianRegressor(nn.Module): | |
def __init__(self, input_dim, output_dim): | |
super().__init__() | |
self.linear = nn.Linear(input_dim, output_dim) | |
self.blinear1 = BayesianLinear(input_dim, 64) | |
self.blinear2 = BayesianLinear(64, output_dim) |
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
@variational_estimator | |
class BayesianRegressor(nn.Module): | |
def __init__(self,): | |
super().__init__() | |
#self.linear = nn.Linear(input_dim, output_dim) | |
self.blinear1 = BayesianLinear(input_dim, 512) | |
self.blinear2 = BayesianLinear(512, output_dim) | |
def forward(self, x): | |
x_ = self.blinear1(x) |
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
iteration = 0 | |
for epoch in range(100): | |
for i, (datapoints, labels) in enumerate(dataloader_train): | |
optimizer.zero_grad() | |
loss = regressor.sample_elbo(inputs=datapoints, | |
labels=labels, | |
criterion=criterion, | |
sample_nbr=3) | |
loss.backward() |