rail.estimation.estimator module

Abstract base classes defining Estimators of individual galaxy redshift uncertainties.

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

Bases: RailStage, PointEstimationMixin

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.

Estimators 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]: (default=photometry) calculated_point_estimates [list]: (default=[])

config_options = {'calculated_point_estimates': [], 'chunk_size': 10000, 'hdf5_groupname': 'photometry', '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 (defined in inputs as “input”) to this Estimator (for introspection and provenance tracking). Then call the run() and finalize() methods.

The run method will call _process_chunk(), which needs to be implemented in the subclass, to process input data in batches. See RandomGaussEstimator for a simple example.

Finally, this will return a QPHandle for 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 model and 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