The algorithm uses a custom built Q Learning agent in Python 3. https://github.com/ryanpeach/openaigym/tree/FrozenLake-QLearner
- Python 3
- Tensorflow
- Numpy
- Scipy
The algorithm uses a custom built Q Learning agent in Python 3. https://github.com/ryanpeach/openaigym/tree/FrozenLake-QLearner
import numpy as np | |
import cv2 | |
import random | |
import scipy.stats | |
# Matplotlib | |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt |
import random as rand | |
from functools import partial | |
def twiddle(run, args, p, dp, tol = 0.2, N = 100, logger = None): | |
""" Uses gradient descent to find the optimal value of p as input for function run. | |
run is a function which takes p as an argument and returns an error (with 0 being optimal) as an output. | |
dp is the initial magnitute for each index of p to begin | |
N is the max number of iterations, after which the best value of p is returned. | |
tol is the max error allowed, under which this function will terminate. """ | |
best_err, best_p, best_dp, n = 1000000, None, None, 0 |
def grid_plot(x_label, y_label, z_label, data, ax=None): | |
""" Useful if you have a dataframe, with a certain number of unique categories or values in x and y, | |
and you want to compare them visually to a third continuous value. """ | |
if ax is None: | |
ax = plt.gca() | |
x_val = np.sort(np.unique(data[x_label])) | |
y_val = np.sort(np.unique(data[y_label])) | |
x_idx = np.arange(len(x_val)) | |
y_idx = np.arange(len(y_val)) |
# coding: utf-8 | |
import subprocess | |
import re | |
def get_windows(): | |
list_of_windows = subprocess.check_output(["wmctrl","-l"]).split(b"\n") | |
meta_list_of_windows = [s.decode("utf-8").split() for s in list_of_windows if s] | |
user_processes = {} | |
for line in meta_list_of_windows: |
from copy import deepcopy | |
import networkx as nx | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
G = nx.DiGraph() | |
class Literal(str): |
from time import time, sleep | |
from functools import wraps | |
import socket | |
import unittest | |
class TimeoutError(socket.timeout): | |
pass | |
none_val = lambda x: 0.0 if x is None else float(x) # Returns float(x), or 0 if x is None |
#!/usr/bin/env bash | |
export PROJECT_DIR=$(git rev-parse --show-toplevel) |
import time | |
import functools | |
from boto3.exceptions import ThrottlingException | |
def throttling_handler(func): | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
while True: | |
try: |