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

Method pick_initial_vector

dlib/svm/rvm.h:530–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528
529 template <typename M1, typename M2>
530 long pick_initial_vector (
531 const M1& x,
532 const M2& t
533 ) const
534 {
535 scalar_vector_type K_col;
536 double max_projection = -std::numeric_limits<scalar_type>::infinity();
537 long max_idx = 0;
538 // find the row in the kernel matrix that has the biggest normalized projection onto the t vector
539 for (long r = 0; r < x.nr(); ++r)
540 {
541 get_kernel_colum(r,x,K_col);
542 double temp = trans(K_col)*t;
543 temp = temp*temp/length_squared(K_col);
544
545 if (temp > max_projection)
546 {
547 max_projection = temp;
548 max_idx = r;
549 }
550 }
551
552 return max_idx;
553 }
554
555 // ------------------------------------------------------------------------------------
556

Callers

nothing calls this directly

Calls 3

length_squaredFunction · 0.70
transFunction · 0.50
nrMethod · 0.45

Tested by

no test coverage detected