svm_parameter.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package opennlp.tools.svm.libsvm;
  2. public class svm_parameter implements Cloneable,java.io.Serializable
  3. {
  4. /* svm_type */
  5. public static final int C_SVC = 0;
  6. public static final int NU_SVC = 1;
  7. public static final int ONE_CLASS = 2;
  8. public static final int EPSILON_SVR = 3;
  9. public static final int NU_SVR = 4;
  10. /* kernel_type */
  11. public static final int LINEAR = 0;
  12. public static final int POLY = 1;
  13. public static final int RBF = 2;
  14. public static final int SIGMOID = 3;
  15. public static final int PRECOMPUTED = 4;
  16. public int svm_type;
  17. public int kernel_type;
  18. public int degree; // for poly
  19. public double gamma; // for poly/rbf/sigmoid
  20. public double coef0; // for poly/sigmoid
  21. // these are for train only
  22. public double cache_size; // in MB
  23. public double eps; // stopping actionselection
  24. public double C; // for C_SVC, EPSILON_SVR and NU_SVR
  25. public int nr_weight; // for C_SVC
  26. public int[] weight_label; // for C_SVC
  27. public double[] weight; // for C_SVC
  28. public double nu; // for NU_SVC, ONE_CLASS, and NU_SVR
  29. public double p; // for EPSILON_SVR
  30. public int shrinking; // use the shrinking heuristics
  31. public int probability; // do probability estimates
  32. public void copy(svm_parameter rhs){
  33. svm_type = rhs.svm_type;
  34. kernel_type = rhs.kernel_type;
  35. degree = rhs.degree; // for poly
  36. gamma = rhs.gamma; // for poly/rbf/sigmoid
  37. coef0 = rhs.coef0; // for poly/sigmoid
  38. // these are for train only
  39. cache_size = rhs.cache_size; // in MB
  40. eps = rhs.eps; // stopping actionselection
  41. C = rhs.C; // for C_SVC, EPSILON_SVR and NU_SVR
  42. nr_weight = rhs.nr_weight; // for C_SVC
  43. weight_label = rhs.weight_label.clone(); // for C_SVC
  44. weight = rhs.weight.clone(); // for C_SVC
  45. nu = rhs.nu; // for NU_SVC, ONE_CLASS, and NU_SVR
  46. p = rhs.p; // for EPSILON_SVR
  47. shrinking = rhs.shrinking; // use the shrinking heuristics
  48. probability = rhs.probability; // do probability estimates
  49. }
  50. public svm_parameter makeCopy()
  51. {
  52. svm_parameter clone = new svm_parameter();
  53. clone.copy(this);
  54. return clone;
  55. }
  56. }