Class LinearKernel
Linear kernel
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Kernels
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Serializable]
public class LinearKernel : KernelFunction, IKernelFunctionWithParams, IKernelFunction
Constructors
LinearKernel()
Default constructor
Declaration
public LinearKernel()
LinearKernel(Double[])
Constructs a linear kernel from vector of log variances
Declaration
public LinearKernel(double[] logVariances)
Parameters
| Type | Name | Description |
|---|---|---|
| Double[] | logVariances | Log of the weight variances |
Properties
Item[Int32]
Sets or gets a log hyper-parameter by index
Declaration
public override double this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
Property Value
| Type | Description |
|---|---|
| Double |
Overrides
TypeVersion
The static version for the derived class
Declaration
public override int TypeVersion { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Overrides
Methods
EvaluateX(Vector, ref Vector, ref Vector)
Evaluates the kernel for a single vector (which is used for both slots)
Declaration
public override 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 |
Overrides
EvaluateX1X2(Vector, Vector, ref Vector, ref Vector)
Evaluates the kernel for a pair of vectors
Declaration
public override 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 |
Overrides
InitialiseFromData(IList<Vector>)
Initialises the parameters from data. The variance is set as the square of the inverse of the 'length' of the input feature. Note that the variance we are trying to set up here corresponds to the variance of the weight parameters in a linear model, not to the variance of the input feature.
Declaration
public void InitialiseFromData(IList<Vector> X)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<Vector> | X | X data - initialises variances |
Read(StreamReader)
Reads the parameters in from a stream
Declaration
public override void Read(StreamReader sr)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamReader | sr | Stream reader |
Overrides
SetupParams(Double[])
Sets up names and values of parameters
Declaration
public void SetupParams(double[] logVariances)
Parameters
| Type | Name | Description |
|---|---|---|
| Double[] | logVariances | Log of the weight variances |