Bernd-Ebenhoch commited on
Commit
d064765
·
1 Parent(s): b9ca64f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -18,7 +18,7 @@ model = tf.keras.models.Sequential()
18
  model.add(tf.keras.layers.Dense(1, activation="sigmoid", input_shape=(1,)))
19
  model.summary()
20
 
21
- information_for_plotting = np.zeros((epochs, 10))
22
 
23
 
24
  @tf.function()
@@ -54,10 +54,12 @@ learning_rate = st.text_area('Learning rate', value=0.1, height=25)
54
 
55
  prob_A = st.text_area('Click probability of ad A', 0.4, height=75)
56
 
57
- prob_A = st.text_area('Click probability of ad B', 0.5, height=75)
58
 
59
  epochs = st.text_area('Number of ad impressions (epochs)', 2000, height=75)
60
 
 
 
61
  if st.button('Modell trainieren und Fit-Kurve darstellen'):
62
 
63
  with st.spinner('Simulating the ad campaign may take a few seconds ...'):
@@ -73,10 +75,10 @@ if st.button('Modell trainieren und Fit-Kurve darstellen'):
73
  # than Ad B with 50% click rate
74
  # We consider the click rate as a measure of the reward for training
75
  if action == False: # Action A
76
- reward = float(np.random.random() < 0.4)
77
 
78
  if action == True: # Action B
79
- reward = float(np.random.random() < 0.5)
80
 
81
  # The gradients obtained above are multiplied with the acquired reward
82
  # Gradients for actions that lead to clicks are kept unchanged,
 
18
  model.add(tf.keras.layers.Dense(1, activation="sigmoid", input_shape=(1,)))
19
  model.summary()
20
 
21
+
22
 
23
 
24
  @tf.function()
 
54
 
55
  prob_A = st.text_area('Click probability of ad A', 0.4, height=75)
56
 
57
+ prob_B = st.text_area('Click probability of ad B', 0.5, height=75)
58
 
59
  epochs = st.text_area('Number of ad impressions (epochs)', 2000, height=75)
60
 
61
+ information_for_plotting = np.zeros((epochs, 10))
62
+
63
  if st.button('Modell trainieren und Fit-Kurve darstellen'):
64
 
65
  with st.spinner('Simulating the ad campaign may take a few seconds ...'):
 
75
  # than Ad B with 50% click rate
76
  # We consider the click rate as a measure of the reward for training
77
  if action == False: # Action A
78
+ reward = float(np.random.random() < prob_A)
79
 
80
  if action == True: # Action B
81
+ reward = float(np.random.random() < prob_B)
82
 
83
  # The gradients obtained above are multiplied with the acquired reward
84
  # Gradients for actions that lead to clicks are kept unchanged,