Class LinearKernelMachine
java.lang.Object
smile.base.svm.LinearKernelMachine
- All Implemented Interfaces:
Serializable
Linear kernel machine.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LinearKernelMachinebinary(int p, KernelMachine<int[]> kernelMachine) Creates a linear kernel machine.doublef(double[] x) Returns the value of decision function.doublef(int[] x) Returns the value of decision function.doublef(SparseArray x) Returns the value of decision function.doubleReturns the intercept.static LinearKernelMachineof(KernelMachine<double[]> kernelMachine) Creates a linear kernel machine.static LinearKernelMachinesparse(int p, KernelMachine<SparseArray> kernelMachine) Creates a linear kernel machine.double[]weights()Returns the linear weights.
-
Constructor Details
-
LinearKernelMachine
public LinearKernelMachine(double[] w, double b) Constructor.- Parameters:
w- the weight vector.b- the intercept.
-
-
Method Details
-
weights
public double[] weights()Returns the linear weights.- Returns:
- the linear weights.
-
intercept
public double intercept()Returns the intercept.- Returns:
- the intercept.
-
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.
-