public abstract class Kernel extends Object
Constructor and Description |
---|
Kernel() |
Modifier and Type | Method and Description |
---|---|
void |
disableCache()
Disables the kernel cache
|
KernelCache |
getKernelCache()
Returns the cache in which storing the kernel operations in the RKHS defined
by this kernel
|
long |
getKernelComputations()
Returns the number of times the kernel function has been invoked
|
long |
getNumberOfHits()
Returns the number of times a cache hit happened
|
long |
getNumberOfMisses()
Returns the number of times a cache miss happened
|
SquaredNormCache |
getSquaredNormCache()
Returns the cache in which storing the squared norms in the RKHS defined
by this kernel
|
float |
innerProduct(Example exA,
Example exB)
Returns the kernel similarity between the given examples.
|
protected abstract float |
kernelComputation(Example exA,
Example exB)
Returns the kernel similarity between the given examples.
|
static Kernel |
load(String inputFilePath)
Load a kernel function from a file path.
|
void |
reset()
Resets the kernel statistics (number of kernel computations,
cache hits and misses)
|
static void |
save(Kernel kernel,
String outputFilePath)
Save the input kernel in a file.
|
void |
setKernelCache(KernelCache cache)
Sets the cache in which storing the kernel operations in the RKHS defined
by this kernel
|
void |
setSquaredNormCache(SquaredNormCache normCache)
Sets the cache in which storing the squared norms in the RKHS defined
by this kernel
|
float |
squaredNorm(Example example)
Returns the squared norm of the given example in the RKHS defined by this kernel
|
float |
squaredNormOfTheDifference(Example exA,
Example exB)
Returns the squared norm of the difference between the given examples in the RKHS.
|
public final float innerProduct(Example exA, Example exB)
exA
- the first exampleexB
- the second exampleexA
and
exB
public void setSquaredNormCache(SquaredNormCache normCache)
normCache
- the cache for the squared normspublic SquaredNormCache getSquaredNormCache()
public void setKernelCache(KernelCache cache)
cache
- the cache for the kernel operationspublic KernelCache getKernelCache()
cache
- the cache for the kernel operationsprotected abstract float kernelComputation(Example exA, Example exB)
exA
- the first exampleexB
- the second exampleexA
and
exB
public float squaredNorm(Example example)
example
- the example whose squared norm must be computedpublic float squaredNormOfTheDifference(Example exA, Example exB)
exA
- the first exampleexB
- the second examplepublic void disableCache()
public long getKernelComputations()
public long getNumberOfHits()
public long getNumberOfMisses()
public void reset()
public static void save(Kernel kernel, String outputFilePath) throws FileNotFoundException, IOException
kernel
- The input kerneloutputFilePath
- The output file pathFileNotFoundException
IOException
public static Kernel load(String inputFilePath) throws FileNotFoundException, IOException
kernel
- The input kerneloutputFilePath
- The output file pathFileNotFoundException
IOException
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.