Class SparseGP
A Gaussian Process distribution over functions, represented by a GP prior times a set of regression likelihoods on basis points.
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Serializable]
[Quality(QualityBand.Preview)]
[DataContract]
public class SparseGP : IGaussianProcess, IDistribution<IFunction>, IDistribution, ICloneable, Diffable, SettableToUniform, HasPoint<IFunction>, CanGetLogProb<IFunction>, SettableTo<SparseGP>, SettableToProduct<SparseGP>, SettableToProduct<SparseGP, SparseGP>, SettableToRatio<SparseGP>, SettableToRatio<SparseGP, SparseGP>, SettableToPower<SparseGP>, SettableToWeightedSum<SparseGP>, CanGetLogAverageOf<SparseGP>, CanGetLogAverageOfPower<SparseGP>, CanGetAverageLog<SparseGP>, CanGetMean<IFunction>, Sampleable<IFunction>
Remarks
This distribution family comes from the paper "Sparse-posterior Gaussian Processes for general likelihoods" by Qi et al (2010), http://event.cwi.nl/uai2010/papers/UAI2010_0283.pdf
The state of the distribution is represented by (FixedParameters, IncludePrior, InducingDist, pointFunc). The GP prior and basis point locations are stored in FixedParameters. The regression likelihoods are stored as a single VectorGaussian called InducingDist. IncludePrior=false does not include the prior in the distribution (i.e. the distribution is degenerate). If pointFunc != null, the distribution is a point mass. If InducingDist is uniform and IncludePrior is false, the distribution is uniform. The GP prior is assumed to be non-uniform.
Constructors
SparseGP()
Parameterless constructor needed for serialization
Declaration
protected SparseGP()
SparseGP(SparseGP)
Copy constructor
Declaration
public SparseGP(SparseGP that)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | that |
SparseGP(SparseGPFixed)
Constructs sparse GP, given basis etc
Declaration
public SparseGP(SparseGPFixed spgf)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGPFixed | spgf | The fixed parameters |
SparseGP(SparseGPFixed, Boolean)
Declaration
public SparseGP(SparseGPFixed spgf, bool includePrior)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGPFixed | spgf | Fixed parameters |
| Boolean | includePrior | Whether this instance includes the prior |
SparseGP(SparseGPFixed, Boolean, VectorGaussian, IFunction)
Constructor from full specification
Declaration
[Construction(new string[]{"FixedParameters", "IncludePrior", "InducingDist", "Point"})]
public SparseGP(SparseGPFixed spgf, bool includePrior, VectorGaussian InducingDist, IFunction pointFunc)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGPFixed | spgf | Fixed parameters |
| Boolean | includePrior | Whether this instance includes the prior |
| VectorGaussian | InducingDist | Inducing distribution |
| IFunction | pointFunc | If not null, set this as a point distribution |
Fields
alpha
Field for Alpha property
Declaration
[DataMember]
protected Vector alpha
Field Value
| Type | Description |
|---|---|
| Vector |
beta
Field for Beta property
Declaration
[DataMember]
protected PositiveDefiniteMatrix beta
Field Value
| Type | Description |
|---|---|
| PositiveDefiniteMatrix |
fixedParameters
Field for FixedParameters property
Declaration
[DataMember]
protected SparseGPFixed fixedParameters
Field Value
| Type | Description |
|---|---|
| SparseGPFixed |
IncludePrior
Whether this sparse GP includes the prior
Declaration
[DataMember]
public bool IncludePrior
Field Value
| Type | Description |
|---|---|
| Boolean |
InducingDist
The regression likelihoods that modify the prior.
Declaration
[DataMember]
public VectorGaussian InducingDist
Field Value
| Type | Description |
|---|---|
| VectorGaussian |
Remarks
If this field is changed, ClearCachedValues() must be called before accessing any other property.
meanB
Field for Mean_B property
Declaration
protected Vector meanB
Field Value
| Type | Description |
|---|---|
| Vector |
pointFunc
Use for setting point distribution
Declaration
[DataMember]
protected IFunction pointFunc
Field Value
| Type | Description |
|---|---|
| IFunction |
varBB
Field for Var_B_B property
Declaration
protected PositiveDefiniteMatrix varBB
Field Value
| Type | Description |
|---|---|
| PositiveDefiniteMatrix |
Properties
Alpha
Alpha - along with beta, this encodes the posterior means and covariances of the Sparse GP
Declaration
[IgnoreDataMember]
public Vector Alpha { get; }
Property Value
| Type | Description |
|---|---|
| Vector |
Beta
Beta - along with alpha, this encodes the posterior means and covariances of the Sparse GP
Declaration
[IgnoreDataMember]
public PositiveDefiniteMatrix Beta { get; }
Property Value
| Type | Description |
|---|---|
| PositiveDefiniteMatrix |
FixedParameters
Sets and gets the fixed sparse parameters - parameters which are not changed by inference
Declaration
public SparseGPFixed FixedParameters { get; set; }
Property Value
| Type | Description |
|---|---|
| SparseGPFixed |
IsPointMass
Asks the distribution whether it is a point mass
Declaration
[IgnoreDataMember]
public bool IsPointMass { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Mean_B
m(B). This is a calculated Vector maintained by the class
Declaration
[IgnoreDataMember]
public Vector Mean_B { get; }
Property Value
| Type | Description |
|---|---|
| Vector |
Point
Sets or Gets a point. If not a point function, the get returns the mean function of the sparse GP
Declaration
[IgnoreDataMember]
public IFunction Point { get; set; }
Property Value
| Type | Description |
|---|---|
| IFunction |
Var_B_B
var(B, B). This is a calculated matrix maintained by the class
Declaration
[IgnoreDataMember]
public PositiveDefiniteMatrix Var_B_B { get; }
Property Value
| Type | Description |
|---|---|
| PositiveDefiniteMatrix |
Methods
ClearCachedValues()
Function to signal recalculation of calculated parameters. This is called automatically if the fixed parameter class is swapped out, or if the kernel is changed, or if parameters are changed. It should also be called by any external program modifies the kernel or other fixed parameters in place
Declaration
public void ClearCachedValues()
Clone()
Clone. Note that the fixed parameters and the rank1 list are just referenced
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| Object | The cloned object |
Covariance(Vector, Vector)
Predictive covariance at a given pair of points
Declaration
public double Covariance(Vector x, Vector y)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | x | |
| Vector | y |
Returns
| Type | Description |
|---|---|
| Double |
Covariance(IList<Vector>)
Predictive coariance at a given list of points
Declaration
public PositiveDefiniteMatrix Covariance(IList<Vector> XList)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<Vector> | XList | List of inputs |
Returns
| Type | Description |
|---|---|
| PositiveDefiniteMatrix | Predictive covariance |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj |
Returns
| Type | Description |
|---|---|
| Boolean |
Overrides
EvaluateMean(Vector)
Evaluates the mean function of the GP
Declaration
public double EvaluateMean(Vector X)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | X | Input variable |
Returns
| Type | Description |
|---|---|
| Double | Evaulated function value |
GetAverageLog(SparseGP)
The expected logarithm of that distribution under this distribution
Declaration
public double GetAverageLog(SparseGP that)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | that |
Returns
| Type | Description |
|---|---|
| Double |
Remarks
Not yet implemented
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 |
Overrides
GetLogAverageOf(SparseGP)
Gets the log of the integral of the product of this SparseGP and that SparseGP
Declaration
public double GetLogAverageOf(SparseGP that)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | that |
Returns
| Type | Description |
|---|---|
| Double |
GetLogAverageOfPower(SparseGP, Double)
Get the integral of this distribution times another distribution raised to a power.
Declaration
public double GetLogAverageOfPower(SparseGP that, double power)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | that | |
| Double | power |
Returns
| Type | Description |
|---|---|
| Double |
GetLogProb(IFunction)
Gets the log density for a given value
Declaration
public double GetLogProb(IFunction value)
Parameters
| Type | Name | Description |
|---|---|---|
| IFunction | value |
Returns
| Type | Description |
|---|---|
| Double |
GetMean()
Gets the mean function for the Sparse GP
Declaration
public IFunction GetMean()
Returns
| Type | Description |
|---|---|
| IFunction | The mean function |
IsUniform()
Asks the distribution whether it is uniform
Declaration
public bool IsUniform()
Returns
| Type | Description |
|---|---|
| Boolean | True or false |
Joint(IList<Vector>)
Predictive distribution at a given list of points
Declaration
public VectorGaussian Joint(IList<Vector> XList)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<Vector> | XList | List of inputs |
Returns
| Type | Description |
|---|---|
| VectorGaussian | Predictive distribution |
Marginal(Vector)
Predictive distribution at a given point
Declaration
public Gaussian Marginal(Vector X)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | X | Input |
Returns
| Type | Description |
|---|---|
| Gaussian | Predictive distribution |
MaxDiff(Object)
Max difference between two sparse GPs - used for convergence testing
Declaration
public double MaxDiff(object thatd)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | thatd | That sparse GP which will be compared to this sparse GP |
Returns
| Type | Description |
|---|---|
| Double |
Mean(Vector)
Mean at a given point
Declaration
public double Mean(Vector X)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | X |
Returns
| Type | Description |
|---|---|
| Double |
Mean(IList<Vector>)
Mean at a given list of points
Declaration
public Vector Mean(IList<Vector> XList)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<Vector> | XList | List of inputs |
Returns
| Type | Description |
|---|---|
| Vector | Predictive mean vector |
PointMass(SparseGPFixed, IFunction)
Creates a sparse GP point mass - i.e. all the mass is at a given function
Declaration
public static SparseGP PointMass(SparseGPFixed sgpf, IFunction value)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGPFixed | sgpf | |
| IFunction | value |
Returns
| Type | Description |
|---|---|
| SparseGP |
Sample()
Samples from the Sparse Gaussian distribution This is only implemented for a 1-dimensional input space, and returns a simple linear spline function
Declaration
public IFunction Sample()
Returns
| Type | Description |
|---|---|
| IFunction | Sample function |
Sample(IFunction)
Samples from the Sparse Gaussian distribution This is only implemented for a 1-dimensional input space, and returns a simple linear spline function. result is ignored
This argument is ignoredDeclaration
public IFunction Sample(IFunction result)
Parameters
| Type | Name | Description |
|---|---|---|
| IFunction | result |
Returns
| Type | Description |
|---|---|
| IFunction | Sample function |
SetTo(SparseGP)
Sets one sparse GP to another. Everything is copied except the FixedParameters and the lsit of rank 1 potentials which are referenced.
Declaration
public void SetTo(SparseGP that)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | that | The sparse GP to copy |
SetToPower(SparseGP, Double)
Sets this sparse GP the the power of another sparse GP
Declaration
public void SetToPower(SparseGP dist, double exponent)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | dist | |
| Double | exponent |
SetToProduct(SparseGP, SparseGP)
Sets this instance to the product of two sparse GPs.
Declaration
public void SetToProduct(SparseGP a, SparseGP b)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | a | Sparse GP |
| SparseGP | b | Sparse GP |
SetToRatio(SparseGP, SparseGP, Boolean)
Sets this instance to the ratio of two sparse GPs.
Declaration
public void SetToRatio(SparseGP numerator, SparseGP denominator, bool forceProper = false)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | numerator | Sparse GP |
| SparseGP | denominator | Sparse GP |
| Boolean | forceProper |
SetToSum(Double, SparseGP, Double, SparseGP)
Sets this SparseGP distribution to the weighted sum of two other such distributions
Declaration
public void SetToSum(double weight1, SparseGP value1, double weight2, SparseGP value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | weight1 | |
| SparseGP | value1 | |
| Double | weight2 | |
| SparseGP | value2 |
Remarks
Not yet implemented
SetToUniform()
Sets to uniform
Declaration
public void SetToUniform()
ToString()
ToString override
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | String representation of instance |
Overrides
Uniform(SparseGPFixed)
Creates a uniform sparse GP
Declaration
public static SparseGP Uniform(SparseGPFixed sgpf)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGPFixed | sgpf |
Returns
| Type | Description |
|---|---|
| SparseGP |
Variance(Vector)
Predictive Variance at a given point
Declaration
public double Variance(Vector X)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | X | Input |
Returns
| Type | Description |
|---|---|
| Double | Predictive variance |
Operators
Division(SparseGP, SparseGP)
Creates a new SparseGP which the ratio of two other SparseGPs
Declaration
public static SparseGP operator /(SparseGP numerator, SparseGP denominator)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | numerator | numerator SparseGP |
| SparseGP | denominator | denominator SparseGP |
Returns
| Type | Description |
|---|---|
| SparseGP | Result |
Multiply(SparseGP, SparseGP)
Creates a new SparseGP which the product of two other SparseGPs
Declaration
public static SparseGP operator *(SparseGP a, SparseGP b)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGP | a | First SparseGP |
| SparseGP | b | Second SparseGP |
Returns
| Type | Description |
|---|---|
| SparseGP | Result |