Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

double Solver::calculate_rho (  )  [protected, virtual]

Reimplemented in Solver_NU.

Definition at line 831 of file svm.cpp.

References active_size, G, INF, is_lower_bound(), is_upper_bound(), max, min, and y.

Referenced by Solve().

00832 {
00833         double r;
00834         int nr_free = 0;
00835         double ub = INF, lb = -INF, sum_free = 0;
00836         for(int i=0;i<active_size;i++)
00837         {
00838                 double yG = y[i]*G[i];
00839 
00840                 if(is_lower_bound(i))
00841                 {
00842                         if(y[i] > 0)
00843                                 ub = min(ub,yG);
00844                         else
00845                                 lb = std::max(lb,yG);
00846                 }
00847                 else if(is_upper_bound(i))
00848                 {
00849                         if(y[i] < 0)
00850                                 ub = min(ub,yG);
00851                         else
00852                                 lb = std::max(lb,yG);
00853                 }
00854                 else
00855                 {
00856                         ++nr_free;
00857                         sum_free += yG;
00858                 }
00859         }
00860 
00861         if(nr_free>0)
00862                 r = sum_free/nr_free;
00863         else
00864                 r = (ub+lb)/2;
00865 
00866         return r;
00867 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:32:37 2010 for ImpalaSrc by  doxygen 1.5.1