summaryrefslogtreecommitdiff
path: root/report
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2010-08-04 11:01:20 +0200
committermguetlein <martin.guetlein@gmail.com>2010-08-04 11:01:20 +0200
commit148e4eaccf2e406586914150cf2f953fa5f12ece (patch)
tree00e028b23b5947b3708cb992f5492758537ca382 /report
parentad376b7c5c3bb5c4270c78c5dd342436eb5dcdb9 (diff)
add new /predictions funcionality
Diffstat (limited to 'report')
-rw-r--r--report/environment.rb1
-rw-r--r--report/prediction_util.rb45
-rw-r--r--report/report_factory.rb9
3 files changed, 6 insertions, 49 deletions
diff --git a/report/environment.rb b/report/environment.rb
index 7499491..e04c397 100644
--- a/report/environment.rb
+++ b/report/environment.rb
@@ -18,7 +18,6 @@ require "report/report_service.rb"
require "report/report_format.rb"
require "report/validation_access.rb"
require "report/validation_data.rb"
-require "report/prediction_util.rb"
require "report/util.rb"
require "report/external/mimeparse.rb"
diff --git a/report/prediction_util.rb b/report/prediction_util.rb
deleted file mode 100644
index 5ba3716..0000000
--- a/report/prediction_util.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-module Reports::PredictionUtil
-
- # creates an Array for a table
- # * first row: header values
- # * other rows: the prediction values
- # additional attribute values of the validation that should be added to the table can be defined via validation_attributes
- #
- # call-seq:
- # predictions_to_array(validation_set, validation_attributes=[]) => Array
- #
- def self.predictions_to_array(validation_set, validation_attributes=[])
-
- res = []
-
- validation_set.validations.each do |v|
- (0..v.get_predictions.num_instances-1).each do |i|
- a = []
- validation_attributes.each{ |att| a.push(v.send(att).to_s) }
-
- #PENDING!
- a.push( "http://ambit.uni-plovdiv.bg:8080/ambit2/depict/cdk?search="+URI.encode(OpenTox::Compound.new(:uri=>v.get_predictions.identifier(i)).smiles) )
-
- a.push(v.get_predictions.actual_value(i).to_nice_s)
- a.push(v.get_predictions.predicted_value(i).to_nice_s)
- a.push(v.get_predictions.classification_miss?(i)?"X":"") if validation_set.all_classification?
- a.push(v.get_predictions.confidence_value(i).to_nice_s) if v.get_predictions.confidence_values_available?
- a.push(v.get_predictions.identifier(i)) #.gsub(/[-(),=]/, '')[0,10])
- res.push(a)
- end
- end
-
- #res = res.sort{|x,y| y[3] <=> x[3] }
- header = [ "compound", "actual value", "predicted value"]
- header.push "missclassified" if validation_set.all_classification?
- header.push "confidence value" if validation_set.validations[0].get_predictions.confidence_values_available?
- header << "compound-uri"
- res.insert(0, validation_attributes + header)
- #puts res.collect{|c| c.inspect}.join("\n")
-
- return res
- end
-
-end
diff --git a/report/report_factory.rb b/report/report_factory.rb
index 646ecfd..b62f919 100644
--- a/report/report_factory.rb
+++ b/report/report_factory.rb
@@ -101,7 +101,7 @@ module Reports::ReportFactory
end
report.add_section_result(validation_set, Lib::ALL_PROPS, "All Results", "All Results")
- report.add_section_predictions( validation_set, [:crossvalidation_fold] )
+ report.add_section_predictions( validation_set ) #, [:crossvalidation_fold] )
return report
end
@@ -241,11 +241,14 @@ class Reports::ReportContent
section_title="Predictions",
section_text="This section contains predictions.",
table_title="Predictions")
-
+
+ #PENING
+ raise "validation attributes not implemented in get prediction array" if validation_attributes.size>0
+
section_table = @xml_report.add_section(@xml_report.get_root_element, section_title)
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, Reports::PredictionUtil.predictions_to_array(validation_set, validation_attributes))
+ @xml_report.add_table(section_table, table_title, Lib::OTPredictions.to_array(validation_set.validations.collect{|v| v.get_predictions}, true, true))
else
@xml_report.add_paragraph(section_table, "No prediction info available.")
end