Vowpal Wabbit
Functions
BS Namespace Reference

Functions

uint32_t weight_gen (std::shared_ptr< rand_state > &state)
 

Function Documentation

◆ weight_gen()

uint32_t BS::weight_gen ( std::shared_ptr< rand_state > &  state)
inline

Definition at line 17 of file bs.h.

Referenced by predict_or_learn(), CB_EXPLORE::predict_or_learn_bag(), and VW::cb_explore_adf::bag::cb_explore_adf_bag::predict_or_learn_impl().

18 {
19  float temp = state->get_and_update_random();
20  if (temp <= 0.3678794411714423215955)
21  return 0;
22  if (temp <= 0.735758882342884643191)
23  return 1;
24  if (temp <= 0.919698602928605803989)
25  return 2;
26  if (temp <= 0.9810118431238461909214)
27  return 3;
28  if (temp <= 0.9963401531726562876545)
29  return 4;
30  if (temp <= 0.9994058151824183070012)
31  return 5;
32  if (temp <= 0.9999167588507119768923)
33  return 6;
34  if (temp <= 0.9999897508033253583053)
35  return 7;
36  if (temp <= 0.9999988747974020309819)
37  return 8;
38  if (temp <= 0.9999998885745216612793)
39  return 9;
40  if (temp <= 0.9999999899522336243091)
41  return 10;
42  if (temp <= 0.9999999991683892573118)
43  return 11;
44  if (temp <= 0.9999999999364022267287)
45  return 12;
46  if (temp <= 0.999999999995480147453)
47  return 13;
48  if (temp <= 0.9999999999996999989333)
49  return 14;
50  if (temp <= 0.9999999999999813223654)
51  return 15;
52  if (temp <= 0.9999999999999989050799)
53  return 16;
54  if (temp <= 0.9999999999999999393572)
55  return 17;
56  if (temp <= 0.999999999999999996817)
57  return 18;
58  if (temp <= 0.9999999999999999998412)
59  return 19;
60  return 20;
61 }