Class KernelFunction
Base class for all kernel functions
Inheritance
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Kernels
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Serializable]
public abstract class KernelFunction : IKernelFunctionWithParams, IKernelFunction
Constructors
KernelFunction()
Default constructor
Declaration
protected KernelFunction()
KernelFunction(IList<String>)
Protected constructor - derived classes pass down their list of hyper-parameter names
Declaration
protected KernelFunction(IList<string> hyperNames)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<String> | hyperNames |
KernelFunction(IList<String>, Double[])
Declaration
[Construction(new string[]{"thetaNames", "thetaValues"})]
protected KernelFunction(IList<string> hyperNames, double[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<String> | hyperNames | |
| Double[] | values |
Fields
thetaName2Index
Dictionary that allows look-up of index from hype-parameter name
Declaration
protected Dictionary<string, int> thetaName2Index
Field Value
| Type | Description |
|---|---|
| Dictionary<String, Int32> |
thetaNames
Hyper-parameter names
Declaration
protected IList<string> thetaNames
Field Value
| Type | Description |
|---|---|
| IList<String> |
thetaValues
Hyper-parameter values
Declaration
protected double[] thetaValues
Field Value
| Type | Description |
|---|---|
| Double[] |
Properties
HyperNames
Sets the names of the hyper-parameters. Note that this destroys any values
Declaration
public virtual IList<string> HyperNames { set; }
Property Value
| Type | Description |
|---|---|
| IList<String> |
Item[Int32]
Sets or gets a log hyper-parameter by index
Declaration
public virtual double this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Index of the log hyper-parameter |
Property Value
| Type | Description |
|---|---|
| Double | The log hyper-parameter value |
Item[String]
Sets or gets hyper-parameter by name. This indexer is not over-rideable
Declaration
public virtual double this[string name] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Mame of the hyper-parameter |
Property Value
| Type | Description |
|---|---|
| Double | The hyper-parameter value |
ThetaCount
Hyper-parameter count
Declaration
public virtual int ThetaCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
TypeVersion
The static version for the derived class
Declaration
public abstract int TypeVersion { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Methods
Cholesky(IKernelFunction, Dictionary<Int32, Vector>)
Cholesky of Kernel matrix
Declaration
public static LowerTriangularMatrix Cholesky(IKernelFunction kf, Dictionary<int, Vector> xData)
Parameters
| Type | Name | Description |
|---|---|---|
| IKernelFunction | kf | Kernel function |
| Dictionary<Int32, Vector> | xData | Data with which to build the matrix |
Returns
| Type | Description |
|---|---|
| LowerTriangularMatrix |
EvaluateX(Vector)
Evaluates the kernel for a single vector
Declaration
public virtual double EvaluateX(Vector x)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x | Vector |
Returns
| Type | Description |
|---|---|
| Double |
EvaluateX(Vector, ref Vector)
Evaluates the kernel for a single vector, and optionally, returns the derivatives with respect to the parameters
Declaration
public virtual double EvaluateX(Vector x, ref Vector logThetaDeriv)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x | Vector |
| Vector | logThetaDeriv | Derivative of the kernel value with respect to the log hyper-parameters |
Returns
| Type | Description |
|---|---|
| Double |
EvaluateX(Vector, ref Vector, ref Vector)
Evaluates the kernel for a single vector, and optionally, returns the derivatives with respect to the vector and with respect to the parameters
Declaration
public abstract double EvaluateX(Vector x, ref Vector xDeriv, ref Vector logThetaDeriv)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x | Vector |
| Vector | xDeriv | Derivative of the kernel value with respect to x |
| Vector | logThetaDeriv | Derivative of the kernel value with respect to the log hyper-parameters |
Returns
| Type | Description |
|---|---|
| Double |
EvaluateX1X2(Vector, Vector)
Evaluates the kernel for a pair of vectors
Declaration
public virtual double EvaluateX1X2(Vector x1, Vector x2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x1 | First vector |
| Vector | x2 | Second vector |
Returns
| Type | Description |
|---|---|
| Double |
EvaluateX1X2(Vector, Vector, ref Vector)
Evaluates the kernel for a pair of vectors and, optionally, returns derivatives with respect to the parameters
Declaration
public virtual double EvaluateX1X2(Vector x1, Vector x2, ref Vector logThetaDeriv)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x1 | First vector |
| Vector | x2 | Second vector |
| Vector | logThetaDeriv | Derivative of the kernel value with respect to the log hyper-parameters |
Returns
| Type | Description |
|---|---|
| Double |
EvaluateX1X2(Vector, Vector, ref Vector, ref Vector)
Evaluates the kernel for a pair of vectors and, optionally, returns derivatives with respect to each vector, and with respect to the parameters
Declaration
public abstract double EvaluateX1X2(Vector x1, Vector x2, ref Vector x1Deriv, ref Vector logThetaDeriv)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x1 | First vector |
| Vector | x2 | Second vector |
| Vector | x1Deriv | Derivative of the kernel value with respect to x1 input vector |
| Vector | logThetaDeriv | Derivative of the kernel value with respect to the log hyper-parameters |
Returns
| Type | Description |
|---|---|
| Double |
IndexToName(Int32)
Gets the index of a specified hyperparameter name
Declaration
public virtual string IndexToName(int thetaIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | thetaIndex | The hyper-parameter index |
Returns
| Type | Description |
|---|---|
| String | The index |
NameToIndex(String)
Gets the index of a specified hyperparameter name
Declaration
public virtual int NameToIndex(string thetaName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | thetaName | The hyper-parameter name |
Returns
| Type | Description |
|---|---|
| Int32 | The index |
Read(StreamReader)
Read the parameters in from a stream
Declaration
public virtual void Read(StreamReader sr)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamReader | sr | Stream reader |
Write(StreamWriter)
Writes the parameters out to a stream
Declaration
public virtual void Write(StreamWriter sw)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamWriter | sw | Stream writer |