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 numpy as np | |
from sklearn.metrics import confusion_matrix | |
from matplotlib import pyplot as plt | |
import itertools | |
def plot_confusion_matrix(cm, classes, | |
normalize=False, | |
title='Confusion matrix', | |
cmap=plt.cm.Blues): | |
""" |
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
#!/bin/bash | |
# install CUDA Toolkit v8.0 | |
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} | |
sudo dpkg -i ${CUDA_REPO_PKG} | |
sudo apt-get update | |
sudo apt-get -y install cuda |
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 model="inverted pendulum"> | |
<compiler angle="radian"/> | |
<option timestep="0.001" iterations="20"> | |
<flag sensornoise="enable"/> | |
</option> | |
<default> | |
<geom rgba="0.45 0.6 0.6 1"/> |
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
# https://mail.python.org/pipermail/scipy-user/2011-May/029521.html | |
import numpy as np | |
def KLdivergence(x, y): | |
"""Compute the Kullback-Leibler divergence between two multivariate samples. | |
Parameters | |
---------- | |
x : 2D array (n,d) |
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 os | |
import numpy as np | |
import torch | |
from PIL import Image | |
def gather(consts: torch.Tensor, t: torch.Tensor): | |
"""Gather consts for $t$ and reshape to feature map shape""" | |
c = consts.gather(-1, t) |