Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created May 13, 2019 17:04
Show Gist options
  • Select an option

  • Save ikatsov/49fb2429eb351519c783690dc4dd38b5 to your computer and use it in GitHub Desktop.

Select an option

Save ikatsov/49fb2429eb351519c783690dc4dd38b5 to your computer and use it in GitHub Desktop.
def get_event_pr(d, f):
f_ids = offer_seq(f) # sequence of offer IDs received by the customer
f_ids = np.concatenate((offer_seq(f), np.zeros(3 - len(f_ids))))
if((f_ids[0] == 1 and f_ids[1] == 3) or
(f_ids[1] == 1 and f_ids[2] == 3) or
(f_ids[0] == 1 and f_ids[2] == 3)):
p_events = [0.70, 0.08, 0.22] # higher probability of purchase
else:
p_events = [0.90, 0.08, 0.02] # default behavior
if(np.random.binomial(1, 0.1) > 0): # add some noise
p_events = [0.70, 0.08, 0.22]
return p_events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment