diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-11-11 15:07:19 +0100 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-11-11 15:07:19 +0100 |
commit | 894f4d1cd146d37587040268550a481d5dea59b0 (patch) | |
tree | 3cd4e0a5514df435d1db5ae327c8738c39919387 /algorithm.rb | |
parent | 6a123c29067bd741ac6bac87a2154ac888b6f677 (diff) |
Added Test for mlr
Diffstat (limited to 'algorithm.rb')
-rw-r--r-- | algorithm.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/algorithm.rb b/algorithm.rb index 6cecfca..0e4ba50 100644 --- a/algorithm.rb +++ b/algorithm.rb @@ -76,6 +76,37 @@ class AlgorithmTest < Test::Unit::TestCase assert_in_delta OpenTox::Algorithm::Similarity.tanimoto(features_a, features_c, weights, params), 0.235749338271022, 0.000001 } end + + def test_mlr + n_prop = [ [ -2.0, -2.0 ], + [ -1.0, -1.0 ], + [ 0.0, 0.0 ], + [ 1.0, 1.0 ], + [ 2.0, 2.0 ] ] + + q_prop = [ 1.0, 1.0 ] + + #acts = [ -2.0, + # -1.0, + # 0.0, + # 1.0, + # 2.0 ] + + acts = [ 0.0, + 0.5, + 1.0, + 1.5, + 2.0 ] + + maxcols = 2 + res1 = OpenTox::Algorithm::Neighbors::mlr(:n_prop => n_prop, :q_prop => q_prop, :acts => acts, :maxcols => maxcols) + maxcols = 1 + res2 = OpenTox::Algorithm::Neighbors::mlr(:n_prop => n_prop, :q_prop => q_prop, :acts => acts, :maxcols => maxcols) + assert_in_delta res1, 1.4958008960423, 10E-06 + assert_equal res1, res2 + end + + =begin def test_clustering # Parameters |