Skip to content

Change min to max on the explanation of the halo's radial profile fun… #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Chapter5_LossFunctions/Ch5_LossFunctions_PyMC2.ipynb

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions Chapter5_LossFunctions/Ch5_LossFunctions_PyMC3.ipynb

Large diffs are not rendered by default.

1,596 changes: 798 additions & 798 deletions Chapter5_LossFunctions/Ch5_LossFunctions_TFP.ipynb

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions Chapter6_Priorities/other_strats.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#other strats.
# TODO: UBC strat, epsilon-greedy
# TODO: UBC strat

import scipy.stats as stats
import numpy as np
Expand Down Expand Up @@ -28,7 +28,7 @@ class GeneralBanditStrat(object):

"""

def __init__(self, bandits, choice_function):
def __init__(self, bandits, choice_function, epsilon=0.1):

self.bandits = bandits
n_bandits = len(self.bandits)
Expand All @@ -38,6 +38,7 @@ def __init__(self, bandits, choice_function):
self.choices = []
self.score = []
self.choice_function = choice_function
self.epsilon = epsilon

def sample_bandits(self, n=1):

Expand Down Expand Up @@ -97,9 +98,13 @@ def ucb_bayes(self):
return np.argmax(beta.ppf(alpha,
1 + self.wins,
1 + self.trials - self.wins))




def epsilon_greedy(self):
prob = np.random.random()
if prob <= self.epsilon:
return np.random.randint(0, len(self.wins))
else:
return np.argmax(self.wins / (self.trials +1))

class Bandits(object):
"""
Expand Down