LSSTDESC / qp

Quantile Parametrization for probability distribution functions module
MIT License
10 stars 3 forks source link

Quantile PDF reconstructions follow up work #148

Open drewoldag opened 1 year ago

drewoldag commented 1 year ago
elts6570 commented 1 year ago

We also see two issues a) with the PDF parameterization and b) the reconstruction prior to the point where the first quantile starts in our implementation here: https://github.com/LSSTDESC/bayesian-pipelines-cosmology/blob/photo-z/notebooks/photo-z/quantiles.py, when called as such: https://github.com/LSSTDESC/bayesian-pipelines-cosmology/blob/photo-z/notebooks/photo-z/qp_quantiles.ipynb.

aimalz commented 1 year ago

Temporary fix @elts6570 : When using the .convert_to() method, we should provide quantile values that aren't exactly 0 or 1, i.e. offset from those by a tiny number like 1e-15. The .pdf() method still gives wonky results, but they're not nearly as crazy.

A more comprehensive solution will entail:

  1. Checking for 0 or 1 in the input values to .ppf() and performing the above offset if necessary.
  2. Adding a check for inf values in the locs provided to quant_gen.
  3. Debugging the .pdf() method to prevent constant-valued stretches even for reconstruction options other than piecewise_constant.
  4. Debugging the .pdf() method to prevent negative values under piecewise_linear option.
  5. Adding a check that the CDF in between initially provided locs is equal to initially provided quants.