|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
edu.umass.cs.mallet.base.maximize.tests.TestMaximizable
Contains static methods for testing subclasses of Maximizable and Maximizable.ByGradient. Especially useful are methods that verify the consistency of the value and gradient functions of an instance of Maximizable.ByGradient.
| Constructor Summary | |
TestMaximizable(java.lang.String name)
|
|
| Method Summary | |
static void |
main(java.lang.String[] args)
|
static void |
setNumComponents(int n)
Sets the number of gradient components that will be checked. |
protected void |
setUp()
|
static junit.framework.Test |
suite()
|
static boolean |
testGetSetParameters(Maximizable maxable)
Tests that parameters set by setParameters can be retrieved by getParameters. |
void |
testTestValueAndGradient()
|
static boolean |
testValueAndGradient(Maximizable.ByGradient maxable)
Tests that getValue and getValueGradient are consistent. |
static double |
testValueAndGradientCurrentParameters(Maximizable.ByGradient maxable)
Tests that the value and gradient function are consistent at the current parameters. |
static double |
testValueAndGradientInDirection(Maximizable.ByGradient maxable,
double[] direction)
|
static boolean |
testValueAndGradientRandomParameters(Maximizable.ByGradient maxable,
java.util.Random r)
Tests that getValue and getValueGradient are consistent at a random parameter setting. |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TestMaximizable(java.lang.String name)
| Method Detail |
public static void setNumComponents(int n)
public static boolean testGetSetParameters(Maximizable maxable)
maxable - Instance of a Maximizable that should be tested.
Its current parameters will be overwritten.
public static double testValueAndGradientInDirection(Maximizable.ByGradient maxable,
double[] direction)
public static double testValueAndGradientCurrentParameters(Maximizable.ByGradient maxable)
java.lang.IllegalStateException - If the angle is above the tolerancetestValueAndGradient,
testValueAndGradientRandomParameterspublic static boolean testValueAndGradient(Maximizable.ByGradient maxable)
java.lang.IllegalStateException - If the test fails.testValueAndGradientCurrentParameters
public static boolean testValueAndGradientRandomParameters(Maximizable.ByGradient maxable,
java.util.Random r)
java.lang.IllegalStateException - If the test fails.testValueAndGradientCurrentParameterspublic void testTestValueAndGradient()
public static junit.framework.Test suite()
protected void setUp()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||