diff options
author | Martin Gütlein <martin.guetlein@gmail.com> | 2010-01-07 08:56:18 +0100 |
---|---|---|
committer | Martin Gütlein <martin.guetlein@gmail.com> | 2010-01-07 08:56:18 +0100 |
commit | be07d3be0cc3236a22a47f0905c99f96508c9587 (patch) | |
tree | 177d8226a8196b5937232c710bbbd161c7197ed2 /lib/model.rb | |
parent | 89bc8a67e63cf8e752f3b89aa52f7db87ce7ea7f (diff) |
minor changes: no nil classification, fix create datasets (no my librdf version)
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 |