MCPcopy Create free account
hub / github.com/davisking/dlib / make_problem

Function make_problem

dlib/test/auto_train_linear_classifier.cpp:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 // a little.
27 template <typename sample_type>
28 void make_problem(std::vector<sample_type>& x, std::vector<double>& y, const int num_pos = 20)
29 {
30 dlib::rand rnd;
31 for (int i = 0; i < 100; ++i)
32 {
33 const double label = i < num_pos ? +1 : -1;
34 const double a = label + rnd.get_random_gaussian();
35 const double b = rnd.get_random_gaussian();
36 if constexpr (is_matrix<sample_type>::value)
37 x.push_back({a, b});
38 else
39 x.push_back({{0, a}, {1, b}});
40 y.push_back(label);
41 }
42 }
43
44 // Returns the power of 10 C, between 1e-6 and 1e6, with which a class-balanced
45 // svm_c_linear_dcd_trainer gives df, or 0 if none does.

Callers 3

test_sparseFunction · 0.85
test_small_featuresFunction · 0.85
test_denseFunction · 0.85

Calls 2

get_random_gaussianMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected