Mercurial > hg > audiodb
changeset 286:fb8bec5c604e
generated points test, requires compile of audioDB with lshlib and -DQUERY_WITHOUT_NORM. Compares LSHLIB and EXACT retrieval of points on spherical shells at several radii
author | mas01mc |
---|---|
date | Tue, 15 Jul 2008 20:46:25 +0000 |
parents | 781b129925ff |
children | 8fcc7c590a0e |
files | tests/pointset_test/genpoints2.c tests/pointset_test/lshP2.m tests/pointset_test/run-test.sh |
diffstat | 3 files changed, 52 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/pointset_test/genpoints2.c Mon Jul 14 21:50:47 2008 +0000 +++ b/tests/pointset_test/genpoints2.c Tue Jul 15 20:46:25 2008 +0000 @@ -49,19 +49,18 @@ // Translate to (0,0,...,1) coords[dim-1]+=1.0; - // Recompute norm-squared + // Compute distance to (0,0,...,1) nmsq = 0.0; - for (j = 0; j < dim; j++){ + for (j = 0; j < dim-1; j++){ nmsq += coords[j]*coords[j]; } - // Save last value to distance calulcation to query(0,0,...,1) double nth = coords[dim-1]; // Output to ASCII terminal printf("("); for(j = 0; j < dim; j++) printf("%8.3f ", coords[j]); - printf(") d = %8.3f\n", sqrt(nmsq - nth*nth + (nth-1)*(nth-1))); + printf(") d = %8.3f\n", sqrt(nmsq + (nth-1)*(nth-1))); // Save single feature vector
--- a/tests/pointset_test/lshP2.m Mon Jul 14 21:50:47 2008 +0000 +++ b/tests/pointset_test/lshP2.m Tue Jul 15 20:46:25 2008 +0000 @@ -2,6 +2,6 @@ if nargin<2, c=1;end if nargin<1, w=4;end -P2 = 1 - 2*normal_cdf(-w/c) - 2/(sqrt(2*pi)*(w/c)) * ( 1-exp(-w^2/(2*c^2)) ); +P2 = 1 - 2*normcdf(-w/c) - 2/(sqrt(2*pi)*(w/c)) * ( 1-exp(-w^2/(2*c^2)) ); endfunction
--- a/tests/pointset_test/run-test.sh Mon Jul 14 21:50:47 2008 +0000 +++ b/tests/pointset_test/run-test.sh Tue Jul 15 20:46:25 2008 +0000 @@ -11,8 +11,19 @@ ${AUDIODB} -d testdb -P +NPOINTS=100 +NDIM=10 -for i in rad[0-9][0-9]/* +if [ -d rad[0-9]* ]; then rm -r rad[0-9]*; fi + +for j in 1 2 3 9 +do +mkdir -p "rad$j" +./genpoints2 ${NPOINTS} $(( j*j )) ${NDIM} +mv testfeature* "rad$j" +done + +for i in rad[0-9]/* do ${AUDIODB} -d testdb -I -f $i -w testpower done @@ -22,7 +33,41 @@ rm -f testdb.lsh.* -${AUDIODB} -d testdb -X -R 1 -l 1 --lsh_N 10000 --lsh_b 10000 --lsh_k 10 --lsh_m 5 --absolute-threshold -10 +LSH_K=10 +LSH_M=5 -${AUDIODB} -d testdb -Q sequence -R 1 -l 1 -f testfeature -w testpower --absolute-threshold -10 -e +INDEXING=true +if [ ${INDEXING} ] + then + for j in 1 2 3 9 + do + ${AUDIODB} -d testdb -X -R $(( j*j )) -l 1 --lsh_N 1000 \ + --lsh_b 1000 --lsh_k ${LSH_K} --lsh_m ${LSH_M} --absolute-threshold -1 + done +fi +for j in 1 2 3 9 +do +${AUDIODB} \ + -d testdb -Q sequence -R $(( j*j )) \ + -l 1 -f queryfeature -w testpower --absolute-threshold -1 -e -r 400 > output +echo APPRX points retrieved at Radius $j: \ +`egrep "^rad1" output | wc | awk '{print $1}'` \ +`egrep "^rad2" output | wc | awk '{print $1}'` \ +`egrep "^rad3" output | wc | awk '{print $1}'` \ +`egrep "^rad9" output | wc | awk '{print $1}'` +done + +rm -f *.lsh* +echo +for j in 1 2 3 9 +do +${AUDIODB} \ + -d testdb -Q sequence -R $(( j*j )) \ + -l 1 -f queryfeature -w testpower --absolute-threshold -1 -e -r 400 > output +echo EXACT points retrieved at Radius $j: \ +`egrep "^rad1" output | wc | awk '{print $1}'` \ +`egrep "^rad2" output | wc | awk '{print $1}'` \ +`egrep "^rad3" output | wc | awk '{print $1}'` \ +`egrep "^rad9" output | wc | awk '{print $1}'` +done