Package smile.base.svm
Class LinearKernelMachine
java.lang.Object
smile.base.svm.LinearKernelMachine
- All Implemented Interfaces:
Serializable
Linear kernel machine.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LinearKernelMachine
binary
(int p, KernelMachine<int[]> kernelMachine) Creates a linear kernel machine.double
f
(double[] x) Returns the value of decision function.double
f
(int[] x) Returns the value of decision function.double
f
(SparseArray x) Returns the value of decision function.static LinearKernelMachine
of
(KernelMachine<double[]> kernelMachine) Creates a linear kernel machine.static LinearKernelMachine
sparse
(int p, KernelMachine<SparseArray> kernelMachine) Creates a linear kernel machine.
-
Constructor Details
-
LinearKernelMachine
public LinearKernelMachine(double[] w, double b) Constructor.- Parameters:
w
- the weight vector.b
- the intercept.
-
-
Method Details
-
of
Creates a linear kernel machine.- Parameters:
kernelMachine
- a generic kernel machine.- Returns:
- a linear kernel machine
-
binary
Creates a linear kernel machine.- Parameters:
p
- the dimension of input vector.kernelMachine
- a generic kernel machine.- Returns:
- a linear kernel machine
-
sparse
Creates a linear kernel machine.- Parameters:
p
- the dimension of input vector.kernelMachine
- a generic kernel machine.- Returns:
- a linear kernel machine
-
f
public double f(double[] x) Returns the value of decision function.- Parameters:
x
- the instance.- Returns:
- the score.
-
f
public double f(int[] x) Returns the value of decision function.- Parameters:
x
- the binary sparse instance.- Returns:
- the score.
-
f
Returns the value of decision function.- Parameters:
x
- the sparse instance.- Returns:
- the score.
-