org.aisb.bio.tests
Class TestB4

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.aisb.bio.tests.TestB4
All Implemented Interfaces:
junit.framework.Test

public class TestB4
extends junit.framework.TestCase

This is the testing framework for assignment B4, the image classification assignment.

Author:
Doug DeJulio

Constructor Summary
TestB4()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 void testCanExtractFeatures()
           Test to see if we can extract features from a known image.
 void testCanReadAnImage()
          Test to see if we can read a single image shipped with the application in a known location.
 void testEuclideanMeanClassifierWithFourDimensions()
           Test our Euclidean mean classifier with four-dimensional data.
 void testEuclideanMeanClassifierWithOneDimension()
          Test our Euclidean mean classifier with one-dimensional data.
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestB4

public TestB4()
Method Detail

testCanReadAnImage

public void testCanReadAnImage()
                        throws java.lang.Exception
Test to see if we can read a single image shipped with the application in a known location.

Throws:
java.lang.Exception - Any exception thrown by the underlying frameworks.

testCanExtractFeatures

public void testCanExtractFeatures()
                            throws java.lang.Exception

Test to see if we can extract features from a known image.

Note that I haven't done the corresponding calculations by hand without a computer, as the underlying math is a bit much for that. So we're really only testing whether the feature getter is honoring the contract it has with the other routines. More data about what's going on can be obtained by looking at the assignment of the "features" array under a debugger.

Throws:
java.lang.Exception - Any excpetion thrown by the underlying frameworks.

testEuclideanMeanClassifierWithOneDimension

public void testEuclideanMeanClassifierWithOneDimension()

Test our Euclidean mean classifier with one-dimensional data.

This is a trivial test. Generate a bunch of random floating point values between 10 and 11, and train them with the label "positive". Then, generate a bunch of values between -10 and -11, and train them with the label "negative". Then, generate a bunch of values between 5 and 6, and classify them. The answer had better be "positive". Then do the same for values between -5 and -6. The answer had better be "negative".


testEuclideanMeanClassifierWithFourDimensions

public void testEuclideanMeanClassifierWithFourDimensions()

Test our Euclidean mean classifier with four-dimensional data.

This is precisely like the one-dimensional test, except that the training and testing data is four-dimensional. Each dimension is in the same range. So, our training data is going to be inside a pair of little tiny hypercubes, and our testing data is going to be inside another pair of little tiny hypercubes.

Coupled with the one-dimensional test, this verifies that our classifier does not care about the dimensionality of the data being fed to it. All the data has to be of the same dimensionality, but we don't care if it's one-dimensional or nintey-three dimensional. The pair of tests taken together should confirm that.


main

public static void main(java.lang.String[] args)