summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-05-12 13:09:17 +0200
committermguetlein <martin.guetlein@gmail.com>2011-05-12 13:09:17 +0200
commitac97115f25ca0e8ecc3ffb6baed3739353cadb6f (patch)
treeb7dbb98a791db2685943e5d3d9999192ca131989
parentc858faa20607125097a3ca36f9178c4b4076b071 (diff)
rescue non-runtime error when plotting, more sensible error msg when no predictions for regression plot
-rw-r--r--report/plot_factory.rb3
-rwxr-xr-xreport/report_content.rb4
2 files changed, 4 insertions, 3 deletions
diff --git a/report/plot_factory.rb b/report/plot_factory.rb
index deb1880..5fd20bb 100644
--- a/report/plot_factory.rb
+++ b/report/plot_factory.rb
@@ -77,7 +77,8 @@ module Reports
x << x_i
y << y_i
end
-
+
+ raise "no predictions performed" if x.size==0 || x[0].size==0
RubyPlot::plot_points(out_file, "Regression plot", "Predicted values", "Actual values", names, x, y )
end
diff --git a/report/report_content.rb b/report/report_content.rb
index 1e47cee..6c8148e 100755
--- a/report/report_content.rb
+++ b/report/report_content.rb
@@ -161,7 +161,7 @@ class Reports::ReportContent
plot_file_path = add_tmp_file(plot_file_name)
Reports::PlotFactory.create_regression_plot( plot_file_path, prediction_set, name_attribute )
@xml_report.add_imagefigure(section_regr, image_title, plot_file_name, "PNG", 100, image_caption)
- rescue RuntimeError => ex
+ rescue Exception => ex
LOGGER.error("Could not create regression plot: "+ex.message)
rm_tmp_file(plot_file_name)
@xml_report.add_paragraph(section_regr, "could not create regression plot: "+ex.message)
@@ -200,7 +200,7 @@ class Reports::ReportContent
plot_file_path = add_tmp_file(plot_file_name)
Reports::PlotFactory.create_roc_plot( plot_file_path, prediction_set, class_value, split_set_attribute, false )#prediction_set.size>1 )
@xml_report.add_imagefigure(section_roc, image_title, plot_file_name, "PNG", 100, image_caption)
- rescue RuntimeError => ex
+ rescue Exception => ex
msg = "WARNING could not create roc plot for class value '"+class_value.to_s+"': "+ex.message
LOGGER.error(msg)
rm_tmp_file(plot_file_name)