We are interested in implementing an additional metrics to hyperopt that is sensitive to higher moments of the probability distribution, $\varphi^{2}$; see Eq.(4.6) of the NNPDF3.0 paper. As defined therein and extended by @RoyStegeman and @juanrojochacon to the context of hyperoptimization, $\varphi^{2}$ can be calculated for each $k$-fold as
$$\Huge \varphi_{\chi^2_k}^2 = \langle \chi^2_k [ \mathcal{T}[f_{\rm fit}], \mathcal{D} ] \rangle_{\rm rep} - \chi^2_k [ \langle \mathcal{T}[f_{\rm fit}] \rangle_{\rm rep}, \mathcal{D} ] $$
where the first term represents our usual averaged-over-replicas hyper loss, $\chi^2_k$, that is calculated based on the dataset used in the fit ($\mathcal{D}$) and the theory predictions from each fitted PDF ($f_{\rm fit}$) replica. The second term of the above equation would involve the calculation of the hyper loss but now using the theory predictions from the central PDF (averaged-over-replicas PDF - if I understood well).
The idea would be to implement this new metrics as an additional @staticmethod of the HyperLoss class.
I noticed that there already exists an implementation of $\varphi$ (probably from NNPDF3.0 paper) in the phi_data function in validphys. This function depends on the abs_chi2_data function which in turn depends on results.
To avoid code duplication, I think it would be nice to use these functions probably via n3fit/vpinterface.py.
The problem is that I really do not know how to use these functions from validphys, specially results that depends on covariance_matrix and sqrt_covmat arguments.
Please, could anybody help me on that or even suggest any alternative way to do so ? I would appreciate it very much you help.
We are interested in implementing an additional metrics to$\varphi^{2}$ ; see Eq.(4.6) of the NNPDF3.0 paper. As defined therein and extended by @RoyStegeman and @juanrojochacon to the context of hyperoptimization, $\varphi^{2}$ can be calculated for each $k$ -fold as
hyperoptthat is sensitive to higher moments of the probability distribution,where the first term represents our usual averaged-over-replicas hyper loss,$\chi^2_k$ , that is calculated based on the dataset used in the fit ($\mathcal{D}$ ) and the theory predictions from each fitted PDF ($f_{\rm fit}$ ) replica. The second term of the above equation would involve the calculation of the hyper loss but now using the theory predictions from the central PDF (averaged-over-replicas PDF - if I understood well).
The idea would be to implement this new metrics as an additional
@staticmethodof theHyperLossclass.I noticed that there already exists an implementation of$\varphi$ (probably from NNPDF3.0 paper) in the
phi_datafunction invalidphys. This function depends on theabs_chi2_datafunction which in turn depends onresults.To avoid code duplication, I think it would be nice to use these functions probably via
n3fit/vpinterface.py.The problem is that I really do not know how to use these functions from
validphys, speciallyresultsthat depends oncovariance_matrixandsqrt_covmatarguments.Please, could anybody help me on that or even suggest any alternative way to do so ? I would appreciate it very much you help.