Skip to content
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

Getting negative values calculating time steps for m > 4 in book-enterprise-ai-edition-2/recipe-10/dynamic-pricing-limited-experimentation.ipynb #15

Open
isque03 opened this issue May 2, 2023 · 0 comments

Comments

@isque03
Copy link

isque03 commented May 2, 2023

Fantastic job on the book and notebooks in this repository.

I was working with book-enterprise-ai-edition-2/recipe-10/dynamic-pricing-limited-experimentation.ipynb and saw one minor issue.
I wanted to see what the timesteps looked like if I used a larger value of m (Using 6 price steps max rater than 4).
When I changed m to a higher value, then eventually the logx function attempts to calculate log of a value < 1 which returns a negative number.

This is the current function:
def logx(x, n):
for i in range(0, n):
x = math.log(x) if x>0 else 0
return x

To avoid that, I beleive this line:
x = math.log(x) if x>0 else 0
should be changed to:
x = math.log(x) if x>1 else 0

From section 3.2 (Notations) here: https://dspace.mit.edu/bitstream/handle/1721.1/119156/Pricing_v4_a.pdf?sequence=1&isAllowed=y

"We use log(m)T to represent m iterations of the logarithm, log(log(... log(T))), where m is the number of price changes.
For convenience, we let log(x) = 0 for all 0 ≤ x < 1, so the value of log(m) T is defined for all T ≥ 1."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant