/** * Checks basic estimation of one attribute of the scheme, for simple * non-troublesome datasets. * * @param attrTypes the types the estimator can work with * @param classType the class type (NOMINAL, NUMERIC, etc.) * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable */ protected boolean[] canEstimate(AttrTypes attrTypes, boolean supervised, int classType) { // supervised is ignored, no supervised estimators used yet print("basic estimation"); printAttributeSummary(attrTypes, classType); print("..."); ArrayList<String> accepts = new ArrayList<String>(); accepts.add("nominal"); accepts.add("numeric"); accepts.add("string"); accepts.add("date"); accepts.add("relational"); accepts.add("not in classpath"); int numTrain = getNumInstances(), numTest = getNumInstances(), numClasses = 2, missingLevel = 0; boolean attributeMissing = false, classMissing = false; int numAtts = 1, attrIndex = 0; return runBasicTest(attrTypes, numAtts, attrIndex, classType, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks basic estimation of one attribute of the scheme, for simple * non-troublesome datasets. * * @param attrTypes the types the estimator can work with * @param classType the class type (NOMINAL, NUMERIC, etc.) * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable */ protected boolean[] canEstimate(AttrTypes attrTypes, boolean supervised, int classType) { // supervised is ignored, no supervised estimators used yet print("basic estimation"); printAttributeSummary(attrTypes, classType); print("..."); ArrayList<String> accepts = new ArrayList<String>(); accepts.add("nominal"); accepts.add("numeric"); accepts.add("string"); accepts.add("date"); accepts.add("relational"); accepts.add("not in classpath"); int numTrain = getNumInstances(), numTest = getNumInstances(), numClasses = 2, missingLevel = 0; boolean attributeMissing = false, classMissing = false; int numAtts = 1, attrIndex = 0; return runBasicTest(attrTypes, numAtts, attrIndex, classType, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks whether the scheme can handle zero training instances. * * @param attrTypes attribute types that can be estimated * @param classType the class type (NUMERIC, NOMINAL, etc.) * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable */ protected boolean[] canHandleZeroTraining(AttrTypes attrTypes, int classType) { print("handle zero training instances"); printAttributeSummary(attrTypes, classType); print("..."); ArrayList<String> accepts = new ArrayList<String>(); accepts.add("train"); accepts.add("value"); int numTrain = 0, numTest = getNumInstances(), numClasses = 2, missingLevel = 0; boolean attributeMissing = false, classMissing = false; int numAtts = 1; int attrIndex = 0; return runBasicTest(attrTypes, numAtts, attrIndex, classType, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks whether the scheme can handle zero training instances. * * @param attrTypes attribute types that can be estimated * @param classType the class type (NUMERIC, NOMINAL, etc.) * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable */ protected boolean[] canHandleZeroTraining(AttrTypes attrTypes, int classType) { print("handle zero training instances"); printAttributeSummary(attrTypes, classType); print("..."); ArrayList<String> accepts = new ArrayList<String>(); accepts.add("train"); accepts.add("value"); int numTrain = 0, numTest = getNumInstances(), numClasses = 2, missingLevel = 0; boolean attributeMissing = false, classMissing = false; int numAtts = 1; int attrIndex = 0; return runBasicTest(attrTypes, numAtts, attrIndex, classType, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks whether nominal schemes can handle more than two classes. If a * scheme is only designed for two-class problems it should throw an * appropriate exception for multi-class problems. * * @param attrTypes attribute types the estimator excepts * @param numClasses the number of classes to test * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable */ protected boolean[] canHandleNClasses(AttrTypes attrTypes, int numClasses) { print("more than two class problems"); printAttributeSummary(attrTypes, Attribute.NOMINAL); print("..."); ArrayList<String> accepts = new ArrayList<String>(); accepts.add("number"); accepts.add("class"); int numTrain = getNumInstances(), numTest = getNumInstances(), missingLevel = 0; boolean attributeMissing = false, classMissing = false; int numAttr = 1, attrIndex = 0; return runBasicTest(attrTypes, numAttr, attrIndex, Attribute.NOMINAL, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks whether nominal schemes can handle more than two classes. If a * scheme is only designed for two-class problems it should throw an * appropriate exception for multi-class problems. * * @param attrTypes attribute types the estimator excepts * @param numClasses the number of classes to test * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable */ protected boolean[] canHandleNClasses(AttrTypes attrTypes, int numClasses) { print("more than two class problems"); printAttributeSummary(attrTypes, Attribute.NOMINAL); print("..."); ArrayList<String> accepts = new ArrayList<String>(); accepts.add("number"); accepts.add("class"); int numTrain = getNumInstances(), numTest = getNumInstances(), missingLevel = 0; boolean attributeMissing = false, classMissing = false; int numAttr = 1, attrIndex = 0; return runBasicTest(attrTypes, numAttr, attrIndex, Attribute.NOMINAL, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks whether the scheme can handle class attributes as Nth attribute. * * @param attrTypes the attribute types the estimator accepts * @param numAtts of attributes * @param attrIndex the index of the attribute * @param classType the class type (NUMERIC, NOMINAL, etc.) * @param classIndex the index of the class attribute (0-based, -1 means last * attribute) * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable * @see TestInstances#CLASS_IS_LAST */ protected boolean[] canHandleClassAsNthAttribute(AttrTypes attrTypes, int numAtts, int attrIndex, int classType, int classIndex) { if (classIndex == TestInstances.CLASS_IS_LAST) { print("class attribute as last attribute"); } else { print("class attribute as " + (classIndex + 1) + ". attribute"); } printAttributeSummary(attrTypes, classType); print("..."); ArrayList<String> accepts = new ArrayList<String>(); int numTrain = getNumInstances(), numTest = getNumInstances(), numClasses = 2, missingLevel = 0; boolean attributeMissing = false, classMissing = false; return runBasicTest(attrTypes, numAtts, attrIndex, classType, classIndex, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
/** * Checks whether the scheme can handle class attributes as Nth attribute. * * @param attrTypes the attribute types the estimator accepts * @param numAtts of attributes * @param attrIndex the index of the attribute * @param classType the class type (NUMERIC, NOMINAL, etc.) * @param classIndex the index of the class attribute (0-based, -1 means last * attribute) * @return index 0 is true if the test was passed, index 1 is true if test was * acceptable * @see TestInstances#CLASS_IS_LAST */ protected boolean[] canHandleClassAsNthAttribute(AttrTypes attrTypes, int numAtts, int attrIndex, int classType, int classIndex) { if (classIndex == TestInstances.CLASS_IS_LAST) { print("class attribute as last attribute"); } else { print("class attribute as " + (classIndex + 1) + ". attribute"); } printAttributeSummary(attrTypes, classType); print("..."); ArrayList<String> accepts = new ArrayList<String>(); int numTrain = getNumInstances(), numTest = getNumInstances(), numClasses = 2, missingLevel = 0; boolean attributeMissing = false, classMissing = false; return runBasicTest(attrTypes, numAtts, attrIndex, classType, classIndex, missingLevel, attributeMissing, classMissing, numTrain, numTest, numClasses, accepts); }
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrType, Attribute.NOMINAL); print("...");
printAttributeSummary(attrType, Attribute.NOMINAL); print("...");
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrTypes, classType); print("..."); int numTrain = getNumInstances();
printAttributeSummary(attrTypes, classType); print("..."); int numTrain = getNumInstances();
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrTypes, classType);
printAttributeSummary(attrTypes, classType);