m_Search = getSearch(); m_Evaluator = getEvaluator(); m_Tester = getTester(); m_OptionTester = getOptionTester(); m_GOETester = getGOETester(); checkAttributes(true, false, false, false, false, false); checkAttributes(false, true, false, false, false, false); checkAttributes(false, false, true, false, false, false); checkAttributes(false, false, false, true, false, false); checkAttributes(false, false, false, false, true, false); if (!canPredict(i)) continue; m_handleMissingPredictors[i] = checkMissingPredictors(i, 20, false); m_handleMissingClass[i] = checkMissingClass(i, 20, false);
/** * Tests whether the scheme can handle class attributes as Nth * attribute. In case of multi-instance handler it performs no tests, * since the multi-instance data has a fixed format (bagID,bag,class). * * @see CheckAttributeSelection#canHandleClassAsNthAttribute(boolean, boolean, boolean, boolean, boolean, boolean, int, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testClassAsNthAttribute() { int i; // multi-Instance data has fixed format! if (m_multiInstanceHandler) return; for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; // first attribute m_handleClassAsFirstAttribute[i] = checkClassAsNthAttribute(i, 0); // second attribute m_handleClassAsSecondAttribute[i] = checkClassAsNthAttribute(i, 1); } }
/** * tests whether the scheme correctly initializes in the * search method * * @see CheckAttributeSelection#correctSearchInitialisation(boolean, boolean, boolean, boolean, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testBuildInitialization() { boolean[] result; int i; for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; result = m_Tester.correctSearchInitialisation( m_NominalPredictors[i], m_NumericPredictors[i], m_StringPredictors[i], m_DatePredictors[i], m_RelationalPredictors[i], m_multiInstanceHandler, i); if (!result[0] && !result[1]) fail("Incorrect build initialization (" + getClassTypeString(i) + " class)!"); } }
/** * tests whether the scheme can handle missing predictors (20% and 100%) * * @see CheckAttributeSelection#canHandleMissing(boolean, boolean, boolean, boolean, boolean, boolean, int, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testMissingPredictors() { int i; for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; // 20% missing checkMissingPredictors(i, 20, true); // 100% missing if (m_handleMissingPredictors[i]) checkMissingPredictors(i, 100, true); } }
/** * tests whether the scheme can handle missing class values (20% and * 100%) * * @see CheckAttributeSelection#canHandleMissing(boolean, boolean, boolean, boolean, boolean, boolean, int, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testMissingClass() { int i; for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; // 20% missing checkMissingClass(i, 20, true); // 100% missing if (m_handleMissingClass[i]) checkMissingClass(i, 100, true); } }
fail("Error handling " + percent + "% missing class labels (" + getClassTypeString(type) + " class)!");
/** * tests whether the scheme declares a serialVersionUID. */ public void testSerialVersionUID() { boolean[] result; result = m_Tester.declaresSerialVersionUID(); if (!result[0]) fail("Doesn't declare serialVersionUID!"); }
if (!canPredict(i)) continue; m_RegressionResults[i] = useScheme(train); succeeded = true; reg.println(m_RegressionResults[i]); fail("Problem during regression testing: no successful predictions for any class type"); System.err.println("Warning: No reference available, creating."); } else if (!diff.equals("")) { fail("Regression test failed. Difference:\n" + diff); fail("Problem during regression testing.\n" + ex);
/** * tests whether scheme handles N classes * * @see CheckAttributeSelection#canHandleNClasses(boolean, boolean, boolean, boolean, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) * @see #m_NClasses */ public void testNClasses() { boolean[] result; if (!canPredict(Attribute.NOMINAL)) return; result = m_Tester.canHandleNClasses( m_NominalPredictors[Attribute.NOMINAL], m_NumericPredictors[Attribute.NOMINAL], m_StringPredictors[Attribute.NOMINAL], m_DatePredictors[Attribute.NOMINAL], m_RelationalPredictors[Attribute.NOMINAL], m_multiInstanceHandler, m_NClasses); if (!result[0] && !result[1]) fail("Error handling " + m_NClasses + " classes!"); }
/** * tests whether the scheme handles instance weights correctly * * @see CheckAttributeSelection#instanceWeights(boolean, boolean, boolean, boolean, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testInstanceWeights() { boolean[] result; int i; if (m_weightedInstancesHandler) { for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; result = m_Tester.instanceWeights( m_NominalPredictors[i], m_NumericPredictors[i], m_StringPredictors[i], m_DatePredictors[i], m_RelationalPredictors[i], m_multiInstanceHandler, i); if (!result[0]) System.err.println("Error handling instance weights (" + getClassTypeString(i) + " class)!"); } } }
/** * Configures the CheckGOE used for testing GOE stuff. * * @return the fully configured CheckGOE */ protected CheckGOE getGOETester() { CheckGOE result; result = super.getGOETester(); result.setObject(getEvaluator()); return result; } }
/** * Configures the CheckOptionHandler uses for testing the optionhandling. * Sets the scheme to test. * * @return the fully configured CheckOptionHandler */ protected CheckOptionHandler getOptionTester() { CheckOptionHandler result; result = super.getOptionTester(); if (getEvaluator() instanceof OptionHandler) result.setOptionHandler((OptionHandler) getEvaluator()); return result; }
/** * tests whether the scheme can handle different types of attributes and * if not, if the exception is OK * * @see #checkAttributes(boolean, boolean, boolean, boolean, boolean, boolean) */ public void testAttributes() { // nominal checkAttributes(true, false, false, false, false, true); // numeric checkAttributes(false, true, false, false, false, true); // string checkAttributes(false, false, true, false, false, true); // date checkAttributes(false, false, false, true, false, true); // relational if (!m_multiInstanceHandler) checkAttributes(false, false, false, false, true, true); }
fail("Error handling class as " + indexStr + " attribute (" + getClassTypeString(type) + " class)!");
/** * tests for a globalInfo method */ public void testGlobalInfo() { if (!m_GOETester.checkGlobalInfo()) fail("No globalInfo method"); }
if (!canPredict(i)) continue; m_RegressionResults[i] = useScheme(train); succeeded = true; reg.println(m_RegressionResults[i]); fail("Problem during regression testing: no successful predictions for any class type"); System.err.println("Warning: No reference available, creating."); } else if (!diff.equals("")) { fail("Regression test failed. Difference:\n" + diff); fail("Problem during regression testing.\n" + ex);
/** * tests whether the scheme can handle missing predictors (20% and 100%) * * @see CheckAttributeSelection#canHandleMissing(boolean, boolean, boolean, boolean, boolean, boolean, int, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testMissingPredictors() { int i; for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; // 20% missing checkMissingPredictors(i, 20, true); // 100% missing if (m_handleMissingPredictors[i]) checkMissingPredictors(i, 100, true); } }
/** * tests whether the scheme can handle missing class values (20% and * 100%) * * @see CheckAttributeSelection#canHandleMissing(boolean, boolean, boolean, boolean, boolean, boolean, int, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testMissingClass() { int i; for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; // 20% missing checkMissingClass(i, 20, true); // 100% missing if (m_handleMissingClass[i]) checkMissingClass(i, 100, true); } }
/** * tests whether scheme handles N classes * * @see CheckAttributeSelection#canHandleNClasses(boolean, boolean, boolean, boolean, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) * @see #m_NClasses */ public void testNClasses() { boolean[] result; if (!canPredict(Attribute.NOMINAL)) return; result = m_Tester.canHandleNClasses( m_NominalPredictors[Attribute.NOMINAL], m_NumericPredictors[Attribute.NOMINAL], m_StringPredictors[Attribute.NOMINAL], m_DatePredictors[Attribute.NOMINAL], m_RelationalPredictors[Attribute.NOMINAL], m_multiInstanceHandler, m_NClasses); if (!result[0] && !result[1]) fail("Error handling " + m_NClasses + " classes!"); }
/** * tests whether the scheme handles instance weights correctly * * @see CheckAttributeSelection#instanceWeights(boolean, boolean, boolean, boolean, boolean, boolean, int) * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) */ public void testInstanceWeights() { boolean[] result; int i; if (m_weightedInstancesHandler) { for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) { // does the scheme support this type of class at all? if (!canPredict(i)) continue; result = m_Tester.instanceWeights( m_NominalPredictors[i], m_NumericPredictors[i], m_StringPredictors[i], m_DatePredictors[i], m_RelationalPredictors[i], m_multiInstanceHandler, i); if (!result[0]) System.err.println("Error handling instance weights (" + getClassTypeString(i) + " class)!"); } } }