Menu

JUnit test failures

Developers
2006-12-15
2013-04-25
  • Tim LeMaster

    Tim LeMaster - 2006-12-15

    I downloaded the Java source for SimMetrics after reading the Help Wanted post for a Mahalanobis Distance algorithm. I looked at the EuclideanDistance.java file for a start. I ran the JUnit test and it failed output was

    junit.framework.AssertionFailedError: expected:<0.29289323> but was:<0.5>
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.failNotEquals(Assert.java:277)
        at junit.framework.Assert.assertEquals(Assert.java:64)
        at junit.framework.Assert.assertEquals(Assert.java:71)
        at uk.ac.shef.wit.simmetrics.similaritymetrics.EuclideanDistanceTest.testGetSimilarity(EuclideanDistanceTest.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    I'm kinda of baffled about what the Euclidean Distance between two string is supposed to represent. Any pointers?

     
    • ReverendSam

      ReverendSam - 2006-12-15

      Thanks for this it slipped through somehow... the error is in the junit test not the underlying class, this is now corrected in CVS, it will be a while with xmas before i have time to put a new release our to fix it in the file downloads.

      Euclidean distance - is a very high dimensional vector space, each term being a dimension, see http://www.dcs.shef.ac.uk/~sam/stringmetrics.html#dist for more details or http://en.wikipedia.org/wiki/Euclidean_distance just the n-space is with dimensions equal to unique terms. It would be good if you do get time to look at the Mahalanobis Distance, let me know if you need anything regarding this.

       

Log in to post a comment.