summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gütlein <martin.guetlein@gmail.com>2010-01-15 10:36:18 +0100
committerMartin Gütlein <martin.guetlein@gmail.com>2010-01-15 10:36:18 +0100
commitdc5a64cf91eff9011cdcdcd028e2bc19c1a3bd13 (patch)
treee26bf1089344ebf1b3166392746190ba5fd33a7c
parente65b7f04ce114affd6f1a3318c938f6a19fa1451 (diff)
minor changes, simply validation access initialization
-rw-r--r--report/report_factory.rb4
-rw-r--r--report/report_service.rb1
-rw-r--r--report/validation_access.rb34
-rw-r--r--report/validation_data.rb28
4 files changed, 35 insertions, 32 deletions
diff --git a/report/report_factory.rb b/report/report_factory.rb
index 2d7de03..b13624f 100644
--- a/report/report_factory.rb
+++ b/report/report_factory.rb
@@ -49,7 +49,7 @@ module Reports::ReportFactory
report = Reports::ReportContent.new("Validation report")
- if (val.percent_correct != nil) #classification
+ if (val.classification?)
report.add_section_result(validation_set, VAL_ATTR_TRAIN_TEST + VAL_ATTR_CLASS, "Results", "Results")
val.get_prediction_feature_values.each do |class_value|
report.add_section_roc_plot(validation_set, class_value, nil, "roc-plot-"+class_value+".svg")
@@ -199,7 +199,7 @@ class Reports::ReportContent
vals = validation_set.to_array(validation_attributes)
#PENDING rexml strings in tables not working when >66
vals = vals.collect{|a| a.collect{|v| v.to_s[0,66] }}
- #transpose values if there more than 4 columns, and there are more than columns than rows
+ #PENDING transpose values if there more than 4 columns, and there are more than columns than rows
transpose = vals[0].size>4 && vals[0].size>vals.size
@xml_report.add_table(section_table, table_title, vals, !transpose, transpose)
end
diff --git a/report/report_service.rb b/report/report_service.rb
index 36bd176..43b9992 100644
--- a/report/report_service.rb
+++ b/report/report_service.rb
@@ -102,6 +102,7 @@ module Reports
@persistance.delete_report(type, id)
end
+ # no api-access for this method
def delete_all_reports( type )
LOGGER.info "deleteing all reports of ype '"+type.to_s+"'"
diff --git a/report/validation_access.rb b/report/validation_access.rb
index ce09131..2a5ce51 100644
--- a/report/validation_access.rb
+++ b/report/validation_access.rb
@@ -4,28 +4,43 @@ require "lib/wrapper.rb"
# = Reports::ValidationAccess
#
-# service that connects to the validation-service
+# service that connects (mainly) to the validation-service
#
class Reports::ValidationAccess
- # initialize validation object with
+ # initialize Reports::Validation object with data from Lib:Validation object
+ #
def init_validation(validation, uri)
raise "not implemented"
end
+ # sets cv-attributes in Reports::Validation object
+ #
def init_cv(validation)
raise "not implemented"
end
+ # yields predictions (Lib::OTPredictions) if available
+ #
def get_predictions(validation)
raise "not implemented"
end
+ # replaces crossvalidations uris with corresponding validation uris, in-/output: array
+ #
def resolve_cv_uris(validation_uris)
raise "not implemented"
end
- def get_prediction_feature_values(prediction_feature)
+ # get domain/class values of prediction feature
+ #
+ def get_prediction_feature_values(validation)
+ raise "not implemented"
+ end
+
+ # is validation classification?
+ #
+ def classification?(validation)
raise "not implemented"
end
@@ -58,10 +73,6 @@ class Reports::ValidationDB < Reports::ValidationAccess
validation.send("#{p.to_s}=".to_sym, v[p])
end
- #model = OpenTox::Model::LazarClassificationModel.new(v[:model_uri])
- #raise "cannot access model '"+v[:model_uri].to_s+"'" unless model
- #validation.prediction_feature = model.get_prediction_feature
-
{:classification_statistics => Lib::VAL_CLASS_PROPS,
:regression_statistics => Lib::VAL_REGR_PROPS}.each do |subset_name,subset_props|
subset = v[subset_name]
@@ -80,7 +91,8 @@ class Reports::ValidationDB < Reports::ValidationAccess
end
def get_predictions(validation)
- Lib::OTPredictions.new( validation.classification?, validation.prediction_feature, validation.test_dataset_uri, validation.prediction_dataset_uri)
+ Lib::OTPredictions.new( validation.classification?, validation.prediction_feature,
+ validation.test_dataset_uri, validation.prediction_dataset_uri)
end
def get_prediction_feature_values( validation )
@@ -95,7 +107,9 @@ class Reports::ValidationDB < Reports::ValidationAccess
end
-
+#
+# OUTDATED, please update before use
+#
class Reports::ValidationWebservice < Reports::ValidationAccess
def resolve_cv_uris(validation_uris)
@@ -163,6 +177,8 @@ end
# = Reports::OTMockLayer
#
+# OUTDATED, please update before use
+#
# does not connect to other services, provides randomly generated data
#
class Reports::ValidationMockLayer < Reports::ValidationAccess
diff --git a/report/validation_data.rb b/report/validation_data.rb
index a101748..f5ef9b4 100644
--- a/report/validation_data.rb
+++ b/report/validation_data.rb
@@ -34,30 +34,16 @@ module Reports
#
class Validation
- def self.reset_validation_access( validation_access=nil )
-
- if validation_access
- @@validation_access=validation_access
- else
- case ENV['REPORT_VALIDATION_ACCESS']
- when "mock_layer"
- @@validation_access = Reports::ValidationMockLayer.new
- when "webservice"
- @@validation_access = Reports::ValidationWebservice.new
- else #default
- @@validation_access = Reports::ValidationDB.new
- end
- end
- end
+ @@validation_access = Reports::ValidationDB.new
def self.resolve_cv_uris(validation_uris)
@@validation_access.resolve_cv_uris(validation_uris)
end
+ # create member variables for all validation properties
@@validation_attributes = Lib::ALL_PROPS +
VAL_ATTR_VARIANCE.collect{ |a| (a.to_s+"_variance").to_sym } +
VAL_ATTR_RANKING.collect{ |a| (a.to_s+"_ranking").to_sym }
-
@@validation_attributes.each{ |a| attr_accessor a }
attr_reader :predictions, :merge_count
@@ -67,7 +53,7 @@ module Reports
@merge_count = 1
end
- # returns predictions, these are dynamically generated and stored in this object
+ # returns/creates predictions, cache to save rest-calls/computation time
#
# call-seq:
# get_predictions => Reports::Predictions
@@ -88,6 +74,8 @@ module Reports
@prediction_feature_values = @@validation_access.get_prediction_feature_values(self)
end
+ # is classification validation? cache to save resr-calls
+ #
def classification?
return @is_classification if @is_classification!=nil
@is_classification = @@validation_access.classification?(self)
@@ -115,9 +103,10 @@ module Reports
# call-seq:
# merge( validation, equal_attributes) => Reports::Validation
#
- def merge_validation( validation, equal_attributes)
+ def merge_validation( validation, equal_attributes )
new_validation = Reports::Validation.new
+ # validation cannot be merged before
raise "not working" if validation.merge_count > 1
@@validation_attributes.each do |a|
@@ -390,7 +379,4 @@ module Reports
end
- # initialize validation_access
- Validation.reset_validation_access
-
end \ No newline at end of file