summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-08-03 18:04:39 +0200
committerChristoph Helma <helma@in-silico.ch>2015-08-03 18:04:39 +0200
commitb90a31b9f5356680efd782b18b3587fac8d8010e (patch)
tree0e253062ba979578f1c17b6c74d3ff505d8979d1
parent5648e31134953703429e38dba0c22392b50092a9 (diff)
initial classification validation
-rw-r--r--lib/bbrc.rb2
-rw-r--r--lib/lazar.rb12
-rw-r--r--lib/opentox-algorithm.rb1
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/bbrc.rb b/lib/bbrc.rb
index 6e3af3a..81eeedc 100644
--- a/lib/bbrc.rb
+++ b/lib/bbrc.rb
@@ -34,7 +34,7 @@ module OpenTox
minfreq = minfreq.round
end
- @bbrc = Bbrc::Bbrc.new
+ @bbrc ||= Bbrc::Bbrc.new
@bbrc.Reset
if prediction_feature.numeric
@bbrc.SetRegression(true) # AM: DO NOT MOVE DOWN! Must happen before the other Set... operations!
diff --git a/lib/lazar.rb b/lib/lazar.rb
index 1e123d7..2bb89cd 100644
--- a/lib/lazar.rb
+++ b/lib/lazar.rb
@@ -170,7 +170,9 @@ module OpenTox
# prepare prediction dataset
prediction_dataset = LazarPrediction.new(
:title => "Lazar prediction for #{prediction_feature.title}",
- :creator => __FILE__
+ :creator => __FILE__,
+ :prediction_feature_id => prediction_feature.id
+
)
confidence_feature = OpenTox::NumericFeature.find_or_create_by( "title" => "Prediction confidence" )
warning_feature = OpenTox::NominalFeature.find_or_create_by("title" => "Warnings")
@@ -182,6 +184,14 @@ module OpenTox
end
end
+
+ def training_dataset
+ Dataset.find training_dataset_id
+ end
+
+ def prediction_feature
+ Feature.find prediction_feature_id
+ end
def training_activities
i = @training_dataset.feature_ids.index prediction_feature_id
diff --git a/lib/opentox-algorithm.rb b/lib/opentox-algorithm.rb
index 790803b..74e058c 100644
--- a/lib/opentox-algorithm.rb
+++ b/lib/opentox-algorithm.rb
@@ -23,3 +23,4 @@ require_relative "similarity.rb"
#require_relative "neighbors.rb"
require_relative "classification.rb"
require_relative "regression.rb"
+require_relative "validation.rb"