diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-05-16 14:46:50 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-05-16 14:46:50 +0200 |
commit | eb5f8b5da9b247d62abc8a7b9eb2e44fe46a1c79 (patch) | |
tree | 99bbf52ad3b7495114ffe50194b8f9c606f5f248 /report/report_content.rb | |
parent | 8afc018a179b254905f93ef8607338a7826baf4e (diff) |
add confidence plots
Diffstat (limited to 'report/report_content.rb')
-rwxr-xr-x | report/report_content.rb | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/report/report_content.rb b/report/report_content.rb index 6c8148e..ca04f25 100755 --- a/report/report_content.rb +++ b/report/report_content.rb @@ -147,8 +147,8 @@ class Reports::ReportContent image_caption=nil) image_title = "Regression plot" unless image_title - - section_regr = @xml_report.add_section(@current_section, section_title) + #section_regr = @xml_report.add_section(@current_section, section_title) + section_regr = @current_section prediction_set = validation_set.collect{ |v| v.get_predictions } if prediction_set.size>0 @@ -178,7 +178,8 @@ class Reports::ReportContent image_titles=nil, image_captions=nil) - section_roc = @xml_report.add_section(@current_section, section_title) + #section_roc = @xml_report.add_section(@current_section, section_title) + section_roc = @current_section prediction_set = validation_set.collect{ |v| v.get_predictions && v.get_predictions.confidence_values_available? } if prediction_set.size>0 @@ -213,6 +214,49 @@ class Reports::ReportContent end + def add_confidence_plot( validation_set, + split_set_attribute = nil, + section_title="Confidence plots", + section_text=nil, + image_titles=nil, + image_captions=nil) + + #section_conf = @xml_report.add_section(@current_section, section_title) + section_conf = @current_section + prediction_set = validation_set.collect{ |v| v.get_predictions && v.get_predictions.confidence_values_available? } + + if prediction_set.size>0 + if prediction_set.size!=validation_set.size + section_text += "\nWARNING: plot information not available for all validation results" + LOGGER.error "WARNING: plot information not available for all validation results:\n"+ + "validation set size: "+validation_set.size.to_s+", prediction set size: "+prediction_set.size.to_s + end + @xml_report.add_paragraph(section_conf, section_text) if section_text + + image_title = image_titles ? image_titles[i] : "Percent Correct vs Confidence Plot" + image_caption = image_captions ? image_captions[i] : nil + plot_file_name = "conf_plot"+@tmp_file_count.to_s+".png" + @tmp_file_count += 1 + + begin + + plot_file_path = add_tmp_file(plot_file_name) + Reports::PlotFactory.create_confidence_plot( plot_file_path, prediction_set, nil, split_set_attribute, false ) + @xml_report.add_imagefigure(section_conf, image_title, plot_file_name, "PNG", 100, image_caption) + + rescue Exception => ex + msg = "WARNING could not create confidence plot: "+ex.message + LOGGER.error(msg) + rm_tmp_file(plot_file_name) + @xml_report.add_paragraph(section_conf, msg) + end + + else + @xml_report.add_paragraph(section_conf, "No prediction-confidence info for confidence plot available.") + end + + end + def add_ranking_plots( validation_set, compare_attribute, equal_attribute, |