Class Parameter


  • public final class Parameter
    extends java.lang.Object
    Copyright (c) 2007-2014 The LIBLINEAR Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither name of copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) double C  
      (package private) double eps
      stopping criteria
      (package private) SolverType solverType  
      (package private) double[] weight  
      (package private) int[] weightLabel  
    • Constructor Summary

      Constructors 
      Constructor Description
      Parameter​(SolverType solverType, double C, double eps)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getC()  
      double getEps()  
      int getNumWeights()
      the number of weights
      SolverType getSolverType()  
      int[] getWeightLabels()  
      double[] getWeights()  
      void setC​(double C)
      C is the cost of constraints violation.
      void setEps​(double eps)
      eps is the stopping criterion.
      void setSolverType​(SolverType solverType)  
      void setWeights​(double[] weights, int[] weightLabels)
      nr_weight, weight_label, and weight are used to change the penalty for some classes (If the weight for a class is not changed, it is set to 1).
      • Methods inherited from class java.lang.Object

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

      • C

        double C
      • eps

        double eps
        stopping criteria
      • weight

        double[] weight
      • weightLabel

        int[] weightLabel
    • Constructor Detail

      • Parameter

        public Parameter​(SolverType solverType,
                         double C,
                         double eps)
    • Method Detail

      • setWeights

        public void setWeights​(double[] weights,
                               int[] weightLabels)

        nr_weight, weight_label, and weight are used to change the penalty for some classes (If the weight for a class is not changed, it is set to 1). This is useful for training classifier using unbalanced input data or with asymmetric misclassification cost.

        Each weight[i] corresponds to weight_label[i], meaning that the penalty of class weight_label[i] is scaled by a factor of weight[i].

        If you do not want to change penalty for any of the classes, just set nr_weight to 0.

      • setC

        public void setC​(double C)
        C is the cost of constraints violation. (we usually use 1 to 1000)
      • getC

        public double getC()
      • setEps

        public void setEps​(double eps)
        eps is the stopping criterion. (we usually use 0.01).
      • getEps

        public double getEps()
      • setSolverType

        public void setSolverType​(SolverType solverType)
      • getSolverType

        public SolverType getSolverType()