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

Function setup_auto_train_rbf_classifier

tools/python/src/decision_functions.cpp:380–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378
379
380void setup_auto_train_rbf_classifier (py::module& m)
381{
382 m.def("auto_train_rbf_classifier", [](
383 const std::vector<matrix<double,0,1>>& x,
384 const std::vector<double>& y,
385 double max_runtime_seconds,
386 bool be_verbose
387 ) { return auto_train_rbf_classifier(x,y,std::chrono::microseconds((uint64_t)(max_runtime_seconds*1e6)),be_verbose); },
388 py::arg("x"), py::arg("y"), py::arg("max_runtime_seconds"), py::arg("be_verbose")=true,
389"requires \n\
390 - y contains at least 6 examples of each class. Moreover, every element in y \n\
391 is either +1 or -1. \n\
392 - max_runtime_seconds >= 0 \n\
393 - len(x) == len(y) \n\
394 - all the vectors in x have the same dimension. \n\
395ensures \n\
396 - This routine trains a radial basis function SVM on the given binary \n\
397 classification training data. It uses the svm_c_trainer to do this. It also \n\
398 uses find_max_global() and 6-fold cross-validation to automatically determine \n\
399 the best settings of the SVM's hyper parameters. \n\
400 - Note that we interpret y[i] as the label for the vector x[i]. Therefore, the \n\
401 returned function, df, should generally satisfy sign(df(x[i])) == y[i] as \n\
402 often as possible. \n\
403 - The hyperparameter search will run for about max_runtime and will print \n\
404 messages to the screen as it runs if be_verbose==true."
405 /*!
406 requires
407 - y contains at least 6 examples of each class. Moreover, every element in y
408 is either +1 or -1.
409 - max_runtime_seconds >= 0
410 - len(x) == len(y)
411 - all the vectors in x have the same dimension.
412 ensures
413 - This routine trains a radial basis function SVM on the given binary
414 classification training data. It uses the svm_c_trainer to do this. It also
415 uses find_max_global() and 6-fold cross-validation to automatically determine
416 the best settings of the SVM's hyper parameters.
417 - Note that we interpret y[i] as the label for the vector x[i]. Therefore, the
418 returned function, df, should generally satisfy sign(df(x[i])) == y[i] as
419 often as possible.
420 - The hyperparameter search will run for about max_runtime and will print
421 messages to the screen as it runs if be_verbose==true.
422 !*/
423 );
424
425 m.def("auto_train_rbf_classifier", [](
426 const numpy_image<double>& x_,
427 const py::array_t<double>& y_,
428 double max_runtime_seconds,
429 bool be_verbose
430 ) {
431 std::vector<matrix<double,0,1>> x;
432 std::vector<double> y;
433 np_to_cpp(x_,y_, x, y);
434 return auto_train_rbf_classifier(x,y,std::chrono::microseconds((uint64_t)(max_runtime_seconds*1e6)),be_verbose); },
435 py::arg("x"), py::arg("y"), py::arg("max_runtime_seconds"), py::arg("be_verbose")=true,
436"requires \n\
437 - y contains at least 6 examples of each class. Moreover, every element in y \n\

Callers 1

bind_decision_functionsFunction · 0.85

Calls 6

np_to_cppFunction · 0.85
argClass · 0.50
reduced2Function · 0.50
null_trainerFunction · 0.50
trainMethod · 0.45

Tested by

no test coverage detected