summaryrefslogtreecommitdiff
path: root/lib/model.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-01-07 12:22:47 +0100
committerChristoph Helma <helma@in-silico.de>2010-01-07 12:22:47 +0100
commitc4d68eb599a6b563ac9967d3884ea31b0d619e38 (patch)
tree7fae9829ab42e04e39e34635b604ea8932c333bd /lib/model.rb
parentf178a17d3318082dfa923582715b39d72bd07c32 (diff)
parentbe07d3be0cc3236a22a47f0905c99f96508c9587 (diff)
find method fixed
Diffstat (limited to 'lib/model.rb')
-rw-r--r--lib/model.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/model.rb b/lib/model.rb
index 2f4525a..cd35f09 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -1,6 +1,6 @@
module OpenTox
module Model
-
+
class Lazar
include Owl
@@ -87,25 +87,28 @@ module OpenTox
end
end
end
- end
-
+ end
+
conf = conf/neighbors.size
if conf > 0.0
classification = true
elsif conf < 0.0
classification = false
end
-
+
compound = @dataset.find_or_create_compound(compound_uri)
feature = @dataset.find_or_create_feature(@lazar[:endpoint])
- tuple = @dataset.create_tuple(feature,{ 'lazar#classification' => classification, 'lazar#confidence' => conf})
- @dataset.add_tuple compound,tuple
- @predictions[compound_uri] = { @lazar[:endpoint] => { :lazar_prediction => {
- :classification => classification,
- :confidence => conf,
- :neighbors => neighbors,
- :features => compound_matches
- } } }
+
+ if (classification != nil)
+ tuple = @dataset.create_tuple(feature,{ 'lazar#classification' => classification, 'lazar#confidence' => conf})
+ @dataset.add_tuple compound,tuple
+ @predictions[compound_uri] = { @lazar[:endpoint] => { :lazar_prediction => {
+ :classification => classification,
+ :confidence => conf,
+ :neighbors => neighbors,
+ :features => compound_matches
+ } } }
+ end
end
def self.base_uri