たまに色々と忘れるので便利な資料をメモ
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 java.net.URI; | |
import java.net.URISyntaxException; | |
import java.sql.*; | |
public class PrestoJDBC { | |
// JDBC driver name and database URL | |
static final String JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver"; | |
//static final String JDBC_DRIVER = "com.teradata.presto.jdbc42.Driver"; | |
static final String DB_URL = "jdbc:presto://ec2-xx-xx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8889/hive/default"; |
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 random | |
class EpsilonGreedy(): | |
def __init__(self, epsilon, counts, values): | |
self.epsilon = epsilon # probability of explore | |
self.counts = counts # number of pulls for each arms | |
self.values = values # average amount of reward we've gotten from each arms | |
return | |
def initialize(self, n_arms): |
- ブログなど
- 日本語なら 今更聞けないLSTMの基本 がとても参考になる。
- In English: Understanding LSTM Networks
- Implementation
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
# OpenAI gym custom environment mimicking Blocking Maze | |
# See Sutton and Barto "Reinforcement Learning an Introduction" | |
# Example 8.2: Blocking Maze | |
from enum import Enum | |
import sys | |
import copy | |
import gym | |
from gym import error, spaces, utils | |
from gym.utils import seeding |
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
{ | |
"python.formatting.provider": "black", | |
"python.linting.pylintEnabled": false, | |
"python.linting.flake8Enabled": true, | |
"python.linting.flake8Args": [ | |
"--ignore=E501,W503" | |
], | |
"python.sortImports.args": [ | |
"-m 3" | |
], |
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 random | |
import numpy as np | |
np.random.seed(0) | |
def kerri(p, b): | |
"""https://en.wikipedia.org/wiki/Kelly_criterion | |
""" | |
return (p*(b+1)-1 )/b | |
N = 300 |
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 gym | |
import ray | |
from ray.rllib.agents.ppo import PPOTrainer, DEFAULT_CONFIG | |
import pprint as pp | |
#tune.run(PPOTrainer, config={"env": "Breakout-v0", "use_pytorch": True}) | |
ray.init(num_gpus=1, ignore_reinit_error=True, log_to_driver=False) | |
# https://github.com/ray-project/ray/blob/master/rllib/agents/ppo/ppo.py#L15 |
- ActivityNet
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
"""A template to implement RL agent with OpenAI Gym | |
Usage: python ./gym_template.py --env=CarRacing-v0 --algo=policy_gradient --epochs 1 | |
implementation of algorithms need to be ./algorithms/ directory, or change the following line to your env | |
> algo = import_module('algorithms.'+args.algo) | |
""" | |
import argparse | |
import numpy as np |
NewerOlder