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
library(tidyverse) | |
scooby_data <- read.csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-07-13/scoobydoo.csv") | |
x <- | |
scooby_data %>% | |
select(season, title, | |
starts_with("caught"), | |
starts_with("captured"), | |
starts_with("unmask"), |
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
# Setup ------------------------------------------------------------------- | |
librarian::shelf(tidyverse, lubridate, systemfonts, ggtext, ragg, | |
ggbump) | |
scoobydoo <- | |
readr::read_csv( | |
'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-07-13/scoobydoo.csv', | |
na = 'NULL' | |
) | |
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
library(tidyverse) | |
# Download Fira Sans Condensed from | |
# https://fonts.google.com/specimen/Fira+Sans+Condensed | |
high_mean <- 12 | |
high_sd <- 4 | |
flat_mean <- 35 | |
flat_sd <- 12 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/bin/bash | |
if ! dpkg-query -W cuda; then | |
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
fi | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install tmux build-essential gcc g++ make binutils software-properties-common cuda unzip | |
modprobe nvidia | |
nvidia-smi |
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
gcloud compute snapshots list | |
gcloud compute disks create deep-learning-persistent-disk-1 --size=25GB --source-snapshot=deep-learning-snapshot-1 | |
gcloud beta compute instances create gpu-instance-1 \ | |
--machine-type n1-standard-1 --zone asia-east1-a \ | |
--accelerator type=nvidia-tesla-k80,count=1 \ | |
--image-family ubuntu-1604-lts --image-project ubuntu-os-cloud \ | |
--maintenance-policy TERMINATE --no-restart-on-failure \ | |
--disk=auto-delete=yes,boot=yes,name=deep-learning-persistent-disk-1 | |
gcloud compute instances add-tags gpu-instance-1 --tags https-server |
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
gcloud beta compute instances create gpu-instance-1 \ | |
--machine-type n1-standard-1 --zone asia-east1-a \ | |
--accelerator type=nvidia-tesla-k80,count=1 \ | |
--image-family ubuntu-1604-lts --image-project ubuntu-os-cloud \ | |
--maintenance-policy TERMINATE --no-restart-on-failure \ | |
--boot-disk-size=25GB |
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 math | |
import random | |
def get_random_neighbour(state): | |
neighbour = [house[:] for house in state] # Deep copy | |
i, j = random.sample(xrange(5), 2) | |
attr_idx = random.randint(0, 4) | |
neighbour[i][attr_idx], neighbour[j][attr_idx] = neighbour[j][attr_idx], neighbour[i][attr_idx] |
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
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
NewerOlder