diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-11-16 09:39:29 +0100 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-11-16 09:39:29 +0100 |
commit | 22b522fbf021431cf2f58724a0f4b432c454432f (patch) | |
tree | 17c89f2c4cd19fe2fa12702db9c19bf4a2a339ce /lazar.rb | |
parent | 5cfa964fa28e79f8aa129ddd96362bc7d47af3e1 (diff) | |
parent | 68e5d55d80536bd995bc2c0b0fd233d7c43fda2d (diff) |
Merge branch 'development' into numeric
Conflicts:
lazar.rb
Diffstat (limited to 'lazar.rb')
-rw-r--r-- | lazar.rb | 122 |
1 files changed, 30 insertions, 92 deletions
@@ -60,6 +60,26 @@ class LazarTest < Test::Unit::TestCase @model.delete(@@subjectid) end +=begin +=end + def test_create_regression_model + create_model :dataset_uri => @@regression_training_dataset.uri + predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") + assert_in_delta @predictions.first.value(@compounds.first), 1.095, 0.01 + assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3) + assert_equal 253, @predictions.first.neighbors(@compounds.first).size + cleanup + end + + def test_create_regression_prop_model + create_model :dataset_uri => @@regression_training_dataset.uri, :local_svm_kernel => "propositionalized" + predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") + assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3) + assert_equal 253, @predictions.first.neighbors(@compounds.first).size + assert_equal 131, @model.features.size + cleanup + end + def test_classification_model create_model :dataset_uri => @@classification_training_dataset.uri # single prediction @@ -124,115 +144,33 @@ class LazarTest < Test::Unit::TestCase cleanup end - def test_classification_default_nr_hits_true - create_model :dataset_uri => @@classification_training_dataset.uri, :nr_hits => "true" - predict_compound OpenTox::Compound.from_smiles("c1c[c+](O)ccc1NN") - assert_equal "true", @predictions.first.value(@compounds.first) - assert_equal 0.0749, @predictions.first.confidence(@compounds.first).round_to(4) - assert_equal 18, @predictions.first.neighbors(@compounds.first).size - assert_equal 41, @model.features.size - cleanup - end - - def test_classification_default_nr_hits_false - create_model :dataset_uri => @@classification_training_dataset.uri, :nr_hits => "false" - predict_compound OpenTox::Compound.from_smiles("NNc1cccc1") - assert_equal "true", @predictions.first.value(@compounds.first) - assert_equal 0.1339, @predictions.first.confidence(@compounds.first).round_to(4) - assert_equal 26, @predictions.first.neighbors(@compounds.first).size - assert_equal 41, @model.features.size - cleanup - end - - def test_create_regression_model - create_model :dataset_uri => @@regression_training_dataset.uri - predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") - assert_equal 0.93.round_to(2), @predictions.first.value(@compounds.first).round_to(2)#1.09 - assert_equal 0.154.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3) - assert_equal 253, @predictions.first.neighbors(@compounds.first).size - assert_equal 131, @model.features.size - cleanup - end - - def test_create_regression_prop_model - create_model :dataset_uri => @@regression_training_dataset.uri, :local_svm_kernel => "propositionalized" - predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") - assert 0.5 || 0.6, @predictions.first.value(@compounds.first).round_to(1) - assert_equal 0.154, @predictions.first.confidence(@compounds.first).round_to(3) - assert_equal 253, @predictions.first.neighbors(@compounds.first).size - assert_equal 131, @model.features.size - cleanup - end - - def test_create_regression_svm_conf_and_nr_false - create_model :dataset_uri => @@regression_training_dataset.uri,:prediction_algorithm => "local_svm_regression", :nr_hits => false, :conf_stdev => false - predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") - assert_equal 0.42, @predictions.first.value(@compounds.first).round_to(2)#1.09.round_to(2), @predictions.first.value(@compounds.first).round_to(2) - assert_equal 0.262, @predictions.first.confidence(@compounds.first).round_to(3) - assert_equal 123, @predictions.first.neighbors(@compounds.first).size - assert_equal 131, @model.features.size - cleanup - end - -# def test_regression_mlr_prop_default +# def test_regression_mlr_prop_model # create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop" # predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") -# assert_equal 0.154, @predictions.first.confidence(@compounds.first).round_to(3) +# assert_equal 0.453, @predictions.first.confidence(@compounds.first).round_to(3) # assert_equal 0.265, @predictions.first.value(@compounds.first).round_to(3) # assert_equal 253, @predictions.first.neighbors(@compounds.first).size # assert_equal 131, @model.features.size -# cleanup -# end +# end # -# def test_regression_mlr_prop_conf_stdev_true +# def test_regression_mlr_prop_conf_stdev # create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :conf_stdev => "true" # predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") # assert_equal 0.154, @predictions.first.confidence(@compounds.first).round_to(3) # assert_equal 0.265, @predictions.first.value(@compounds.first).round_to(3) # assert_equal 253, @predictions.first.neighbors(@compounds.first).size -# assert 132 || 131, @model.features.size -# cleanup -# end +# assert_equal 131, @model.features.size +# end # -# def test_regression_mlr_prop_conf_stdev_false -# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :conf_stdev => "false" +# +# def test_regression_mlr_prop_weighted_model +# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :nr_hits => "true" # predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") # assert_equal 0.453, @predictions.first.confidence(@compounds.first).round_to(3) # assert_equal 0.265, @predictions.first.value(@compounds.first).round_to(3) # assert_equal 253, @predictions.first.neighbors(@compounds.first).size # assert_equal 131, @model.features.size -# cleanup -# end -# -# def test_regression_mlr_prop_nr_hits_true -# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :nr_hits => "true" -# predict_compound OpenTox::Compound.from_smiles("c1c[c+](O)ccc1NN") -# assert_equal 0.028, @predictions.first.confidence(@compounds.first).round_to(3) -# assert_equal 0.741, @predictions.first.value(@compounds.first).round_to(3) -# assert_equal 12, @predictions.first.neighbors(@compounds.first).size -# assert_equal 131, @model.features.size -# cleanup -# end -# -# def test_regression_mlr_prop_nr_hits_false -# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :nr_hits => "false" -# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") -# assert_equal 0.056, @predictions.first.confidence(@compounds.first).round_to(3) -# assert_equal 0.168, @predictions.first.value(@compounds.first).round_to(3) -# assert_equal 123, @predictions.first.neighbors(@compounds.first).size -# assert_equal 131, @model.features.size -# cleanup -# end -# -# def test_regression_mlr_prop_conf_stdev_and_nr_hits_false -# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :nr_hits => "false", :conf_stdev => "false" -# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") -# assert_equal 0.262, @predictions.first.confidence(@compounds.first).round_to(3) -# assert_equal 0.168, @predictions.first.value(@compounds.first).round_to(3) -# assert_equal 123, @predictions.first.neighbors(@compounds.first).size -# assert_equal 131, @model.features.size -# cleanup -# end +# end def test_conf_stdev params = {:sims => [0.6,0.72,0.8], :acts => [1,1,1], :neighbors => [1,1,1], :conf_stdev => true} |