Class SolverMCSVM_CS


  • class SolverMCSVM_CS
    extends java.lang.Object
    A coordinate descent algorithm for multi-class support vector machines by Crammer and Singer
     min_{\alpha} 0.5 \sum_m ||w_m(\alpha)||^2 + \sum_i \sum_m e^m_i alpha^m_i
     s.t. \alpha^m_i <= C^m_i \forall m,i , \sum_m \alpha^m_i=0 \forall i
    
     where e^m_i = 0 if y_i = m,
     e^m_i = 1 if y_i != m,
     C^m_i = C if m = y_i,
     C^m_i = 0 if m != y_i,
     and w_m(\alpha) = \sum_i \alpha^m_i x_i
    
     Given:
     x, y, C
     eps is the stopping tolerance
    
     solution will be put in w
    
     See Appendix of LIBLINEAR paper, Fan et al. (2008)
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double[] B  
      private double[] C  
      private double eps  
      private double[] G  
      private int l  
      private int max_iter  
      private int nr_class  
      private Problem prob  
      private java.util.Random random  
      private int w_size  
    • Constructor Summary

      Constructors 
      Constructor Description
      SolverMCSVM_CS​(Problem prob, int nr_class, double[] C, double eps, java.util.Random random)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean be_shrunk​(int i, int m, int yi, double alpha_i, double minG)  
      private int GETI​(int i)  
      void solve​(double[] w)  
      private void solve_sub_problem​(double A_i, int yi, double C_yi, int active_i, double[] alpha_new)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • B

        private final double[] B
      • C

        private final double[] C
      • eps

        private final double eps
      • G

        private final double[] G
      • max_iter

        private final int max_iter
      • w_size

        private final int w_size
      • l

        private final int l
      • nr_class

        private final int nr_class
      • random

        private final java.util.Random random
    • Constructor Detail

      • SolverMCSVM_CS

        public SolverMCSVM_CS​(Problem prob,
                              int nr_class,
                              double[] C,
                              double eps,
                              java.util.Random random)
    • Method Detail

      • GETI

        private int GETI​(int i)
      • be_shrunk

        private boolean be_shrunk​(int i,
                                  int m,
                                  int yi,
                                  double alpha_i,
                                  double minG)
      • solve

        public void solve​(double[] w)
      • solve_sub_problem

        private void solve_sub_problem​(double A_i,
                                       int yi,
                                       double C_yi,
                                       int active_i,
                                       double[] alpha_new)