Skip to content

Commit

Permalink
Per #2583, switch to more concise variable naming conventions of ign_…
Browse files Browse the repository at this point in the history
…oerr_cnv, ign_oerr_cor, and dawid_seb.
  • Loading branch information
JohnHalleyGotway committed Oct 31, 2023
1 parent 72492f0 commit d49cddb
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 54 deletions.
6 changes: 3 additions & 3 deletions src/libcode/vx_stat_out/stat_columns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4310,13 +4310,13 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info,
ecnt_info.me_lt_obs);

at.set_entry(r, c+25, // Ignorance Score, observation error convolved
ecnt_info.ign_oerr_convolved);
ecnt_info.ign_oerr_cnv);

at.set_entry(r, c+26, // Ignorance Score, observation error corrected
ecnt_info.ign_oerr_corrected);
ecnt_info.ign_oerr_cor);

at.set_entry(r, c+27, // Dawid-Sebastiani
ecnt_info.dawid_sebastiani);
ecnt_info.dawid_seb);

return;
}
Expand Down
22 changes: 11 additions & 11 deletions src/libcode/vx_statistics/ens_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ void ECNTInfo::clear() {
me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double;
spread_plus_oerr = bad_data_double;

ign_oerr_cnv = ign_oerr_cor = dawid_seb = bad_data_double;

n_ge_obs = n_lt_obs = 0;
me_ge_obs = me_lt_obs = bias_ratio = bad_data_double;

ign_oerr_convolved = ign_oerr_corrected = dawid_sebastiani = bad_data_double;

return;
}

Expand Down Expand Up @@ -224,16 +224,16 @@ void ECNTInfo::assign(const ECNTInfo &c) {
spread_oerr = c.spread_oerr;
spread_plus_oerr = c.spread_plus_oerr;

ign_oerr_cnv = c.ign_oerr_cnv;
ign_oerr_cor = c.ign_oerr_cor;
dawid_seb = c.dawid_seb;

n_ge_obs = c.n_ge_obs;
n_lt_obs = c.n_lt_obs;
me_ge_obs = c.me_ge_obs;
me_lt_obs = c.me_lt_obs;
bias_ratio = c.bias_ratio;

ign_oerr_convolved = c.ign_oerr_convolved;
ign_oerr_corrected = c.ign_oerr_corrected;
dawid_sebastiani = c.dawid_sebastiani;

return;
}

Expand Down Expand Up @@ -367,6 +367,11 @@ void ECNTInfo::set(const PairDataEnsemble &pd) {
// Compute the square root of the average variance plus oerr
spread_plus_oerr = square_root(pd.var_plus_oerr_na.wmean(pd.wgt_na));

// Compute log scores with observational uncertainty
ign_oerr_cnv = pd.ign_oerr_cnv_na.wmean(pd.wgt_na);
ign_oerr_cor = pd.ign_oerr_cor_na.wmean(pd.wgt_na);
dawid_seb = pd.dawid_seb_na.wmean(pd.wgt_na);

// Compute bias ratio terms
n_ge_obs = nint(pd.n_ge_obs_na.sum());
me_ge_obs = pd.me_ge_obs_na.wmean(pd.n_ge_obs_na);
Expand All @@ -376,11 +381,6 @@ void ECNTInfo::set(const PairDataEnsemble &pd) {
// Compute bias ratio
bias_ratio = compute_bias_ratio(me_ge_obs, me_lt_obs);

// Compute log scores with observational uncertainty
ign_oerr_convolved = pd.ign_oerr_convolved_na.wmean(pd.wgt_na);
ign_oerr_corrected = pd.ign_oerr_corrected_na.wmean(pd.wgt_na);
dawid_sebastiani = pd.dawid_sebastiani_na.wmean(pd.wgt_na);

return;
}

Expand Down
12 changes: 6 additions & 6 deletions src/libcode/vx_statistics/ens_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ class ECNTInfo {
double me_oerr, mae_oerr, rmse_oerr, spread_oerr;
double spread_plus_oerr;

// Log scores that incorporate observational uncertainty
// as advised in Ferro (2017)
double ign_oerr_cnv;
double ign_oerr_cor;
double dawid_seb;

// Bias ratio information
int n_ge_obs, n_lt_obs;
double me_ge_obs, me_lt_obs;
double bias_ratio;

// Log scores that incorporate observational uncertainty
// as advised in Ferro (2017)
double ign_oerr_convolved;
double ign_oerr_corrected;
double dawid_sebastiani;

// Compute statistics
void set(const PairDataEnsemble &);

Expand Down
46 changes: 27 additions & 19 deletions src/libcode/vx_statistics/pair_data_ensemble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ void PairDataEnsemble::clear() {
ign_na.clear();
pit_na.clear();

ign_oerr_cnv_na.clear();
ign_oerr_cor_na.clear();
dawid_seb_na.clear();

n_ge_obs_na.clear();
me_ge_obs_na.clear();
n_lt_obs_na.clear();
me_lt_obs_na.clear();

ign_oerr_convolved_na.clear();
ign_oerr_corrected_na.clear();
dawid_sebastiani_na.clear();

n_ens = 0;
n_pair = 0;
ctrl_index = bad_data_int;
Expand Down Expand Up @@ -183,13 +183,13 @@ void PairDataEnsemble::extend(int n) {
crpscl_gaus_na.extend (n);
ign_na.extend (n);
pit_na.extend (n);
ign_oerr_cnv_na.extend (n);
ign_oerr_cor_na.extend (n);
dawid_seb_na.extend (n);
n_ge_obs_na.extend (n);
me_ge_obs_na.extend (n);
n_lt_obs_na.extend (n);
me_lt_obs_na.extend (n);
ign_oerr_convolved_na.extend(n);
ign_oerr_corrected_na.extend(n);
dawid_sebastiani_na.extend(n);
skip_ba.extend (n);
var_na.extend (n);
var_oerr_na.extend (n);
Expand Down Expand Up @@ -242,15 +242,21 @@ void PairDataEnsemble::assign(const PairDataEnsemble &pd) {
// PairDataEnsemble
v_na = pd.v_na;
r_na = pd.r_na;

crps_emp_na = pd.crps_emp_na;
crps_emp_fair_na = pd.crps_emp_fair_na;
spread_md_na = pd.spread_md_na;
crpscl_emp_na = pd.crpscl_emp_na;
crps_gaus_na = pd.crps_gaus_na;
crpscl_gaus_na = pd.crpscl_gaus_na;

ign_na = pd.ign_na;
pit_na = pd.pit_na;

ign_oerr_cnv_na = pd.ign_oerr_convolved_na;
ign_oerr_cor_na = pd.ign_oerr_cnv_na;
dawid_seb_na = pd.dawid_seb_na;

n_ge_obs_na = pd.n_ge_obs_na;
me_ge_obs_na = pd.me_ge_obs_na;
n_lt_obs_na = pd.n_lt_obs_na;
Expand Down Expand Up @@ -456,13 +462,13 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) {
crpscl_gaus_na.add(bad_data_double);
ign_na.add(bad_data_double);
pit_na.add(bad_data_double);
ign_oerr_cnv_na.add(bad_data_double);
ign_oerr_cor_na.add(bad_data_double);
dawid_seb_na.add(bad_data_double);
n_ge_obs_na.add(bad_data_double);
me_ge_obs_na.add(bad_data_double);
n_lt_obs_na.add(bad_data_double);
me_lt_obs_na.add(bad_data_double);
ign_oerr_convolved_na.add(bad_data_double);
ign_oerr_corrected_na.add(bad_data_double);
dawid_sebastiani_na.add(bad_data_double);
}
// Otherwise, compute scores
else {
Expand Down Expand Up @@ -542,16 +548,16 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) {
n_ge_obs, me_ge_obs,
n_lt_obs, me_lt_obs);

// TODO: Need to actually compute stats here
ign_oerr_cnv_na.add(bad_data_double);
ign_oerr_cor_na.add(bad_data_double);
dawid_seb_na.add(bad_data_double);

// Store the Bias Ratio terms
n_ge_obs_na.add(n_ge_obs);
me_ge_obs_na.add(me_ge_obs);
n_lt_obs_na.add(n_lt_obs);
me_lt_obs_na.add(me_lt_obs);

// TODO: Need to actually compute stats here
ign_oerr_convolved_na.add(bad_data_double);
ign_oerr_corrected_na.add(bad_data_double);
dawid_sebastiani_na.add(bad_data_double);
}
} // end for i

Expand Down Expand Up @@ -880,7 +886,9 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o
// Include in subset:
// wgt_na, o_na, cmn_na, csd_na, v_na, r_na,
// crps_emp_na, crps_emp_fair_na, spread_md_na, crpscl_emp_na, crps_gaus_na, crpscl_gaus_na,
// ign_na, pit_na, n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na,
// ign_na, pit_na,
// ign_oerr_cnv, ign_oerr_cor, dawid_seb,
// n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na,
// var_na, var_oerr_na, var_plus_oerr_na,
// mn_na, mn_oerr_na, e_na
//
Expand All @@ -903,13 +911,13 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o
pd.crpscl_gaus_na.add(crpscl_gaus_na[i]);
pd.ign_na.add(ign_na[i]);
pd.pit_na.add(pit_na[i]);
pd.ign_oerr_cnv_na.add(ign_oerr_cnv_na[i]);
pd.ign_oerr_cor_na.add(ign_oerr_cor_na[i]);
pd.dawid_seb_na.add(dawid_seb_na[i]);
pd.n_ge_obs_na.add(n_ge_obs_na[i]);
pd.me_ge_obs_na.add(me_ge_obs_na[i]);
pd.n_lt_obs_na.add(n_lt_obs_na[i]);
pd.me_lt_obs_na.add(me_lt_obs_na[i]);
pd.ign_oerr_convolved_na.add(ign_oerr_convolved_na[i]);
pd.ign_oerr_corrected_na.add(ign_oerr_corrected_na[i]);
pd.dawid_sebastiani_na.add(dawid_sebastiani_na[i]);
pd.skip_ba.add(false);
pd.var_na.add(var_na[i]);
pd.var_oerr_na.add(var_oerr_na[i]);
Expand Down
8 changes: 4 additions & 4 deletions src/libcode/vx_statistics/pair_data_ensemble.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ class PairDataEnsemble : public PairBase {
NumArray ign_na; // Ignorance Score [n_obs]
NumArray pit_na; // Probability Integral Transform [n_obs]

NumArray ign_oerr_cnv_na; // Error convolved log score [n_obs]
NumArray ign_oerr_cor_na; // Error corrected log score [n_obs]
NumArray dawid_seb_na; // Dawid Sebastiani score [n_obs]

NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs]
NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs]
NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs]
NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs]

NumArray ign_oerr_convolved_na; // Error convolved log score [n_obs]
NumArray ign_oerr_corrected_na; // Error corrected log score [n_obs]
NumArray dawid_sebastiani_na; // Dawid Sebastiani score [n_obs]

int n_ens; // Number of ensemble members
int n_pair; // Number of valid pairs, n_obs - sum(skip_ba)
int ctrl_index; // Index of the control member
Expand Down
12 changes: 6 additions & 6 deletions src/tools/core/stat_analysis/aggr_stat_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2637,13 +2637,13 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job,
m[key].ens_pd.crps_gaus_na.add(cur.crps_gaus);
m[key].ens_pd.crpscl_gaus_na.add(cur.crpscl_gaus);
m[key].ens_pd.ign_na.add(cur.ign);
m[key].ens_pd.ign_oerr_cnv_na.add(cur.ign_oerr_cnv);
m[key].ens_pd.ign_oerr_cor_na.add(cur.ign_oerr_cor);
m[key].ens_pd.dawid_seb_na.add(cur.dawid_seb);
m[key].ens_pd.n_ge_obs_na.add(cur.n_ge_obs);
m[key].ens_pd.me_ge_obs_na.add(cur.me_ge_obs);
m[key].ens_pd.n_lt_obs_na.add(cur.n_lt_obs);
m[key].ens_pd.me_lt_obs_na.add(cur.me_lt_obs);
m[key].ens_pd.ign_oerr_convolved_na.add(cur.ign_oerr_convolved);
m[key].ens_pd.ign_oerr_corrected_na.add(cur.ign_oerr_corrected);
m[key].ens_pd.dawid_sebastiani_na.add(cur.dawid_sebastiani);
m[key].ens_pd.var_na.add(square(cur.spread));
m[key].ens_pd.var_oerr_na.add(square(cur.spread_oerr));
m[key].ens_pd.var_plus_oerr_na.add(square(cur.spread_plus_oerr));
Expand Down Expand Up @@ -3214,9 +3214,9 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job,
m[key].ens_pd.pit_na.add(compute_ens_pit(cur.obs, cur.ens_mean, cur.spread));

// TODO: Call functions to compute these stats here
m[key].ens_pd.ign_oerr_convolved_na.add(bad_data_double);
m[key].ens_pd.ign_oerr_corrected_na.add(bad_data_double);
m[key].ens_pd.dawid_sebastiani_na.add(bad_data_double);
m[key].ens_pd.ign_oerr_cnv_na.add(bad_data_double);
m[key].ens_pd.ign_oerr_cor_na.add(bad_data_double);
m[key].ens_pd.dawid_seb_na.add(bad_data_double);

// Store BIAS_RATIO terms
int n_ge_obs, n_lt_obs;
Expand Down
6 changes: 3 additions & 3 deletions src/tools/core/stat_analysis/parse_stat_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ void parse_ecnt_line(STATLine &l, ECNTData &e_data) {
e_data.n_lt_obs = atoi(l.get_item("N_LT_OBS"));
e_data.me_lt_obs = atof(l.get_item("ME_LT_OBS"));

e_data.ign_oerr_convolved = atof(l.get_item("IGN_OERR_CONVOLVED"));
e_data.ign_oerr_corrected = atof(l.get_item("IGN_OERR_CORRECTED"));
e_data.dawid_sebastiani = atof(l.get_item("DAWID_SEBASTIANI"));
e_data.ign_oerr_cnv = atof(l.get_item("IGN_OERR_CONVOLVED"));
e_data.ign_oerr_cor = atof(l.get_item("IGN_OERR_CORRECTED"));
e_data.dawid_seb = atof(l.get_item("DAWID_SEBASTIANI"));

return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/core/stat_analysis/parse_stat_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ struct ECNTData {
double me_oerr, mae_oerr, rmse_oerr, spread_oerr;
double spread_plus_oerr;
double bias_ratio;
double ign_oerr_cnv, ign_oerr_cor;
double dawid_seb;
int n_ge_obs, n_lt_obs;
double me_ge_obs, me_lt_obs;
double ign_oerr_convolved, ign_oerr_corrected;
double dawid_sebastiani;
};

// Ranked Histogram (RHIST) data structure
Expand Down

0 comments on commit d49cddb

Please sign in to comment.