rail.estimation.informer module
Abstract base classes for Informers. These superstages ingest prior information, including training sets and explicit priors, and prepare a model that can be used to produce photo-z data products. They are distinguished by their input data types, and the models they output can be used for their corresponding Estimator, Summarizer, or Classifier stages.
- class rail.estimation.informer.CatInformer
Bases:
RailStageThe base class for informing models used to make photo-z data products from catalog-like inputs (i.e., tables with fluxes in photometric bands among the set of columns).
Estimators use a generic “model”, the details of which depends on the sub-class. Most estimators will have associated Informer classes, which can be used to inform those models.
(Note, “Inform” is more generic than “Train” as it also applies to algorithms that are template-based rather than machine learning-based.)
Informer will produce as output a generic “model”, the details of which depends on the sub-class.
They take as “input” catalog-like tabular data, which is used to “inform” the model.
- __init__(args, **kwargs)
Initialize Informer that can inform models for redshift estimation
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- entrypoint_function: str | None = 'inform'
- inform(training_data, **kwargs)
The main interface method for Informers
This will attach the input_data to this Informer (for introspection and provenance tracking).
Then it will call the run(), validate() and finalize() methods, which need to be implemented by the sub-classes.
The run() method will need to register the model that it creates to this Estimator by using self.add_data(‘model’, model).
Finally, this will return a ModelHandle providing access to the trained model.
- Parameters:
training_data (TableLike) – dictionary of all input data, or a TableHandle providing access to it
- Returns:
Handle providing access to trained model
- Return type:
- inputs = [('input', <class 'rail.core.data.TableHandle'>)]
- name = 'CatInformer'
- outputs = [('model', <class 'rail.core.data.ModelHandle'>)]
- class rail.estimation.informer.PzInformer
Bases:
RailStageThe base class for informing models used to make photo-z data products from existing ensembles of p(z) distributions.
PzInformer can use a generic “model”, the details of which depends on the sub-class. Some summarizer will have associated PzInformer classes, which can be used to inform those models.
(Note, “Inform” is more generic than “Train” as it also applies to algorithms that are template-based rather than machine learning-based.)
PzInformer will produce as output a generic “model”, the details of which depends on the sub-class.
They take as “input” a qp.Ensemble of per-galaxy p(z) data, which is used to “inform” the model.
- 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))
- __init__(args, **kwargs)
Initialize Informer that can inform models for redshift estimation
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- entrypoint_function: str | None = 'inform'
- inform(training_data='None', truth_data='None', **kwargs)
The main interface method for Informers
This will attach the input_data to this Informer (for introspection and provenance tracking).
Then it will call the run(), validate() and finalize() methods, which need to be implemented by the sub-classes.
The run() method will need to register the model that it creates to this Estimator by using self.add_data(‘model’, model).
Finally, this will return a ModelHandle providing access to the trained model.
- Parameters:
training_data (qp.Ensemble | str, optional) – Per-galaxy p(z), and any ancilary data associated with it, by default “None”
truth_data (TableLike | str, optional) – Table with the true redshifts, by default “None”
- Returns:
Handle providing access to trained model
- Return type:
dict[str, ModelHandle]
- inputs = [('input', <class 'rail.core.data.QPHandle'>), ('truth', <class 'rail.core.data.TableHandle'>)]
- name = 'PzInformer'
- outputs = [('model', <class 'rail.core.data.ModelHandle'>)]
- run()
Run the stage and return the execution status.
Subclasses must implemented this method.
- Return type:
None