Treed-GP classes

class kingpin.RJMCMC(model, params_prior, systematic_prior=None, seed=None, tree_prior=<kingpin.prior.CGM object>, params_proposal=<kingpin.proposal.FractionalProposal object>, systematic_proposal=<kingpin.proposal.FractionalProposal object>, change_proposal=None)
Parameters:
  • model (Model) – Gaussian process model

  • params_prior (Prior) – Prior for leaf parameters

  • systematic_prior (Prior | None) – Prior for systematic parameters

  • seed (int | None) – Seed for reproducible result

  • tree_prior (TreePrior | None) – Prior for tree

  • params_proposal (Proposal | None) – Proposal for leaf parameters

  • systematic_proposal (Proposal | None) – Proposal for systematic parameters

  • change_proposal (TruncatedProposal | None) – Proposal for changing split parameters

step(n_iter_params=10, min_data_points=1)

One step, which is a round of trans-dimensional and ordinary Markov moves

Parameters:
  • n_iter_params – Number of parameter iterations per step

  • min_data_points – Minimum number of data points per leaf

walk(n_iter=5000, n_burn=500, thin=10, screen=False, position=0, **kwargs)

Multiple RJ-MCMC steps

Parameters:
  • n_iter (int | None) – Number of iterations to perform

  • n_burn (int | None) – Number of iterations to burn

  • thin (int | None) – Thin chain by this factor - efficient as avoids computing GP predictions

  • screen (bool | None) – Show detailed state of tree on screen

  • position (int | None) – Position of status bar on screen

class kingpin.TGP(model, params_prior, systematic_prior=None, seed=None, tree_prior=<kingpin.prior.CGM object>, params_proposal=<kingpin.proposal.FractionalProposal object>, systematic_proposal=<kingpin.proposal.FractionalProposal object>, change_proposal=None)
Parameters:
  • model (Model) – Gaussian process model

  • params_prior (Prior) – Prior for leaf parameters

  • systematic_prior (Optional[Prior]) – Prior for systematic parameters

  • seed (Optional[int]) – Seed for reproducible result

  • tree_prior (Optional[TreePrior]) – Prior for tree

  • params_proposal (Optional[Proposal]) – Proposal for leaf parameters

  • systematic_proposal (Optional[Proposal]) – Proposal for systematic parameters

  • change_proposal (Optional[TruncatedProposal]) – Proposal for changing split parameters

property acceptance

Aggregated acceptance information

arviz_summary()
Returns:

Summary of chains including ESS and R-hat

property cov

Aggregated model prediction for covariance

classmethod from_data(x_data, y_data, noise=None, x_predict=None, **kwargs)

Interface that makes generic modeling choices from data

Parameters:
  • x_data (ArrayLike) – Input locations

  • y_data (ArrayLike) – Measurements

  • noise (ArrayLike | None) – Diagonal measurement error

  • x_predict (ArrayLike | None) – Locations of predictions

property mean

Aggregated model prediction for mean

savefig(filename, *args, **kwargs)

Save plot of predictions

Parameters:

filename (str) – File name for figure

savetxt(filename)

Saves mean and standard deviations to disk

Parameters:

filename (str) – File name for text file of data

show(*args, **kwargs)

Show plot of predictions

property stdev

Aggregated model prediction for standard deviation

to_arviz()
Returns:

Summary data in arviz format

walk(n_threads=None, screen=False, **kwargs)

Multiple RJ-MCMC walks

Parameters:
  • n_threads (int | None) – Number of threads

  • screen (bool | None) – Show detailed state of tree on screen

Building GP models

class kingpin.Model(x_data, y_data, noise=None, x_predict=None)
Parameters:
  • x_data (ArrayLike) – Input locations

  • y_data (ArrayLike) – Measurements

  • noise (Optional[ArrayLike]) – Diagonal measurement error

  • x_predict (Optional[ArrayLike]) – Locations of predictions

class kingpin.Celerite2(x_data, y_data, noise=None, x_predict=None)
Parameters:
  • x_data (ArrayLike) – Input locations

  • y_data (ArrayLike) – Measurements

  • noise (Optional[ArrayLike]) – Diagonal measurement error

  • x_predict (Optional[ArrayLike]) – Locations of predictions

class kingpin.Normal(mean, sigma)

Interval for distribution

Parameters:
  • mean – Mean of normal

  • sigma – Standard deviation of normal

class kingpin.Uniform(lower, upper)

Interval for distribution

Parameters:
  • lower – Lower edge of interval

  • upper – Upper edge of interval

class kingpin.Independent(*prior)
Parameters:

prior – Prior distributions

Types

kingpin.alias.ArrayLike

alias of Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

class kingpin.TreePrior

Prior for tree structure

class kingpin.Prior

Represent prior for model’s parameters

class kingpin.Proposal

Proposal distribution for e.g. model parameters

class kingpin.TruncatedProposal

Truncated proposal distribution for e.g. splitting rule