Skip to content

Commit

Permalink
add calculation for one-run pearson correlation between predictions a…
Browse files Browse the repository at this point in the history
…nd responces
  • Loading branch information
GeorgeBatch committed Sep 13, 2020
1 parent 2885675 commit c46f5b2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/ci_plots_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@
# ----------------------------------------------------------------------------
# variables to save things while the loop runs
#


# one run
one_run_correlations_p_values = {}
one_run_correlations_prediction_vs_responce = {}
# mult runs mean, std
mult_runs_corr_rmse_percentile_pm_stds = {}
mult_runs_rmse_pm_std = {}
Expand All @@ -108,6 +111,7 @@
#
# one run
one_run_correlations_p_values[f'{dataset}_{cf}'] = {}
one_run_correlations_prediction_vs_responce[f'{dataset}_{cf}'] = {}
# mult runs mean, std
mult_runs_corr_rmse_percentile_pm_stds[f'{dataset}_{cf}'] = {}
mult_runs_rmse_pm_std[f'{dataset}_{cf}'] = {}
Expand Down Expand Up @@ -139,6 +143,10 @@
y_test_pred = df_pred.iloc[:, 0]
y_test_std = df_std.iloc[:, 0]

# model performance assessment
corr, p_val = pearsonr(y_test, y_test_pred)
one_run_correlations_prediction_vs_responce[f'{dataset}_{cf}'][model] = round(corr, 2), round(p_val, 5)

# calculate everything
upper = y_test_pred + 1.96 * y_test_std
lower = y_test_pred - 1.96 * y_test_std
Expand Down Expand Up @@ -354,6 +362,14 @@
column_order = ['Random Forests', 'Gaussian Processes']


print("\nOne run predictions vs responce correlations, p-values:")
df = pd.DataFrame(one_run_correlations_prediction_vs_responce).T
df = df.rename(mapper=row_mapper, axis='index')
df = df.rename(mapper=column_mapper, axis='columns')
df = df.loc[row_order, column_order]
print(df)


print("\nOne run correlations and p-values:")
df = pd.DataFrame(one_run_correlations_p_values).T
df = df.rename(mapper=row_mapper, axis='index')
Expand Down

0 comments on commit c46f5b2

Please sign in to comment.