diff options
Diffstat (limited to 'report')
-rw-r--r-- | report/plot_factory.rb | 5 | ||||
-rwxr-xr-x | report/report_content.rb | 11 | ||||
-rwxr-xr-x | report/report_factory.rb | 18 | ||||
-rwxr-xr-x | report/report_persistance.rb | 1 | ||||
-rwxr-xr-x | report/validation_access.rb | 39 |
5 files changed, 47 insertions, 27 deletions
diff --git a/report/plot_factory.rb b/report/plot_factory.rb index f114dd3..6e90dbc 100644 --- a/report/plot_factory.rb +++ b/report/plot_factory.rb @@ -4,7 +4,8 @@ ENV['RANK_PLOTTER_JAR'] = "RankPlotter/RankPlotter.jar" unless ENV['RANK_PLOTTER CONF_PLOT_RANGE = { :accuracy => [0.45,1.05], :true_positive_rate => [0.45,1.05],:true_negative_rate => [0.45,1.05], :false_positive_rate => [0.45,1.05], :false_negative_rate => [0.45,1.05], :positive_predictive_value => [0.45,1.05], - :negative_predictive_value => [0.45,1.05], :r_square => [0, 1.05], :sample_correlation_coefficient => [0, 1.05] } + :negative_predictive_value => [0.45,1.05], :r_square => [0, 1.05], :sample_correlation_coefficient => [0, 1.05], + :concordance_correlation_coefficient => [0, 1.05] } class Array def swap!(i,j) @@ -124,7 +125,7 @@ module Reports else Reports::r_util.feature_value_plot(out_files, validation_set.validations[0].training_feature_dataset_uri, validation_set.validations[0].test_feature_dataset_uri, "Training Data", "Test Data", - nil, true, validation_set.validations[0].subjectid, waiting_task ) + nil, validation_set.validations[0].subjectid, waiting_task ) end end diff --git a/report/report_content.rb b/report/report_content.rb index 80473c5..033b367 100755 --- a/report/report_content.rb +++ b/report/report_content.rb @@ -63,20 +63,17 @@ class Reports::ReportContent end end - def add_predictions( validation_set, - validation_attributes=[], + def add_predictions( validation_set, + add_validation_uris, section_title="Predictions", section_text=nil, table_title="Predictions") - - #PENING - raise "validation attributes not implemented in get prediction array" if validation_attributes.size>0 - section_table = @xml_report.add_section(@current_section, section_title) if validation_set.validations[0].get_predictions @xml_report.add_paragraph(section_table, section_text) if section_text + v_uris = validation_set.validations.collect{|v| Array.new(v.num_instances.to_i,v.validation_uri)} if add_validation_uris @xml_report.add_table(section_table, table_title, Lib::OTPredictions.to_array(validation_set.validations.collect{|v| v.get_predictions}, - true, true)) + true, true, v_uris)) else @xml_report.add_paragraph(section_table, "No prediction info available.") end diff --git a/report/report_factory.rb b/report/report_factory.rb index 2bb74ee..f73ffd9 100755 --- a/report/report_factory.rb +++ b/report/report_factory.rb @@ -9,7 +9,7 @@ VAL_ATTR_CLASS = [ :num_instances, :num_unpredicted, :accuracy, :weighted_accura :area_under_roc, :f_measure, :true_positive_rate, :true_negative_rate, :positive_predictive_value, :negative_predictive_value ] VAL_ATTR_REGR = [ :num_instances, :num_unpredicted, :root_mean_squared_error, :weighted_root_mean_squared_error, :mean_absolute_error, :weighted_mean_absolute_error, :r_square, :weighted_r_square, - :sample_correlation_coefficient ] + :sample_correlation_coefficient, :concordance_correlation_coefficient ] #VAL_ATTR_BOX_PLOT_CLASS = [ :accuracy, :average_area_under_roc, # :area_under_roc, :f_measure, :true_positive_rate, :true_negative_rate ] @@ -113,6 +113,9 @@ module Reports::ReportFactory report.add_confidence_plot(validation_set, :root_mean_squared_error, nil) report.add_confidence_plot(validation_set, :r_square, nil) report.align_last_two_images "Confidence Plots" + report.add_confidence_plot(validation_set, :sample_correlation_coefficient, nil) + report.add_confidence_plot(validation_set, :concordance_correlation_coefficient, nil) + report.align_last_two_images "More Confidence Plots" end task.progress(70) if task report.add_train_test_plot( validation_set, false, OpenTox::SubTask.create(task,70,80) ) @@ -121,7 +124,7 @@ module Reports::ReportFactory report.end_section report.add_result(validation_set, Validation::ALL_PROPS, "All Results", "All Results") - report.add_predictions( validation_set ) + report.add_predictions( validation_set, false ) task.progress(100) if task report end @@ -175,7 +178,8 @@ module Reports::ReportFactory report.end_section report.add_result(validation_set, [:validation_uri, :validation_report_uri]+VAL_ATTR_CV+VAL_ATTR_CLASS-[:num_folds, :dataset_uri, :algorithm_uri], - "Results","Results") + "Results","Results") if + (cv_set.unique_value(:num_folds).to_i < cv_set.unique_value(:num_instances).to_i) when "regression" report.add_result(cv_set, [:crossvalidation_uri]+VAL_ATTR_CV+VAL_ATTR_REGR-[:crossvalidation_fold],res_titel, res_titel, res_text) report.add_section("Plots") @@ -189,12 +193,14 @@ module Reports::ReportFactory report.end_section report.add_result(validation_set, [:validation_uri, :validation_report_uri]+VAL_ATTR_CV+VAL_ATTR_REGR-[:num_folds, :dataset_uri, :algorithm_uri], - "Results","Results") + "Results","Results") if + (cv_set.unique_value(:num_folds).to_i < cv_set.unique_value(:num_instances).to_i) end task.progress(90) if task - report.add_result(validation_set, Validation::ALL_PROPS, "All Results", "All Results") - report.add_predictions( validation_set ) #, [:crossvalidation_fold] ) + report.add_result(validation_set, Validation::ALL_PROPS, "All Results", "All Results") if + (cv_set.unique_value(:num_folds).to_i < cv_set.unique_value(:num_instances).to_i) + report.add_predictions( validation_set, true ) task.progress(100) if task report end diff --git a/report/report_persistance.rb b/report/report_persistance.rb index e02387f..ccdebad 100755 --- a/report/report_persistance.rb +++ b/report/report_persistance.rb @@ -200,6 +200,7 @@ module Reports index :report_type index :validation_uris index :crossvalidation_uris + index :algorithm_uris attr_accessor :subjectid diff --git a/report/validation_access.rb b/report/validation_access.rb index aaa7bdc..e2a3978 100755 --- a/report/validation_access.rb +++ b/report/validation_access.rb @@ -145,20 +145,35 @@ class Reports::ValidationDB end def test_feature_dataset_uri(validation, subjectid) - m = OpenTox::Model::Generic.find(validation.model_uri, subjectid) - feat_gen = nil - m.metadata[OT.parameters].each do |h| - if h[DC.title] and h[DC.title]=~/feature_generation/ and h[OT.paramValue] - feat_gen = h[OT.paramValue] + training_features = Lib::DatasetCache.find( training_feature_dataset_uri(validation,subjectid), subjectid ) + test_dataset = Lib::DatasetCache.find( validation.test_dataset_uri, subjectid ) + features_found = true + training_features.features.keys.each do |f| + unless test_dataset.features.keys.include?(f) + features_found = false + LOGGER.debug "training-feature are not in test-datset #{f}" break end - end if m and m.metadata[OT.parameters] - raise "no feature creation alg found" unless feat_gen - feat_gen = File.join(feat_gen,"match") if feat_gen=~/fminer/ - uri = OpenTox::RestClientWrapper.post(feat_gen,{:subjectid => subjectid, - :feature_dataset_uri=>training_feature_dataset_uri(validation,subjectid), - :dataset_uri=>validation.test_dataset_uri}) - @@tmp_resources << uri + end + if features_found + LOGGER.debug "all training-features found in test-datset" + uri = test_dataset.uri + else + m = OpenTox::Model::Generic.find(validation.model_uri, subjectid) + feat_gen = nil + m.metadata[OT.parameters].each do |h| + if h[DC.title] and h[DC.title]=~/feature_generation/ and h[OT.paramValue] + feat_gen = h[OT.paramValue] + break + end + end if m and m.metadata[OT.parameters] + raise "no feature creation alg found" unless feat_gen + feat_gen = File.join(feat_gen,"match") if feat_gen=~/fminer/ + uri = OpenTox::RestClientWrapper.post(feat_gen,{:subjectid => subjectid, + :feature_dataset_uri=>training_feature_dataset_uri(validation,subjectid), + :dataset_uri=>validation.test_dataset_uri}) + @@tmp_resources << uri + end uri end |