stheno.model.measure module

class stheno.model.measure.Measure[source]

Bases: object

A GP model.

ps

Processes of the measure.

Type

list[gp.GP]

mean

Mean.

Type

stheno.lazy.LazyVector

kernels

Kernels.

Type

stheno.lazy.LazyMatrix

default

Global default measure.

Type

measure.Measure or None

add_independent_gp(p, mean, kernel)[source]

Add an independent GP to the model.

Parameters
  • p (gp.GP) – GP to add.

  • mean (mlkernels.Mean) – Mean function of GP.

  • kernel (mlkernels.Kernel) – Kernel function of GP.

Returns

The newly added independent GP.

Return type

gp.GP

condition[source]

Condition the measure on observations.

Parameters

obs (observations.AbstractObservations) – Observations to condition on.

Returns

Posterior processes.

Return type

list[gp.GP]

cross[source]

Construct the Cartesian product of a collection of processes.

Parameters
  • p_cross (gp.GP) – GP that is the Cartesian product.

  • *ps (gp.GP) – Processes to construct the Cartesian product of.

Returns

The Cartesian product of ps.

Return type

gp.GP

default = None
diff(p_diff, p, dim=0)[source]

Differentiate a GP.

Parameters
  • p_diff (gp.GP) – Derivative.

  • p (gp.GP) – GP to differentiate.

  • dim (int, optional) – Dimension of feature which to take the derivative with respect to. Defaults to 0.

Returns

Derivative of GP.

Return type

gp.GP

logpdf[source]

Compute the logpdf of one multiple observations.

Can also give an AbstractObservations.

Parameters

*pairs (tuple[fdd.FDD, tensor]) – Pairs of FDDs and values of the observations.

Returns

Logpdf.

Return type

scalar

mul[source]

Multiply a GP from the graph with another object.

Parameters
  • p_mul (gp.GP) – GP that is the product.

  • obj1 (object) – First factor in the product.

  • obj2 (object) – Second factor in the product.

  • other (object) – Other object in the product.

Returns

The GP corresponding to the product.

Return type

gp.GP

name[source]

Name a GP.

Parameters
  • p (gp.GP) – GP to name.

  • name (str) – Name. Must be unique.

sample[source]

Sample multiple processes simultaneously.

Parameters
  • n (int, optional) – Number of samples. Defaults to 1.

  • *fdds (fdd.FDD) – Locations to sample at.

Returns

Tuple of samples.

Return type

tuple

select(p_selected, p, *dims)[source]

Select input dimensions.

Parameters
  • p_selected (gp.GP) – GP with selected inputs.

  • p (gp.GP) – GP to select input dimensions from.

  • *dims (object) – Dimensions to select.

Returns

GP with the specific input dimensions.

Return type

gp.GP

shift(p_shifted, p, shift)[source]

Shift a GP.

Parameters
  • p_shifted (gp.GP) – Shifted GP.

  • p (gp.GP) – GP to shift.

  • shift (object) – Amount to shift by.

Returns

The shifted GP.

Return type

gp.GP

stretch(p_stretched, p, stretch)[source]

Stretch a GP.

Parameters
  • p_stretched (gp.GP) – Stretched GP.

  • p (gp.GP) – GP to stretch.

  • stretch (object) – Extent of stretch.

Returns

The stretched GP.

Return type

gp.GP

sum[source]

Sum a GP from the graph with another object.

Parameters
  • p_sum (gp.GP) – GP that is the sum.

  • obj1 (other type or gp.GP) – First term in the sum.

  • obj2 (other type or gp.GP) – Second term in the sum.

Returns

The GP corresponding to the sum.

Return type

gp.GP

transform(p_transformed, p, f)[source]

Transform the inputs of a GP.

Parameters
  • p_transformed (gp.GP) – GP with transformed inputs.

  • p (gp.GP) – GP to input transform.

  • f (function) – Input transform.

Returns

Input-transformed GP.

Return type

gp.GP