diff options
author | Andreas Maunz <andreas@maunz.de> | 2012-02-09 15:44:28 +0100 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2012-02-09 15:44:28 +0100 |
commit | 7a37114695d783a770cdca854df36cc4ee347758 (patch) | |
tree | 7c00197151b077646f9cb3c4e3406d0e6fd58781 /algorithm.rb | |
parent | 1a0957e830030b9c376eb298f9e8a837249d3296 (diff) | |
parent | 82f8512dc5e2de822433e2dcec3b579962e6ae2a (diff) |
Merge branch 'pc_new_1' into development
Conflicts:
algorithm.rb
dataset.rb
lazar.rb
Diffstat (limited to 'algorithm.rb')
-rw-r--r-- | algorithm.rb | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/algorithm.rb b/algorithm.rb index ceee1fa..6c6ba73 100644 --- a/algorithm.rb +++ b/algorithm.rb @@ -24,57 +24,6 @@ class AlgorithmTest < Test::Unit::TestCase end end - def test_p_sum_support - params = {} - params[:compound_features_hits] = { "c:c" => 10, "c:c:c" => 5, "O:N" => 2} - params[:training_compound] = "http://localhost/compound/InChI=1S/CH2O/c1-2/h1H2" - params[:training_compound_features_hits] = {"c:c" => 6, "c:c:c" => 3, "O:O" => 2} - params[:weights] = { "c:c" => 0.95, "c:c:c" => 0.96, "O:N" => 0.97, "O:O" => 0.98} - params[:features] = (params[:compound_features_hits].keys + params[:training_compound_features_hits].keys).uniq - 2.times{ - params[:mode] = "min" - assert_in_delta OpenTox::Algorithm.p_sum_support(params), 12.48, 0.001 - params[:mode] = "max" - assert_in_delta OpenTox::Algorithm.p_sum_support(params), 18,2, 0.001 - } - end - - def test_tanimoto - params = {} - params[:training_compound] = "http://localhost/compound/InChI=1S/CH2O/c1-2/h1H2" - weights = { "c:c" => 0.9, "c:c:c" => 0.96, "O:N" => 0.97, "O:O" => 0.98} - params[:compound_features_hits] = { "c:c" => 10, "c:c:c" => 5, "O:N" => 2} - features_a = params[:compound_features_hits].keys - params[:training_compound_features_hits] = {"c:c" => 6, "c:c:c" => 3, "O:O" => 2} - features_b = params[:training_compound_features_hits].keys - 2.times{ - params[:nr_hits] = false - #test without weights - assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_b, nil, params), 0.5, 0.0001 - - #test with weights - assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_b, weights, params), 0.488188976377953, 0.0001 - - #test with weights and nr_hits true - params[:nr_hits] = true - assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_b, weights, params), 0.467796610169492, 0.0001 - } - - params[:training_compound_features_hits] = {"c:c" => 2, "O:N" => 2} - features_c = params[:training_compound_features_hits].keys - - 2.times{ - params[:nr_hits] = false - #test without weights - assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_c, nil, params), 0.666666666666667, 0.0001 - #test with weights - assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_c, weights, params), 0.660777385159011, 0.0001 - - #test with weights and nr_hits true - params[:nr_hits] = true - assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_c, weights, params), 0.237611181702668, 0.0001 - } - end =begin def test_clustering # Parameters |