4.4.3 Regression - WangLabTHU/GPro GitHub Wiki

hcwang and qxdu edited on Aug 4, 2023, 1 version

Introduction

regression.py allows us to evaluate the performance of the predictor using a sequence of known expression levels. It will provide a graph where the horizontal axis represents the true expression level and the vertical axis represents the predicted expression level of the model.

The following figure shows the coefficient plot of the same trained model CNN K15. For this predictor, it is obvious that the predicted value is approximately proportional to the actual value. Considering that the predictor often has a very low Pearson correlation coefficient, it can be considered that this model has good enough performance.

Parameters

Caution: Note that the format of the sequence and expression files here should be consistent with the QuickStart section.

params description default value
predictor_expression_datapath path of corresponding expression level with predictor_seqpath
predictor_prediction_datapath path of prediction values corresponding predictor_expression_datapath
report_path saving folder
file_tag saving name
display whether show the picture False

Demo

from gpro.evaluator.regression import plot_regression_performance

project_path = "your project path"
predictor_expression_datapath = project_path + '/data/diffusion_prediction/exp.txt'
predictor_prediction_datapath = project_path + '/checkpoints/attnbilstm/preds.txt'
metrics = plot_regression_performance( predictor_expression_datapath, predictor_prediction_datapath,
                                          report_path="./results/", file_tag="AttnBiLSTM")
print("ad_mean_Y: {}, ad_std:{}, ad_r2:{}, ad_pearson:{}, ad_spearman:{} \n".format(metrics[0], metrics[1], metrics[2], metrics[3], metrics[4]))

The final result will be saved in the ./results directory.

⚠️ **GitHub.com Fallback** ⚠️