jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
Functions
regression_test_util.hpp File Reference
#include <cstdlib>
#include <cmath>
#include <cfloat>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include "jubatus/util/math/random.h"
Include dependency graph for regression_test_util.hpp:

Go to the source code of this file.

Functions

std::pair< float, std::vector< double > > gen_random_data (float mu, float sigma, size_t dim)
 
void make_gaussian_random (float mu, float sigma, size_t dim, std::vector< double > &v)
 
void make_random (size_t dim, std::vector< double > &v)
 

Function Documentation

std::pair<float, std::vector<double> > gen_random_data ( float  mu,
float  sigma,
size_t  dim 
)

Definition at line 49 of file regression_test_util.hpp.

References make_gaussian_random(), and make_random().

52  {
53  std::pair<float, std::vector<double> > p;
54 
55  std::vector<double> coef;
56  make_random(dim, coef);
57  make_gaussian_random(mu, sigma, dim , p.second);
58  for (size_t i = 0; i < dim; i++) {
59  p.first += p.second[i] * coef[i];
60  }
61  return p;
62 }
void make_random(size_t dim, std::vector< double > &v)
void make_gaussian_random(float mu, float sigma, size_t dim, std::vector< double > &v)

Here is the call graph for this function:

void make_gaussian_random ( float  mu,
float  sigma,
size_t  dim,
std::vector< double > &  v 
)

Definition at line 29 of file regression_test_util.hpp.

Referenced by gen_random_data().

33  {
34  jubatus::util::math::random::mtrand rand(0);
35  for (size_t i = 0; i < dim; i++) {
36  float value = rand.next_gaussian(mu, sigma);
37  v.push_back(value);
38  }
39 }
std::vector< T > v(size)

Here is the caller graph for this function:

void make_random ( size_t  dim,
std::vector< double > &  v 
)

Definition at line 41 of file regression_test_util.hpp.

Referenced by gen_random_data().

41  {
42  jubatus::util::math::random::mtrand rand(0);
43  for (size_t i = 0; i < dim; i++) {
44  double value = rand.next_double();
45  v.push_back(value);
46  }
47 }
std::vector< T > v(size)

Here is the caller graph for this function: