Spaces:
Runtime error
Runtime error
mathiasleys
commited on
Commit
·
018c4b8
1
Parent(s):
b2a365c
Limit possible plot size
Browse files- config.py +2 -0
- helpers/thompson_sampling.py +2 -0
config.py
CHANGED
@@ -6,3 +6,5 @@ VARIABLE_COST = 0.2
|
|
6 |
LATENT_ELASTICITY = 0.25
|
7 |
LATENT_SHAPE = 2
|
8 |
LATENT_STDEV = 0.25
|
|
|
|
|
|
6 |
LATENT_ELASTICITY = 0.25
|
7 |
LATENT_SHAPE = 2
|
8 |
LATENT_STDEV = 0.25
|
9 |
+
|
10 |
+
MAX_PRICE_SAMPLES = 20
|
helpers/thompson_sampling.py
CHANGED
@@ -109,6 +109,8 @@ class ThompsonSampler:
|
|
109 |
optimal_price = self.possible_prices[np.argmax(profit)]
|
110 |
if sample:
|
111 |
self.price_samples.append(optimal_price)
|
|
|
|
|
112 |
return optimal_price
|
113 |
|
114 |
def update_posteriors(self, samples=75):
|
|
|
109 |
optimal_price = self.possible_prices[np.argmax(profit)]
|
110 |
if sample:
|
111 |
self.price_samples.append(optimal_price)
|
112 |
+
if len(self.price_samples) > cfg.MAX_PRICE_SAMPLES:
|
113 |
+
self.price_samples.pop(0)
|
114 |
return optimal_price
|
115 |
|
116 |
def update_posteriors(self, samples=75):
|