#NEWLINE# def test_tanimoto_distances( ) : #NEWLINE# #INDENT# ' Check that the pairwise Tanimoto distances computation' #NEWLINE# X = [ [ 'a' , 'b' , 'c' ] ] #NEWLINE# D = tanimoto_coefficient ( X , X ) #NEWLINE# assert_array_almost_equal ( D , [ [ 1.0 ] ] ) #NEWLINE# X = [ [ 'a' , 'b' , 'c' ] ] #NEWLINE# Y = [ [ ] ] #NEWLINE# D = tanimoto_coefficient ( X , Y ) #NEWLINE# assert_array_almost_equal ( D , [ [ 0.0 ] ] ) #NEWLINE# X = [ [ 1 , 2 , 3 , 4 ] ] #NEWLINE# Y = [ [ 2 , 3 ] ] #NEWLINE# D = tanimoto_coefficient ( X , Y ) #NEWLINE# assert_array_almost_equal ( D , [ [ 0.5 ] ] ) #NEWLINE# X = [ [ 'a' , 'b' , 'c' , 'd' ] , [ 'e' , 'f' , 'g' ] ] #NEWLINE# Y = [ [ 'a' , 'b' , 'c' , 'k' ] ] #NEWLINE# D = tanimoto_coefficient ( X , Y ) #NEWLINE# assert_array_almost_equal ( D , [ [ 0.6 ] , [ 0.0 ] ] ) #NEWLINE# X = [ [ 'a' , 'b' , 'c' , 'd' ] , [ 'e' , 'f' , 'g' ] ] #NEWLINE# Y = [ [ 'a' , 'b' , 'c' , 'd' ] , [ 'e' , 'f' , 'g' ] ] #NEWLINE# D = tanimoto_coefficient ( X , Y ) #NEWLINE# assert_array_almost_equal ( D , [ [ 1.0 , 0.0 ] , [ 0.0 , 1.0 ] ] ) #NEWLINE# X = [ [ 0 , 1 ] , [ 1 , 1 ] ] #NEWLINE# D = tanimoto_coefficient ( X , X ) #NEWLINE# assert_array_almost_equal ( D , [ [ 1.0 , 0.33333333 ] , [ 0.33333333 , 0.33333333 ] ] ) #NEWLINE# X = [ [ 0 , 1 ] , [ 1 , 1 ] ] #NEWLINE# Y = [ [ 0 , 0 ] ] #NEWLINE# D = tanimoto_coefficient ( D , Y ) #NEWLINE# assert_array_almost_equal ( D , [ [ 0.3333333 ] , [ 0.0 ] ] )