rail.interactive.estimation.algos.nz_dir module
- rail.interactive.estimation.algos.nz_dir.nz_dir_informer(**kwargs)
Quick implementation of an NZ Estimator that creates weights for each input object using sklearn’s NearestNeighbors. Very basic, we can probably create a more sophisticated SOM-based DIR method in the future. This inform stage just creates a nearneigh model of the spec-z data and some distances to N-th neighbor that will be used in the estimate stage.
This will create model a dictionary of the nearest neighbor model and params used by estimate
—
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.
—
This function was generated from the function rail.estimation.algos.nz_dir.NZDirInformer.inform
- Parameters:
training_data (TableLike, required) – dictionary of all input data, or a TableHandle providing access to it
hdf5_groupname (str, optional) – name of hdf5 group for data, if None, then set to ‘’ Default: photometry
usecols (list, optional) – columns from sz_data for Neighbor calculation Default: [‘mag_u_lsst’, ‘mag_g_lsst’, ‘mag_r_lsst’, ‘mag_i_lsst’,…]
n_neigh (int, optional) – number of neighbors to use Default: 10
kalgo (str, optional) – Neighbor algorithm to use Default: kd_tree
kmetric (str, optional) – Knn metric to use Default: euclidean
sz_name (str, optional) – name of specz column in sz_data Default: redshift
szweightcol (str, optional) – name of sz weight column Default:
distance_delta (float, optional) – padding for distance calculation Default: 1e-06
- Returns:
Handle providing access to trained model
- Return type:
numpy.ndarray
- rail.interactive.estimation.algos.nz_dir.nz_dir_summarizer(**kwargs)
Quick implementation of a summarizer that creates weights for each input object using sklearn’s NearestNeighbors. Very basic, we can probably create a more sophisticated SOM-based DIR method in the future
—
The main interface method for the photo-z estimation
This will attach the input data (defined in
inputsas “input”) to thisEstimator(for introspection and provenance tracking). Then call therun(),validate(), andfinalize()methods.The run method will call
_process_chunk(), which needs to be implemented in the subclass, to process input data in batches. SeeRandomGaussEstimatorfor a simple example.Finally, this will return a
QPHandlefor access to that output data.—
This function was generated from the function rail.estimation.algos.nz_dir.NZDirSummarizer.estimate
- Parameters:
input_data (TableLike, required) – A dictionary of all input data
model (numpy.ndarray, required)
chunk_size (int, optional) – Number of objects per chunk for parallel processing or to evalute per loop in single node processing Default: 10000
hdf5_groupname (str, optional) – name of hdf5 group for data, if None, then set to ‘’ Default: photometry
zmin (float, optional) – The minimum redshift of the z grid or sample Default: 0.0
zmax (float, optional) – The maximum redshift of the z grid or sample Default: 3.0
nzbins (int, optional) – The number of gridpoints in the z grid Default: 301
id_col (str, optional) – name of the object ID column Default: object_id
redshift_col (str, optional) – name of redshift column Default: redshift
calc_summary_stats (bool, optional) – Compute summary statistics Default: False
calculated_point_estimates (list, optional) – List of strings defining which point estimates to automatically calculate using qp.Ensemble.Options include, ‘mean’, ‘mode’, ‘median’. Default: []
recompute_point_estimates (bool, optional) – Force recomputation of point estimates Default: False
seed (int, optional) – random seed Default: 87
usecols (list, optional) – columns from sz_data for Neighbor calculation Default: [‘mag_u_lsst’, ‘mag_g_lsst’, ‘mag_r_lsst’, ‘mag_i_lsst’,…]
leafsize (int, optional) – leaf size for testdata KDTree Default: 40
phot_weightcol (str, optional) – name of photometry weight, if present Default:
n_samples (int, optional) – number of bootstrap samples to generate Default: 20
- Returns:
Handle providing access to QP ensemble with output data
- Return type:
qp.core.ensemble.Ensemble