MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / LSSVM

Class LSSVM

JSAT/src/jsat/classifiers/svm/LSSVM.java:71–540  ·  view source on GitHub ↗

The Least Squares Support Vector Machine (LS-SVM) is an alternative to the standard SVM classifier for regression and binary classification problems. It can be faster to train, but is usually significantly slower to perform predictions with. This is because the LS-SVM solution is dense, so all train

Source from the content-addressed store, hash-verified

69 * @author Edward Raff
70 */
71public class LSSVM extends SupportVectorLearner implements BinaryScoreClassifier, Regressor, Parameterized, WarmRegressor, WarmClassifier
72{
73
74 private static final long serialVersionUID = -7569924400631719451L;
75 protected double b = 0, b_low, b_up;
76 private double C = 1;
77
78 private int i_up, i_low;
79 private double[] fcache;
80 private double dualObjective;
81
82 private static double epsilon = 1e-12;
83 private static double tol = 1e-3;
84
85 /**
86 * Creates a new LS-SVM learner that uses a linear model and does not use a
87 * cache
88 */
89 public LSSVM()
90 {
91 this(new LinearKernel());
92 }
93
94 /**
95 * Creates a new LS-SVM learner that does not use a cache
96 * @param kernel the kernel method to use
97 */
98 public LSSVM(KernelTrick kernel)
99 {
100 this(kernel, CacheMode.NONE);
101 }
102
103 /**
104 * Creates a new LS-SVM learner
105 * @param kernel the kernel method to use
106 * @param cacheMode the caching scheme to use for kernel evaluations
107 */
108 public LSSVM(KernelTrick kernel, CacheMode cacheMode)
109 {
110 super(kernel, cacheMode);
111 }
112
113 /**
114 * Creates a deep copy of another LS-SVM
115 * @param toCopy the object to copy
116 */
117 public LSSVM(LSSVM toCopy)
118 {
119 super(toCopy.getKernel().clone(), toCopy.getCacheMode());
120 this.b_low = toCopy.b_low;
121 this.b_up = toCopy.b_up;
122 this.i_up = toCopy.i_up;
123 this.i_low = toCopy.i_low;
124 this.C = toCopy.C;
125 if(toCopy.alphas != null)
126 this.alphas = Arrays.copyOf(toCopy.alphas, toCopy.alphas.length);
127 if(toCopy.fcache != null)
128 this.fcache = Arrays.copyOf(toCopy.fcache, toCopy.fcache.length);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected