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
for t in range(T): | |
exp_feat += gamma**t * (trajectory[t, :] - goal)**2 |
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
class QPoptimizer(object): | |
def __call__(self, feature_num, learner, expert): | |
w = cp.Variable(feature_num) | |
obj_func = cp.Minimize(cp.norm(w)) | |
constraints = [(expert-learner) @ w >= 2] | |
prob = cp.Problem(obj_func, constraints) | |
prob.solve() |
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
''' | |
Convert videos to .gif files. | |
@date: 28.02.2018 | |
@author: Todor Davchev | |
''' | |
import argparse | |
import os |
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 numpy as np | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
def smooth(scalars, weight): | |
last = scalars[0] | |
smoothed = list() | |
for point in scalars: | |
smoothed_val = last * weight + (1-weight)*point |
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 numpy as np | |
# Taken from https://github.com/openai/baselines/blob/master/baselines/ddpg/noise.py | |
# based on http://math.stackexchange.com/questions/1287634/implementing-ornstein-uhlenbeck-in-matlab | |
class OrnsteinUhlenbeckActionNoise(object): | |
def __init__(self, mu, sigma=0.3, theta=.15, dt=1e-2, x_0=None): | |
self.theta = theta | |
self.mu = mu | |
self.sigma = sigma | |
self.dt = dt |
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
sudo rm /usr/lib/i386-linux-gnu/mesa/libGL.so.1 |
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
def get_model_params(self): | |
# get trainable params. | |
model_names = [] | |
model_params = [] | |
model_shapes = [] | |
with self.g.as_default(): | |
t_vars = tf.trainable_variables() | |
for var in t_vars: | |
param_name = var.name | |
p = self.sess.run(var) |
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 pickle | |
import numpy as np | |
def social_frame_preprocess(): | |
''' | |
Preprocess the frames from the datasets. | |
Convert values to pixel locations from millimeters | |
obtain and store all frames data the actually used frames (as some are skipped), | |
the ids of all pedestrians that are present at each of those frames and the sufficient statistics. | |
''' |
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
from scipy import misc | |
import numpy as np | |
import random | |
from pylab import * | |
import matplotlib.pyplot as plt | |
import matplotlib.image as mpimg | |
import matplotlib.pyplot as plt | |
im = misc.imread('lena512.bmp') | |
im = np.asarray(im) |
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
" This must be first, because it changes other options as side effect | |
set nocompatible | |
" Use pathogen to easily modify the runtime path to include all | |
" plugins under the ~/.vim/bundle directory | |
call pathogen#helptags() | |
call pathogen#infect() | |
" Quickly edit/reload the vimrc file | |
" nmap <silent> <leader>ev :e $MYVIMRC<CR> |
NewerOlder