gov.sandia.cognition.learning.function.kernel
Class KernelUtil

java.lang.Object
  extended by gov.sandia.cognition.learning.function.kernel.KernelUtil

public class KernelUtil
extends Object

A utility class for dealing with kernels.

Since:
3.3.0
Author:
Justin Basilico

Constructor Summary
KernelUtil()
           
 
Method Summary
static
<InputType>
double
norm2(DefaultKernelBinaryCategorizer<InputType> target)
          Computes the 2-norm of the weight vector implied by the given kernel binary categorizer.
static
<ValueType>
double
norm2(ValueType value, Kernel<? super ValueType> kernel)
          Computes the 2-norm of the given value according to the given kernel.
static
<InputType>
double
norm2Squared(DefaultKernelBinaryCategorizer<InputType> target)
          Computes the squared 2-norm of the weight vector implied by the given kernel binary categorizer.
static
<ValueType>
double
norm2Squared(ValueType value, Kernel<? super ValueType> kernel)
          Computes the squared 2-norm of the given value according to the given kernel.
static void scaleEquals(DefaultKernelBinaryCategorizer<?> target, double scale)
          Scales all of the weights in the given kernel binary categorizer by the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KernelUtil

public KernelUtil()
Method Detail

norm2

public static <ValueType> double norm2(ValueType value,
                                       Kernel<? super ValueType> kernel)
Computes the 2-norm of the given value according to the given kernel.

Type Parameters:
ValueType - The type of the value.
Parameters:
value - A value.
kernel - A kernel function that can operate on the value.
Returns:
The 2-norm of the value according to the kernel.

norm2

public static <InputType> double norm2(DefaultKernelBinaryCategorizer<InputType> target)
Computes the 2-norm of the weight vector implied by the given kernel binary categorizer.

Type Parameters:
InputType - The type of input to the categorizer value.
Parameters:
target - A kernel binary categorizer.
Returns:
The 2-norm of the categorizer according to the kernel.

norm2Squared

public static <ValueType> double norm2Squared(ValueType value,
                                              Kernel<? super ValueType> kernel)
Computes the squared 2-norm of the given value according to the given kernel. Useful for bypassing the square-root computation in the 2-norm computation.

Type Parameters:
ValueType - The type of the value.
Parameters:
value - A value.
kernel - A kernel function that can operate on the value.
Returns:
The squared 2-norm of the value according to the kernel.

norm2Squared

public static <InputType> double norm2Squared(DefaultKernelBinaryCategorizer<InputType> target)
Computes the squared 2-norm of the weight vector implied by the given kernel binary categorizer. Useful for bypassing the square-root computation in the 2-norm computation.

Type Parameters:
InputType - The type of input to the categorizer value.
Parameters:
target - A kernel binary categorizer.
Returns:
The 2-norm of the categorizer according to the kernel.

scaleEquals

public static void scaleEquals(DefaultKernelBinaryCategorizer<?> target,
                               double scale)
Scales all of the weights in the given kernel binary categorizer by the given value.

Parameters:
target - The kernel binary categorizer to update the weights on.
scale - The scale to apply to all the weights.