math.similarity: fix tests, not sure this is the correct definition.

db4
John Benediktsson 2012-05-08 08:05:31 -07:00
parent b7ae7171f1
commit bab0f663ae
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ IN: math.similarity
v- norm 1 + recip ; v- norm 1 + recip ;
: pearson-similarity ( a b -- n ) : pearson-similarity ( a b -- n )
over length 3 < [ 2drop 1.0 ] [ corr 0.5 * 0.5 + ] if ; over length 3 < [ 2drop 1.0 ] [ full-corr 0.5 * 0.5 + ] if ;
: cosine-similarity ( a b -- n ) : cosine-similarity ( a b -- n )
[ v* sum ] [ [ norm ] bi@ * ] 2bi / 0.5 * 0.5 + ; [ v* sum ] [ [ norm ] bi@ * ] 2bi / 0.5 * 0.5 + ;