Mercurial > repos > bgruening > plotly_regression_performance_plots
annotate 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 |
rev | line source |
---|---|
0
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
1 import argparse |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
2 import pandas as pd |
1
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
3 import numpy as np |
0
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
4 import plotly |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
5 import plotly.graph_objs as go |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
6 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
7 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
8 def main(infile_input, infile_output): |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
9 """ |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
10 Produce an interactive actual vs predicted curves and residual plots |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
11 Args: |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
12 infile_input: str, input tabular file with true values |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
13 infile_output: str, input tabular file with predicted values |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
14 """ |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
15 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
16 df_input = pd.read_csv(infile_input, sep='\t', parse_dates=True) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
17 df_output = pd.read_csv(infile_output, sep='\t', parse_dates=True) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
18 true_values = df_input.iloc[:, -1].copy() |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
19 predicted_values = df_output.iloc[:, -1].copy() |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
20 axis_labels = list(range(1, len(true_values)+1)) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
21 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
22 # true vs predicted curves |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
23 trace_true = go.Scatter( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
24 x=axis_labels, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
25 y=true_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
26 mode='lines+markers', |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
27 name='True values' |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
28 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
29 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
30 trace_predicted = go.Scatter( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
31 x=axis_labels, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
32 y=predicted_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
33 mode='lines+markers', |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
34 name='Predicted values' |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
35 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
36 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
37 layout_tp = go.Layout( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
38 title='True vs predicted values', |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
39 xaxis=dict(title='Number of data points'), |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
40 yaxis=dict(title='Values') |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
41 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
42 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
43 data_tp = [trace_true, trace_predicted] |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
44 fig_tp = go.Figure(data=data_tp, layout=layout_tp) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
45 plotly.offline.plot(fig_tp, filename="output_actual_vs_pred.html", auto_open=False) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
46 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
47 # scatter plot |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
48 max_tv = int(max(true_values)) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
49 x_y_values = list(range(0, max_tv)) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
50 |
1
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
51 true_mean = np.mean(true_values) |
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
52 res_true_predicted = np.sum((true_values - predicted_values) ** 2) |
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
53 res_total = np.sum((true_values - true_mean) ** 2) |
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
54 r2 = 1 - (res_true_predicted / float(res_total)) |
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
55 rmse = np.sqrt(np.mean([(x - y) ** 2 for x, y in zip(true_values, predicted_values)])) |
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
56 |
0
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
57 trace_x_eq_y = go.Scatter( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
58 x=x_y_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
59 y=x_y_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
60 mode='lines', |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
61 name='X = Y curve' |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
62 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
63 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
64 trace_true_pred = go.Scatter( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
65 x=true_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
66 y=predicted_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
67 mode='markers', |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
68 name='True and predicted values' |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
69 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
70 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
71 layout_true_pred = go.Layout( |
1
389227fa1864
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit 2473a53fde6d8e646e90d2a5201999c8c6a48695
bgruening
parents:
0
diff
changeset
|
72 title='True vs predicted values (RMSE: %s, R2: %s)' % (str(np.round(rmse, 2)), str(np.round(r2, 2))), |
0
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
73 xaxis=dict(title='True values'), |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
74 yaxis=dict(title='Predicted values') |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
75 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
76 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
77 data_true_pred = [trace_true_pred, trace_x_eq_y] |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
78 fig_true_pred = go.Figure(data=data_true_pred, layout=layout_true_pred) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
79 plotly.offline.plot(fig_true_pred, filename="output_scatter_plot.html", auto_open=False) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
80 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
81 # residual plot |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
82 residual = predicted_values - true_values |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
83 trace_residual = go.Scatter( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
84 x=predicted_values, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
85 y=residual, |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
86 mode='markers' |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
87 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
88 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
89 layout_residual = go.Layout( |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
90 title='Residual vs predicted values', |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
91 xaxis=dict(title='Predicted values'), |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
92 yaxis=dict(title='Residual (Predicted - True)') |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
93 ) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
94 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
95 data_residual = [trace_residual] |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
96 fig_residual = go.Figure(data=data_residual, layout=layout_residual) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
97 plotly.offline.plot(fig_residual, filename="output_residual_plot.html", auto_open=False) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
98 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
99 |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
100 if __name__ == "__main__": |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
101 aparser = argparse.ArgumentParser() |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
102 aparser.add_argument("-i", "--input", dest="infile_input", required=True) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
103 aparser.add_argument("-j", "--output", dest="infile_output", required=True) |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
104 args = aparser.parse_args() |
0800a1b66bbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_regression_performance_plots commit c17efec384ad7438f54675fae1ab0c3a57c22869
bgruening
parents:
diff
changeset
|
105 main(args.infile_input, args.infile_output) |