rail.estimation.algos.var_inf module

A summarizer that simple makes a histogram of a point estimate

class rail.estimation.algos.var_inf.VarInfStackInformer

Bases: PzInformer

Placeholder Informer

Parameters:
  • output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.

  • hdf5_groupname ([str] default=photometry) – name of hdf5 group for data, if None, then set to ‘’

  • chunk_size ([int] default=10000) – Number of objects per chunk for parallel processing or to evalute per loop in single node processing

  • input (QPHandle (INPUT))

  • truth (TableHandle (INPUT))

  • model (ModelHandle (OUTPUT))

entrypoint_function: str | None = 'inform'
interactive_function: str | None = 'var_inf_stack_informer'
name = 'VarInfStackInformer'
class rail.estimation.algos.var_inf.VarInfStackSummarizer

Bases: PZSummarizer

Variational inference summarizer based on notebook created by Markus Rau The summzarizer is appropriate for the likelihoods returned by template-based codes, for which the NaiveSummarizer are not appropriate.

Parameters:
  • output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.

  • chunk_size ([int] default=10000) – Number of objects per chunk for parallel processing or to evalute per loop in single node processing

  • zmin ([float] default=0.0) – The minimum redshift of the z grid or sample

  • zmax ([float] default=3.0) – The maximum redshift of the z grid or sample

  • nzbins ([int] default=301) – The number of gridpoints in the z grid

  • seed ([int] default=87) – random seed

  • n_iter ([int] default=100) – The number of iterations in the variational inference

  • n_samples ([int] default=500) – The number of samples used in dirichlet uncertainty

  • input (QPHandle (INPUT))

  • output (QPHandle (OUTPUT))

  • single_NZ (QPHandle (OUTPUT))

__init__(args, **kwargs)

Constructor: Do RailStage specific initialization

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

None

entrypoint_function: str | None = 'summarize'
inputs = [('input', <class 'rail.core.data.QPHandle'>)]
interactive_function: str | None = 'var_inf_stack_summarizer'
name = 'VarInfStackSummarizer'
outputs = [('output', <class 'rail.core.data.QPHandle'>), ('single_NZ', <class 'rail.core.data.QPHandle'>)]
run()

Run the stage and return the execution status.

Subclasses must implemented this method.

Return type:

None

summarize(input_data, **kwargs)

Summarizer for VarInfStack which returns multiple items

Parameters:

input_data (qp.Ensemble) – Per-galaxy p(z), and any ancillary data associated with it

Returns:

Ensemble with n(z), and any ancillary data Return type depends on output_mode

Return type:

QPHandle | dict[str, QPHandle]