diff options
author | Christoph Helma <helma@in-silico.ch> | 2011-05-23 17:36:35 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2011-05-23 17:36:35 +0200 |
commit | a330ad06b524e6d02bb01b3b7a12fb36a4800120 (patch) | |
tree | e741b4da62a672de28a38e669639ab9caca8801e /lazar.rb | |
parent | 833ef87110aeb86c1dc304c2993616390d1e6fe4 (diff) | |
parent | f89b8bb8cae41a814b97340324338a8046ddabf9 (diff) |
Merge branch 'feature/new_model_prediction_format' into development
Conflicts:
lazar.rb
Diffstat (limited to 'lazar.rb')
-rw-r--r-- | lazar.rb | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,6 +1,7 @@ require 'rubygems' require 'opentox-ruby' require 'test/unit' +require "./validate-owl.rb" class Float def round_to(x) @@ -24,6 +25,8 @@ class LazarTest < Test::Unit::TestCase =end def test_create_regression_model model_uri = OpenTox::Algorithm::Lazar.new.run({:dataset_uri => @@regression_training_dataset.uri, :subjectid => @@subjectid}).to_s + puts model_uri + validate_owl model_uri,@@subjectid lazar = OpenTox::Model::Lazar.find model_uri, @@subjectid @models << lazar assert_equal 185, lazar.features.size @@ -33,6 +36,8 @@ class LazarTest < Test::Unit::TestCase @predictions << prediction assert_equal prediction.value(compound).round_to(3),0.2849.round_to(3) assert_equal prediction.confidence(compound).round_to(3), 0.3223.round_to(3) + #assert_equal prediction.value(compound).round_to(4), 0.2847.round_to(4) + #assert_equal prediction.confidence(compound).round_to(4), 0.3223.round_to(4) assert_equal prediction.neighbors(compound).size, 73 end @@ -40,6 +45,7 @@ class LazarTest < Test::Unit::TestCase # create model model_uri = OpenTox::Algorithm::Lazar.new.run({:dataset_uri => @@classification_training_dataset.uri, :subjectid => @@subjectid}).to_s + validate_owl model_uri,@@subjectid lazar = OpenTox::Model::Lazar.find model_uri, @@subjectid @models << lazar assert_equal lazar.features.size, 52 @@ -49,6 +55,7 @@ class LazarTest < Test::Unit::TestCase prediction_uri = lazar.run(:compound_uri => compound.uri, :subjectid => @@subjectid) prediction = OpenTox::LazarPrediction.find(prediction_uri, @@subjectid) @predictions << prediction + #puts prediction_uri assert_equal prediction.value(compound), false assert_equal prediction.confidence(compound).round_to(4), 0.3067.round_to(4) assert_equal prediction.neighbors(compound).size, 14 @@ -78,7 +85,7 @@ class LazarTest < Test::Unit::TestCase model_uri = OpenTox::Algorithm::Lazar.new.run({:dataset_uri => @@classification_training_dataset.uri, :subjectid => @@subjectid, :prediction_algorithm => "local_svm_classification"}).to_s lazar = OpenTox::Model::Lazar.find model_uri, @@subjectid @models << lazar - assert_equal lazar.features.size, 53 + assert_equal lazar.features.size, 52 # single prediction compound = OpenTox::Compound.from_smiles("c1ccccc1NN") @@ -100,6 +107,7 @@ class LazarTest < Test::Unit::TestCase end +=begin def test_ambit_classification_model # create model @@ -108,6 +116,7 @@ class LazarTest < Test::Unit::TestCase #model_uri = OpenTox::Algorithm::Lazar.new.run({:dataset_uri => dataset_uri, :prediction_feature => feature_uri}).to_s #lazar = OpenTox::Model::Lazar.find model_uri model_uri = OpenTox::Algorithm::Lazar.new.run({:dataset_uri => dataset_uri, :prediction_feature => feature_uri, :subjectid => @@subjectid}).to_s + validate_owl model_uri,@@subjectid lazar = OpenTox::Model::Lazar.find model_uri, @@subjectid assert_equal lazar.features.size, 6609 #puts "Model: #{lazar.uri}" @@ -139,7 +148,6 @@ class LazarTest < Test::Unit::TestCase # dataset prediction #@lazar.delete(@@subjectid) end -=begin =end end |