diff options
Diffstat (limited to 'lib/model.rb')
-rw-r--r-- | lib/model.rb | 27 |
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 |