Skip to content

Instantly share code, notes, and snippets.

View syuntoku14's full-sized avatar

Toshinori Kitamura syuntoku14

  • The University of Tokyo
View GitHub Profile
@syuntoku14
syuntoku14 / MountainCar.py
Created April 27, 2018 15:44
Q-Learning by Open ai gym
import gym
from gym import wrappers
import numpy as np
import matplotlib.pyplot as plt
"""
For practicing reinforcement learning
observation:
(position,velocity)
@syuntoku14
syuntoku14 / CartPole-Q_Learning.ipynb
Created May 9, 2018 14:23
OpenAI gym CartPole learned by Q-Learning
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@syuntoku14
syuntoku14 / md2html.bash
Last active May 31, 2018 15:39
change md to html (set the variable 'today' if you want to create today's md)
#!/usr/bin/env bash
function _func_create_md(){
kyo=`date +%y%m%d`
kyo_md="${kyo}.md"
if ! [ -e "${kyo_md}" ]; then
: > "${kyo_md}"
fi
}
@syuntoku14
syuntoku14 / swms2urdf.bash
Last active June 22, 2018 02:24
Solidworksの質量特性をURDF形式にして表示するスクリプト
#!/usr/bin/env bash
mass=`grep ^質量 "$1" | sed -e "s/[^0-9.]//g"`
echo "<mass value=\"$mass\"/>"
# extract ixx, ixy, ixz
temp=`grep Ixx "$1" | sed -e "s/[a-z = A-Z]//g"`
declare xx=() # declare matrix
@syuntoku14
syuntoku14 / kalman_filter.m
Last active June 30, 2018 01:21
Kalman Filter program with Matlab
% Simulation of Kalman_Filter
% In this script, error_ellipse function is used. Please download here:
% https://www.mathworks.com/matlabcentral/fileexchange/4705-error-ellipse
clear; close all;
fig = figure;
hold on;
% Initial State
x0 = [0, 0].';
@syuntoku14
syuntoku14 / prediction_step.m
Last active July 3, 2018 09:14
Prediction step of Kalman Filter
% Simulation of Kalman_Filter
% In this script, error_ellipse function is used. Please download here:
% https://www.mathworks.com/matlabcentral/fileexchange/4705-error-ellipse
clear; close all;
fig = figure;
hold on;
% Initial State
x0 = [0, 0].';
@syuntoku14
syuntoku14 / flow_run.bash
Last active March 23, 2019 08:27
Command to run the flow on the headless server(without vnc) Please see https://flow.readthedocs.io/en/latest/flow_setup.html#id16
docker run -it --rm \
--net=host \
-e DISPLAY=$DISPLAY \
-v /home/syuntoku/.Xauthority:/headless/.Xauthority:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--entrypoint=/bin/bash \
lucasfischerberkeley/flowdesktop
# inside the container, run "conda activate flow-rllab"
@syuntoku14
syuntoku14 / setup_DL.bash
Created June 27, 2019 14:17
Install DL packages
# install python packages
conda config --add channels conda-forge
conda install -y jupyter pytorch torchvision -c pytorch
conda install -y pyvirtualdisplay
yes | pip3 install torchvision
yes | pip3 install gym "gym[atari]"
# Configure jupyter notebook server
jupyter notebook --generate-config
echo "c = get_config()" >> ~/.jupyter/jupyter_notebook_config.py
import argparse
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
import sys
from torch.nn.utils import clip_grad_norm_
import parser
import torch
import os
import argparse
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
from pytorch_pretrained_bert import BertModel, BertTokenizer
import torch.nn.utils.rnn as rnn
import torch.nn.functional as F
import torch.utils.data as data
import sys