Mercurial > repos > bgruening > plotly_regression_performance_plots
diff plot_regression_performance.py @ 1:389227fa1864 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
author | bgruening |
---|---|
date | Wed, 09 Jan 2019 02:55:46 -0500 |
parents | 0800a1b66bbd |
children |
line wrap: on
line diff
--- a/plot_regression_performance.py Thu Nov 08 13:28:04 2018 -0500 +++ b/plot_regression_performance.py Wed Jan 09 02:55:46 2019 -0500 @@ -1,5 +1,6 @@ import argparse import pandas as pd +import numpy as np import plotly import plotly.graph_objs as go @@ -47,6 +48,12 @@ max_tv = int(max(true_values)) x_y_values = list(range(0, max_tv)) + true_mean = np.mean(true_values) + res_true_predicted = np.sum((true_values - predicted_values) ** 2) + res_total = np.sum((true_values - true_mean) ** 2) + r2 = 1 - (res_true_predicted / float(res_total)) + rmse = np.sqrt(np.mean([(x - y) ** 2 for x, y in zip(true_values, predicted_values)])) + trace_x_eq_y = go.Scatter( x=x_y_values, y=x_y_values, @@ -62,7 +69,7 @@ ) layout_true_pred = go.Layout( - title='True vs predicted values', + title='True vs predicted values (RMSE: %s, R2: %s)' % (str(np.round(rmse, 2)), str(np.round(r2, 2))), xaxis=dict(title='True values'), yaxis=dict(title='Predicted values') )