Skip to content

Instantly share code, notes, and snippets.

View caffeine-potent's full-sized avatar

Otto Wagner caffeine-potent

View GitHub Profile
@caffeine-potent
caffeine-potent / numdict.py
Last active February 23, 2017 18:40
select numerical keys in dictionary
my_dict = dict({
1 : "",
2 : "",
3 : "oyy",
"oyy" : "",
1990 : 's kid',
2000 : "a",
2014 : "b",
2015 : "c",
"foo" : "bar",
import math
import random
def categorical_draw(probs):
'''
if
P(A) = .5
P(B) = .2
P(C) = .3
import math
import random
def categorical_draw(probs):
'''
if
P(A) = .5
P(B) = .2
P(C) = .3
@caffeine-potent
caffeine-potent / EpsilonGreedy.py
Created February 10, 2017 20:03
Epsilon Greedy from "Bandit Algorithms"
import numpy as np
class EpsGreedy()
def __init__(self, number_of_bandits, epsilon, start_greedy= True):
self.count = np.zeros(number_of_bandits)
self.scores = np.array([int(!start_greedy)] * number of bandits)
self.epsilon = epsilon
self.bandit_count = number_of_bandits
def select_arm():
choice = np.random.binomial(1,self.epsilon):
if choice = 1: #EXPLORE
@caffeine-potent
caffeine-potent / data.py
Last active February 14, 2017 15:29
Dynamic Allocation
class B:
def __init__(self):
self.data = []
def update(self, row):
for r in row:
self.data.append(r)
def finalize(self):
return np.reshape(self.data, newshape=(len(self.data)/5, 5))
ax = B()
@caffeine-potent
caffeine-potent / map.geojson
Last active December 23, 2018 06:59
Extent collections of terminal for image recognition project.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.