Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bs.h « vowpalwabbit - github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c3c1e578d167780957abf4d230bbb3b54450f223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Copyright (c) by respective owners including Yahoo!, Microsoft, and
individual contributors. All rights reserved.  Released under a BSD
license as described in the file LICENSE.
 */
#ifndef BOOTSTRAP_H
#define BOOTSTRAP_H

#define BS_TYPE_MEAN 0
#define BS_TYPE_VOTE 1

#include "global_data.h"

namespace BS
{
  LEARNER::learner* setup(vw& all, std::vector<std::string>&, po::variables_map& vm, po::variables_map& vm_file);
  void print_result(int f, float res, float weight, v_array<char> tag, float lb, float ub);
  
  void output_example(vw& all, example* ec, float lb, float ub);

  inline uint32_t weight_gen()//sampling from Poisson with rate 1
  { 
    float temp = frand48();
    if(temp<=0.3678794411714423215955) return 0;
    if(temp<=0.735758882342884643191)  return 1;
    if(temp<=0.919698602928605803989)  return 2;
    if(temp<=0.9810118431238461909214) return 3;
    if(temp<=0.9963401531726562876545) return 4;
    if(temp<=0.9994058151824183070012) return 5;
    if(temp<=0.9999167588507119768923) return 6;
    if(temp<=0.9999897508033253583053) return 7;
    if(temp<=0.9999988747974020309819) return 8;
    if(temp<=0.9999998885745216612793) return 9;
    if(temp<=0.9999999899522336243091) return 10;
    if(temp<=0.9999999991683892573118) return 11;
    if(temp<=0.9999999999364022267287) return 12;
    if(temp<=0.999999999995480147453) return 13;
    if(temp<=0.9999999999996999989333) return 14;
    if(temp<=0.9999999999999813223654) return 15;
    if(temp<=0.9999999999999989050799) return 16;
    if(temp<=0.9999999999999999393572) return 17;
    if(temp<=0.999999999999999996817)  return 18;
    if(temp<=0.9999999999999999998412) return 19;
    return 20;
  }
}

#endif