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
class RNN(nn.Module): | |
"""Recurrent Neural Network | |
original source: https://goo.gl/12wiKB | |
Simple implementation of an RNN with two linear layers and a LogSoftmax | |
layer on the output | |
Args: | |
input_size: (int) size of data | |
hidden_size: (int) number of hidden units | |
output_size: (int) size of output | |
""" |
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 gender_features(name): | |
features = {} | |
features["last_letter"] = name[-1].lower() | |
features["first_letter"] = name[0].lower() | |
# names ending in -yn are mostly female, names ending in -ch are mostly male, so add 3 more features | |
features["suffix2"] = name[-2:] | |
features["suffix3"] = name[-3:] | |
features["suffix4"] = name[-4:] | |
return features |
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 sys | |
from collections import defaultdict | |
from tqdm import tqdm | |
import spotipy | |
from spotipy.oauth2 import SpotifyClientCredentials | |
CLIENT_ID = "9f64faf742764cf48d556ecc64ea2b1e" | |
CLIENT_SECRET = "56c58af2d3d845beb7102a466dd4f8a7" | |
USERNAME = "" |
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 name_to_tensor(name, cuda=False): | |
"""converts a name to a vectorized numerical input for use with a nn | |
each character is converted to a one hot (n, 1, 26) tensor | |
Args: | |
name (string): first name (e.g., "Ellis") | |
Return: | |
tensor (torch.tensor) | |
""" | |
name = clean_str(name) | |
tensor = torch.cuda.FloatTensor if cuda else torch.FloatTensor |
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
CONDA_DIR=~/miniconda3 | |
OS_VERS=Linux-x86_64 | |
mkdir -p $CONDA_DIR | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-$OS_VERS.sh -O $CONDA_DIR/miniconda.sh | |
bash $CONDA_DIR/miniconda.sh -b -u -p $CONDA_DIR | |
rm -rf $CONDA_DIR/miniconda.sh | |
$CONDA_DIR/bin/conda init bash | |
$CONDA_DIR/bin/conda init zsh |
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
ARCH=x86_64 | |
MUJOCO_DIR=~/.mujoco | |
mkdir -p $MUJOCO_DIR | |
wget https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-$ARCH.tar.gz -O $MUJOCO_DIR/mujoco.tar.gz | |
tar -xzf $MUJOCO_DIR/mujoco.tar.gz -C $MUJOCO_DIR | |
rm $MUJOCO_DIR/mujoco.tar.gz |
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
VERSION=2.1.1 | |
ARCH=x86_64 | |
MUJOCO_DIR=~/.mujoco | |
mkdir -p $MUJOCO_DIR | |
wget https://github.com/deepmind/mujoco/releases/download/$VERSION/mujoco-$VERSION-linux-$ARCH.tar.gz -O $MUJOCO_DIR/mujoco.tar.gz | |
tar -xzf $MUJOCO_DIR/mujoco.tar.gz -C $MUJOCO_DIR | |
rm $MUJOCO_DIR/mujoco.tar.gz |
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
MUJOCO_DIR=~/.mujoco | |
mkdir -p $MUJOCO_DIR | |
# 200 | |
wget https://roboti.us/download/mujoco200_linux.zip -O $MUJOCO_DIR/mujoco200.zip | |
unzip $MUJOCO_DIR/mujoco200.zip | |
wget https://roboti.us/file/mjkey.txt -P $MUJOCO_DIR | |
rm $MUJOCO_DIR/mujoco200.zip | |
# 210 |
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
MUJOCO_DIR=~/.mujoco | |
mkdir -p $MUJOCO_DIR | |
wget https://roboti.us/download/mujoco200_linux.zip -O $MUJOCO_DIR/mujoco200.zip | |
unzip $MUJOCO_DIR/mujoco200.zip | |
wget https://roboti.us/file/mjkey.txt -P $MUJOCO_DIR | |
rm $MUJOCO_DIR/mujoco200.zip | |
# symlink to mujoco200 (this is what mujoco-py looks for) | |
ln -s $MUJOCO_DIR/mujoco200_linux $MUJOCO_DIR/mujoco200 |
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
# SHORCUTS | |
# Ctrl - T new vertical pane | |
# Ctrl + U new hroizontal plane | |
# Alt + P kill pane | |
# Alt + W kill window | |
# Alt + P kill session | |
# Page Up / Page Down - shift windows | |
# 0 is too far from ` ;) | |
set -g base-index 1 |
OlderNewer