rail.estimation.estimator module

Abstract base classes defining redshift estimations Informers and Estimators

class rail.estimation.estimator.CatEstimator(args, comm=None)[source]

Bases: RailStage

The base class for making photo-z posterior estimates 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.

They take as “input” tabular data, apply the photo-z estimation and provide as “output” a QPEnsemble, with per-object p(z).

Configuration Parameters: output_mode [str]: What to do with the outputs (default=default) chunk_size [int]: (default=10000) hdf5_groupname [str]: (required)

config_options = {'chunk_size': 10000, 'hdf5_groupname': <class 'str'>, 'output_mode': <ceci.config.StageParameter object>}
estimate(input_data)[source]

The main interface method for the photo-z estimation

This will attach the input_data to this Estimator (for introspection and provenance tracking).

Then it will call the run() and finalize() methods, which need to be implemented by the sub-classes.

The run() method will need to register the data that it creates to this Estimator by using self.add_data(‘output’, output_data).

Finally, this will return a QPHandle providing access to that output data.

Parameters:

input_data (dict or ModelHandle) – Either a dictionary of all input data or a ModelHandle providing access to the same

Returns:

output – Handle providing access to QP ensemble with output data

Return type:

QPHandle

inputs = [('model', <class 'rail.core.data.ModelHandle'>), ('input', <class 'rail.core.data.TableHandle'>)]
name = 'CatEstimator'
open_model(**kwargs)[source]

Load the mode and/or attach it to this Estimator

Parameters:

model (object, str or ModelHandle) – Either an object with a trained model, a path pointing to a file that can be read to obtain the trained model, or a ModelHandle providing access to the trained model.

Returns:

self.model – The object encapsulating the trained model.

Return type:

object

outputs = [('output', <class 'rail.core.data.QPHandle'>)]
run()[source]

Run the stage and return the execution status

class rail.estimation.estimator.CatInformer(args, comm=None)[source]

Bases: RailStage

The base class for informing models used to make photo-z posterior estimates 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.

config_options = {'hdf5_groupname': <class 'str'>, 'output_mode': <ceci.config.StageParameter object>, 'save_train': True}
inform(training_data)[source]

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() 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:

input_data (dict or TableHandle) – dictionary of all input data, or a TableHandle providing access to it

Returns:

model – Handle providing access to trained model

Return type:

ModelHandle

inputs = [('input', <class 'rail.core.data.TableHandle'>)]
name = 'Informer'
outputs = [('model', <class 'rail.core.data.ModelHandle'>)]