summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2010-12-13 16:55:41 +0100
committermguetlein <martin.guetlein@gmail.com>2010-12-13 16:55:41 +0100
commit98e44551ce44ff9579fd9b07a2939c3731b55c71 (patch)
treeef0ea6bf3e35a72dee491c082762266e65374534
parent3fd24182bee64ea2252aa494e5930c9c9924d1d2 (diff)
minor changes on reporting
-rw-r--r--report/environment.rb4
-rw-r--r--report/report_content.rb10
-rw-r--r--report/report_factory.rb4
-rw-r--r--report/xml_report.rb6
4 files changed, 13 insertions, 11 deletions
diff --git a/report/environment.rb b/report/environment.rb
index 723dd79..1f62d0e 100644
--- a/report/environment.rb
+++ b/report/environment.rb
@@ -1,11 +1,13 @@
['rubygems', 'logger', 'fileutils', 'sinatra', 'sinatra/url_for', 'rest_client',
- 'yaml', 'fileutils', 'mime/types', 'abbrev',
+ 'yaml', 'fileutils', 'mime/types', 'abbrev', 'rinruby',
'rexml/document', 'ruby-plot', 'opentox-ruby-api-wrapper' ].each do |g|
require g
end
gem 'ruby-plot', '= 0.0.2'
+R.quit
+
module Reports
end
diff --git a/report/report_content.rb b/report/report_content.rb
index f605bdc..eeb65e9 100644
--- a/report/report_content.rb
+++ b/report/report_content.rb
@@ -59,7 +59,7 @@ class Reports::ReportContent
if validation_set.validations[0].get_predictions
@xml_report.add_paragraph(section_table, section_text) if section_text
@xml_report.add_table(section_table, table_title, Lib::OTPredictions.to_array(validation_set.validations.collect{|v| v.get_predictions},
- true, false, true))
+ true, true))
else
@xml_report.add_paragraph(section_table, "No prediction info available.")
end
@@ -160,7 +160,7 @@ class Reports::ReportContent
begin
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, "SVG", image_caption)
+ @xml_report.add_imagefigure(section_regr, image_title, plot_file_name, "SVG", 120, image_caption)
rescue RuntimeError => ex
LOGGER.error("Could not create regression plot: "+ex.message)
rm_tmp_file(plot_file_name)
@@ -199,7 +199,7 @@ class Reports::ReportContent
begin
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, "SVG", image_caption)
+ @xml_report.add_imagefigure(section_roc, image_title, plot_file_name, "SVG", 120, image_caption)
rescue RuntimeError => ex
msg = "WARNING could not create roc plot for class value '"+class_value+"': "+ex.message
LOGGER.error(msg)
@@ -255,7 +255,7 @@ class Reports::ReportContent
@tmp_file_count += 1
plot_file_path = add_tmp_file(plot_file_name)
Reports::PlotFactory::create_ranking_plot(plot_file_path, validation_set, compare_attribute, equal_attribute, rank_attribute, class_value)
- @xml_report.add_imagefigure(report_section, image_title, plot_file_name, "SVG", image_caption)
+ @xml_report.add_imagefigure(report_section, image_title, plot_file_name, "SVG", 75, image_caption)
end
end
@@ -274,7 +274,7 @@ class Reports::ReportContent
@tmp_file_count += 1
plot_file_path = add_tmp_file(plot_file_name)
Reports::PlotFactory.create_bar_plot(plot_file_path, validation_set, title_attribute, value_attributes )
- @xml_report.add_imagefigure(section_bar, image_title, plot_file_name, "SVG", image_caption)
+ @xml_report.add_imagefigure(section_bar, image_title, plot_file_name, "SVG", 120, image_caption)
end
private
diff --git a/report/report_factory.rb b/report/report_factory.rb
index 1688452..ee66df7 100644
--- a/report/report_factory.rb
+++ b/report/report_factory.rb
@@ -173,11 +173,11 @@ module Reports::ReportFactory
attributes = ([ :dataset_uri ] + attributes).uniq
dataset_grouping.each do |validations|
-
+
set = Reports::ValidationSet.create(validations)
+
dataset = validations[0].dataset_uri
merged = set.merge([:algorithm_uri, :dataset_uri, :crossvalidation_id, :crossvalidation_uri])
- merged.sort(:algorithm_uri)
merged.sort(:dataset_uri)
report.add_section("Dataset: "+dataset)
diff --git a/report/xml_report.rb b/report/xml_report.rb
index 33b47d3..76844b3 100644
--- a/report/xml_report.rb
+++ b/report/xml_report.rb
@@ -100,14 +100,14 @@ module Reports
# call-seq:
# add_imagefigure( element, title, path, filetype, caption = nil ) => REXML::Element
#
- def add_imagefigure( element, title, path, filetype, caption = nil )
+ def add_imagefigure( element, title, path, filetype, size_pct=100, caption = nil )
figure = Reports::XMLReportUtil.attribute_element("figure", {"float" => 0})
figure << Reports::XMLReportUtil.text_element("title", title)
media = Element.new("mediaobject")
image = Element.new("imageobject")
imagedata = Reports::XMLReportUtil.attribute_element("imagedata",
- {"fileref" => path, "format"=>filetype, "contentwidth" => "100%",
+ {"fileref" => path, "format"=>filetype, "contentwidth" => size_pct.to_s+"%",
#"contentdepth"=> "4in"
})#"width" => "6in", "height" => "5in"}) #"contentwidth" => "100%"})
#imagedata = Reports::XMLReportUtil.attribute_element("imagedata",{"width" => "6in", "fileref" => path, "format"=>filetype})
@@ -254,7 +254,7 @@ module Reports
section1 = rep.add_section(rep.get_root_element, "First Section")
rep.add_paragraph(section1, "some text")
rep.add_paragraph(section1, "even more text")
- rep.add_imagefigure(section1, "Figure", "http://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/Siegel_der_Albert-Ludwigs-Universit%C3%A4t_Freiburg.svg/354px-Siegel_der_Albert-Ludwigs-Universit%C3%A4t_Freiburg.svg", "SVG", "this is the logo of freiburg university")
+ rep.add_imagefigure(section1, "Figure", "http://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/Siegel_der_Albert-Ludwigs-Universit%C3%A4t_Freiburg.svg/354px-Siegel_der_Albert-Ludwigs-Universit%C3%A4t_Freiburg.svg", "SVG", 100, "this is the logo of freiburg university")
section2 = rep.add_section(rep.get_root_element,"Second Section")
rep.add_section(section2,"A Subsection")
rep.add_section(section2,"Another Subsection")