Skip to content

Instantly share code, notes, and snippets.

View duarteguilherme's full-sized avatar

Guilherme Jardim Duarte duarteguilherme

  • Wharton School
  • Philadelphia
View GitHub Profile
# Simulando probabilidades
# Teste
simula_eleicoes <- function(sd) {
ns <- seq(0.25, 0.75, 0.001)
v <- purrr::map_dbl(ns, ~ mean(
ifelse(
rnorm(n = 100000, mean = .x, sd = sd) > .5
, 1, 0 )
)
)
import os
from itertools import repeat
import requests
import json
from multiprocessing.dummy import Pool as ThreadPool
def le_json():
""" Carrega arquivo de dados json para leitura
"""
if os.path.isfile('./dados.json') is False:
library(tidyverse)
# Colliders
x1 <- rnorm(1000)
y <- 1.2 + 1.6 * x1 + rnorm(1000)
z <- 0.6 + 1.3*x1 + 1.5*y + rnorm(1000)
from PIL import Image, ImageFilter
import os
import requests
import numpy as np
import hashlib
import pickle
def classifica_arquivo():
url = 'http://www.cmc.pr.gov.br/wspl/jcaptcha.jpg'
content = requests.get(url)
from keras.models import Model, Input,Sequential
from keras.layers import Dense
from keras.optimizers import Adam # not important as there's no training here.
import numpy as np
from sklearn.datasets import load_digits
import numpy as np
digits = load_digits()
import requests
from bs4 import BeautifulSoup
import json
import sys
class Crawler:
def __init__(self, uf):
self.url = "http://www.cnj.jus.br/bnmp/rest/pesquisar"
self.uf = uf
input("teste uf: " + uf + " pode ir?")
import urllib.request
import json
jsondata = json.loads(urllib.request.urlopen('https://reddit.com/.json').read())
# Dicionario guarda numero de cada estrutura de dados
count = { 'n_dicts': 0, 'n_lists': 0 }
lookback <- 50
model <- keras_model_sequential()
model %>%
layer_lstm(units = lookback,input_shape=c(1,lookback), activation = "relu") %>%
layer_dense(units = 1, activation = "linear")
# try using different optimizers and different optimizer configs
model %>% compile(

Exercises for practicing tidyverse

Tidyverse is a set of packaged created by Hadley Wickham that changed the way R looks and works.

With these exercises, we intend to employ public datasets in order to challenge people.

Solving harder exercises, one can get better at tidy packages.

It's gonna be comprehensive of packages such as dplyr, purrr, tidyr, ggplot2, and lots of others

List of datasets included in packages.

  • Encontrar o ponto de acesso para o banco da Digesto
  • Achar lista de envolvidos no banco da Digesto