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
#!/usr/bin/env python | |
import gym | |
import numpy as np | |
import tensorflow as tf | |
class PolicyGradientAgent(object): | |
def __init__(self, hparams, sess): |
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
# | |
# mnist_cnn_bn.py date. 5/21/2016 | |
# date. 6/2/2017 check TF 1.1 compatibility | |
# | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
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
# -*- coding:utf-8 -*- | |
''' | |
ある人が抗体を持っている確率 | |
p :[0-1) | |
想定する人数を配置する正方形の一辺 | |
N | |
''' | |
import numpy as np | |
import random | |
import seaborn as sns |
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
# -*- coding:utf-8 -*- | |
import numpy as np | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
import scipy.optimize as optimize | |
from multiprocessing import Pool | |
import os | |
from tqdm import tqdm | |
import multiprocessing as multi |
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 chainer | |
import chainer.functions as F | |
import chainer.links as L | |
import chainerrl | |
import gym | |
import numpy as np | |
# 描画用 | |
import matplotlib as mpl | |
mpl.use('Agg') |
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 matplotlib | |
# matplotlib.use("TkAgg") | |
import matplotlib.pyplot as plt | |
import gym | |
import numpy as np | |
def main(): | |
env = gym.make('CartPole-v0') | |
env.reset() | |
_ = env.render(mode='rgb_array') |
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 requests | |
import os | |
import pandas as pd | |
import collections | |
import pickle | |
def notify(message = 'done'): | |
pass |
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 matplotlib.pyplot as plt | |
import math | |
def xy2color(x,y): | |
norm = min(1.0,(x*x + y*y)**(1/2)) | |
rad = math.atan2(x,y)+math.pi | |
if rad < math.pi*2/3: | |
ratio = rad/(math.pi*2/3) | |
r = 1.-ratio | |
g = ratio | |
b = 0 |
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 matplotlib.pyplot as plt | |
import matplotlib.patches as pat | |
rot = lambda th:np.array([[np.cos(th),-np.sin(th)],[np.sin(th),np.cos(th)]]) | |
mu = np.array([0.,0.]) | |
S = np.array([[1,0],[0,6]]) @ rot(np.pi/3) | |
x = np.random.multivariate_normal(mu, S,10000) | |
fig = plt.figure(figsize=(10, 10)) | |
ax = fig.add_subplot(111) |
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 pprint | |
import numpy as np | |
class PolynomialPredictor(object): | |
def __init__(self,u,v,n=1,debug=True): | |
self.n = n | |
u = np.array(u) | |
A = np.array([u**i for i in range(self.n,-1,-1)]).T | |
b = np.array([v]).T | |
self.alpha = np.matmul(np.matmul( np.linalg.inv( np.matmul(A.T,A) ), A.T ), b ) | |
self.sum_of_se = np.sum((np.matmul(A,np.fliplr(self.alpha))-b)**2) |
OlderNewer