MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_ad

Function get_ad

ab_testing/server_solution.py:51–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49
50@app.route('/get_ad')
51def get_ad():
52 if banditA.sample() > banditB.sample():
53 ad = 'A'
54 banditA.add_view()
55 else:
56 ad = 'B'
57 banditB.add_view()
58 return jsonify({'advertisement_id': ad})
59
60
61@app.route('/click_ad', methods=['POST'])

Callers

nothing calls this directly

Calls 2

add_viewMethod · 0.80
sampleMethod · 0.45

Tested by

no test coverage detected