Vowpal Wabbit
bs.h
Go to the documentation of this file.
1 /*
2 Copyright (c) by respective owners including Yahoo!, Microsoft, and
3 individual contributors. All rights reserved. Released under a BSD
4 license as described in the file LICENSE.
5  */
6 #pragma once
7 #include <memory>
8 #define BS_TYPE_MEAN 0
9 #define BS_TYPE_VOTE 1
10 
11 struct rand_state;
12 
14 
15 namespace BS
16 {
17 inline uint32_t weight_gen(std::shared_ptr<rand_state>& state) // sampling from Poisson with rate 1
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 }
62 } // namespace BS
uint32_t weight_gen(std::shared_ptr< rand_state > &state)
Definition: bs.h:17
Definition: bs.h:15
LEARNER::base_learner * bs_setup(VW::config::options_i &options, vw &all)
Definition: bs.cc:231