#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
import optuna | |
from optuna.trial import TrialState | |
import numpy as np | |
from typing import Dict, List, Optional | |
from collections import defaultdict | |
class ParamRepeatPruner: | |
"""Prunes reapeated trials, which means trials with the same paramters won't waste time/resources.""" |
import jax | |
import jax.numpy as np | |
from jax import grad, jit | |
from jax.scipy.special import logsumexp | |
def dadashi_fig2d(): | |
""" Figure 2 d) of | |
''The Value Function Polytope in Reinforcement Learning'' | |
by Dadashi et al. (2019) https://arxiv.org/abs/1901.11524 |
# null.py | |
import numpy as np | |
from scipy.linalg import qr | |
def qr_null(A, tol=None): | |
Q, R, P = qr(A.T, mode='full', pivoting=True) | |
tol = np.max(A) * np.finfo(R.dtype).eps if tol is None else tol | |
rnk = min(A.shape) - np.abs(np.diag(R))[::-1].searchsorted(tol) | |
return Q[:, rnk:].conj() |
import numpy as np | |
import bottleneck as bn | |
def top_n_indexes(arr, n): | |
idx = bn.argpartsort(arr, arr.size-n, axis=None)[-n:] | |
width = arr.shape[1] | |
return [divmod(i, width) for i in idx] | |
np.random.seed(47) |
#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
require 'torch' | |
require 'cutorch' | |
require 'nn' | |
require 'cunn' | |
require 'cudnn' | |
local N = 32 | |
local cin = 64 | |
local cout = 64 | |
local height = 256 |