public class NormalizedKernel extends Object implements KernelTrick
Constructor and Description |
---|
NormalizedKernel(KernelTrick source_kernel) |
Modifier and Type | Method and Description |
---|---|
void |
addToCache(Vec newVec,
List<Double> cache)
Appends the new cache values for the given vector to the list of cache
values.
|
NormalizedKernel |
clone() |
double |
eval(int a,
int b,
List<? extends Vec> trainingSet,
List<Double> cache)
Produces the correct kernel evaluation given the training set and the
cache generated by
KernelTrick.getAccelerationCache(List) . |
double |
eval(int a,
Vec b,
List<Double> qi,
List<? extends Vec> vecs,
List<Double> cache)
Computes the kernel product between one vector in the original list of vectors
with that of another vector not from the original list, but had
information generated by
KernelTrick.getQueryInfo(jsat.linear.Vec) . |
double |
eval(Vec a,
Vec b)
Evaluate this kernel function for the two given vectors.
|
double |
evalSum(List<? extends Vec> finalSet,
List<Double> cache,
double[] alpha,
Vec y,
int start,
int end)
Performs an efficient summation of kernel products of the form
∑ αi k(xi, y) where x are the final set of vectors, and α the associated scalar multipliers |
double |
evalSum(List<? extends Vec> finalSet,
List<Double> cache,
double[] alpha,
Vec y,
List<Double> qi,
int start,
int end)
Performs an efficient summation of kernel products of the form
∑ αi k(xi, y) where x are the final set of vectors, and α the associated scalar multipliers |
List<Double> |
getAccelerationCache(List<? extends Vec> trainingSet)
Creates a new list cache values from a given list of training set
vectors.
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
List<Double> |
getQueryInfo(Vec q)
Pre computes query information that would have be generated if the query
was a member of the original list of vectors when calling
KernelTrick.getAccelerationCache(java.util.List) . |
boolean |
normalized()
This method indicates if a kernel is a normalized kernel or not.
|
boolean |
supportsAcceleration()
Indicates if this kernel supports building an acceleration cache
using the
KernelTrick.getAccelerationCache(List) and associated
cache accelerated methods. |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
public NormalizedKernel(KernelTrick source_kernel)
public NormalizedKernel clone()
clone
in interface KernelTrick
clone
in class Object
public double eval(Vec a, Vec b)
KernelTrick
eval
in interface KernelTrick
a
- the first vectorb
- the first vectorpublic List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainpublic boolean supportsAcceleration()
KernelTrick
KernelTrick.getAccelerationCache(List)
and associated
cache accelerated methods. By default this method will return
false
. If true
, then a cache can be obtained from this
matrix and used in conjunction with KernelTrick.eval(int, Vec, List, List, List)
and KernelTrick.eval(int, int, List, List)
to perform kernel products.supportsAcceleration
in interface KernelTrick
true
if cache acceleration is supported for this kernel,
false
otherwise.public List<Double> getAccelerationCache(List<? extends Vec> trainingSet)
KernelTrick
null
will
be returned.getAccelerationCache
in interface KernelTrick
trainingSet
- the list of training set vectorspublic List<Double> getQueryInfo(Vec q)
KernelTrick
KernelTrick.getAccelerationCache(java.util.List)
. This can then be used if
a large number of kernel computations are going to be done against
points in the original set for a point that is outside the original space.
null
will be
returned.getQueryInfo
in interface KernelTrick
q
- the query point to generate cache information forpublic void addToCache(Vec newVec, List<Double> cache)
KernelTrick
KernelTrick.getAccelerationCache(java.util.List)
addToCache
in interface KernelTrick
newVec
- the new vector to add to the cache valuescache
- the original list of cache values to add topublic double eval(int a, Vec b, List<Double> qi, List<? extends Vec> vecs, List<Double> cache)
KernelTrick
KernelTrick.getQueryInfo(jsat.linear.Vec)
.
null
, then
KernelTrick.eval(jsat.linear.Vec, jsat.linear.Vec)
will be called directly.eval
in interface KernelTrick
a
- the index of the vector in the cacheb
- the other vectorqi
- the query information about bvecs
- the list of vectors used to build the cachecache
- the cache associated with the given list of vectorspublic double eval(int a, int b, List<? extends Vec> trainingSet, List<Double> cache)
KernelTrick
KernelTrick.getAccelerationCache(List)
. The training
vectors should be in the same order.eval
in interface KernelTrick
a
- the index of the first training vectorb
- the index of the second training vectortrainingSet
- the list of training set vectorscache
- the double list of cache values generated by this kernel
for the given training setKernelTrick.eval(jsat.linear.Vec, jsat.linear.Vec)
public double evalSum(List<? extends Vec> finalSet, List<Double> cache, double[] alpha, Vec y, int start, int end)
KernelTrick
evalSum
in interface KernelTrick
finalSet
- the final set of vectorscache
- the cache associated with the final set of vectorsalpha
- the coefficients associated with each vectory
- the vector to perform the summed kernel products againststart
- the starting index (inclusive) to sum fromend
- the ending index (exclusive) to sum frompublic double evalSum(List<? extends Vec> finalSet, List<Double> cache, double[] alpha, Vec y, List<Double> qi, int start, int end)
KernelTrick
evalSum
in interface KernelTrick
finalSet
- the final set of vectorscache
- the cache associated with the final set of vectorsalpha
- the coefficients associated with each vectory
- the vector to perform the summed kernel products againstqi
- the query information about ystart
- the starting index (inclusive) to sum fromend
- the ending index (exclusive) to sum frompublic boolean normalized()
KernelTrick
normalized
in interface KernelTrick
true
if this is a normalized kernel. false
otherwise.Copyright © 2017. All rights reserved.