/** * Checks whether the scheme handles multi-instance data. * * @return true if the clusterer handles multi-instance data */ protected boolean[] multiInstanceHandler() { boolean[] result = new boolean[2]; print("multi-instance clusterer..."); if (m_Clusterer instanceof MultiInstanceCapabilitiesHandler) { println("yes"); result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Checks whether the scheme can build models incrementally. * * @return index 0 is true if the clusterer can train incrementally */ protected boolean[] updateableClusterer() { boolean[] result = new boolean[2]; print("updateable clusterer..."); if (m_Clusterer instanceof UpdateableClusterer) { println("yes"); result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Checks whether the scheme says it can handle instance weights. * * @return true if the clusterer handles instance weights */ protected boolean[] weightedInstancesHandler() { boolean[] result = new boolean[2]; print("weighted instances clusterer..."); if (m_Clusterer instanceof WeightedInstancesHandler) { println("yes"); result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Checks whether the scheme can build models incrementally. * * @return index 0 is true if the clusterer can train incrementally */ protected boolean[] updateableClusterer() { boolean[] result = new boolean[2]; print("updateable clusterer..."); if (m_Clusterer instanceof UpdateableClusterer) { println("yes"); result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Checks whether the scheme says it can handle instance weights. * * @return true if the clusterer handles instance weights */ protected boolean[] weightedInstancesHandler() { boolean[] result = new boolean[2]; print("weighted instances clusterer..."); if (m_Clusterer instanceof WeightedInstancesHandler) { println("yes"); result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Checks whether the scheme handles multi-instance data. * * @return true if the clusterer handles multi-instance data */ protected boolean[] multiInstanceHandler() { boolean[] result = new boolean[2]; print("multi-instance clusterer..."); if (m_Clusterer instanceof MultiInstanceCapabilitiesHandler) { println("yes"); result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * tests for a serialVersionUID. Fails in case the scheme doesn't declare a * UID. * * @return index 0 is true if the scheme declares a UID */ protected boolean[] declaresSerialVersionUID() { boolean[] result = new boolean[2]; print("serialVersionUID..."); result[0] = !SerializationHelper.needsUID(m_Clusterer.getClass()); if (result[0]) { println("yes"); } else { println("no"); } return result; }
/** * tests for a serialVersionUID. Fails in case the scheme doesn't declare a * UID. * * @return index 0 is true if the scheme declares a UID */ protected boolean[] declaresSerialVersionUID() { boolean[] result = new boolean[2]; print("serialVersionUID..."); result[0] = !SerializationHelper.needsUID(m_Clusterer.getClass()); if (result[0]) { println("yes"); } else { println("no"); } return result; }
/** * Checks whether the scheme can take command line options. * * @return index 0 is true if the clusterer can take options */ protected boolean[] canTakeOptions() { boolean[] result = new boolean[2]; print("options..."); if (m_Clusterer instanceof OptionHandler) { println("yes"); if (m_Debug) { println("\n=== Full report ==="); Enumeration<Option> enu = ((OptionHandler) m_Clusterer).listOptions(); while (enu.hasMoreElements()) { Option option = enu.nextElement(); print(option.synopsis() + "\n" + option.description() + "\n"); } println("\n"); } result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Checks whether the scheme can take command line options. * * @return index 0 is true if the clusterer can take options */ protected boolean[] canTakeOptions() { boolean[] result = new boolean[2]; print("options..."); if (m_Clusterer instanceof OptionHandler) { println("yes"); if (m_Debug) { println("\n=== Full report ==="); Enumeration<Option> enu = ((OptionHandler) m_Clusterer).listOptions(); while (enu.hasMoreElements()) { Option option = enu.nextElement(); print(option.synopsis() + "\n" + option.description() + "\n"); } println("\n"); } result[0] = true; } else { println("no"); result[0] = false; } return result; }
/** * Begin the tests, reporting results to System.out */ @Override public void doTests() { if (getClusterer() == null) { println("\n=== No clusterer set ==="); return; } println("\n=== Check on Clusterer: " + getClusterer().getClass().getName() + " ===\n"); // Start tests println("--> Checking for interfaces"); canTakeOptions(); boolean updateable = updateableClusterer()[0]; boolean weightedInstancesHandler = weightedInstancesHandler()[0]; boolean multiInstanceHandler = multiInstanceHandler()[0]; println("--> Clusterer tests"); declaresSerialVersionUID(); runTests(weightedInstancesHandler, multiInstanceHandler, updateable); }
/** * Begin the tests, reporting results to System.out */ @Override public void doTests() { if (getClusterer() == null) { println("\n=== No clusterer set ==="); return; } println("\n=== Check on Clusterer: " + getClusterer().getClass().getName() + " ===\n"); // Start tests println("--> Checking for interfaces"); canTakeOptions(); boolean updateable = updateableClusterer()[0]; boolean weightedInstancesHandler = weightedInstancesHandler()[0]; boolean multiInstanceHandler = multiInstanceHandler()[0]; println("--> Clusterer tests"); declaresSerialVersionUID(); runTests(weightedInstancesHandler, multiInstanceHandler, updateable); }
println("yes"); result[0] = true; } catch (Exception ex) { println("no" + (acceptable ? " (OK error message)" : "")); result[1] = acceptable; println("\n=== Full Report ==="); print("Problem during training"); println(": " + ex.getMessage() + "\n"); if (!acceptable) { if (accepts.size() > 0) { println("here is the dataset:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n");
println("yes"); result[0] = true; } catch (Exception ex) { println("no" + (acceptable ? " (OK error message)" : "")); result[1] = acceptable; println("\n=== Full Report ==="); print("Problem during training"); println(": " + ex.getMessage() + "\n"); if (!acceptable) { if (accepts.size() > 0) { println("here is the dataset:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n");
compareDatasets(train, trainCopy); println("yes"); result[0] = true; } catch (Exception ex) { println("no"); result[0] = false; println("\n=== Full Report ==="); print("Problem during training"); println(": " + ex.getMessage() + "\n"); println("Here is the dataset:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n");
compareDatasets(train, trainCopy); println("yes"); result[0] = true; } catch (Exception ex) { println("no"); result[0] = false; println("\n=== Full Report ==="); print("Problem during training"); println(": " + ex.getMessage() + "\n"); println("Here is the dataset:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n");
evaluationI.evaluateClusterer(train); if (!evaluationB.equals(evaluationI)) { println("no"); result[0] = false; println("\n=== Full Report ==="); println("Results differ between batch and " + "incrementally built models.\n" + "Depending on the classifier, this may be OK"); println("Here are the results:\n"); println("\nbatch built results\n" + evaluationB.clusterResultsToString()); println("\nincrementally built results\n" + evaluationI.clusterResultsToString()); println("Here are the datasets:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n"); println("yes"); result[0] = true; print(" training"); println(": " + ex.getMessage() + "\n");
println("yes"); result[0] = true; } catch (Exception ex) { println("no"); result[0] = false; println("\n=== Full Report ==="); println("Results don't differ between non-weighted and " + "weighted instance models."); println("Here are the results:\n"); println("\nboth methods\n"); println(evaluationB.clusterResultsToString()); } else { print("Problem during"); print(" training"); println(": " + ex.getMessage() + "\n"); println("Here is the dataset:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n"); println("=== Train Weights ===\n"); for (int i = 0; i < train.numInstances(); i++) { println(" " + (i + 1) + " " + train.instance(i).weight());
evaluationI.evaluateClusterer(train); if (!evaluationB.equals(evaluationI)) { println("no"); result[0] = false; println("\n=== Full Report ==="); println("Results differ between batch and " + "incrementally built models.\n" + "Depending on the classifier, this may be OK"); println("Here are the results:\n"); println("\nbatch built results\n" + evaluationB.clusterResultsToString()); println("\nincrementally built results\n" + evaluationI.clusterResultsToString()); println("Here are the datasets:\n"); println("=== Train Dataset ===\n" + train.toString() + "\n"); println("yes"); result[0] = true; print(" training"); println(": " + ex.getMessage() + "\n");
if (!evaluation1A.equals(evaluation1B)) { if (m_Debug) { println("\n=== Full report ===\n"); println("First buildClusterer()"); println(evaluation1A.clusterResultsToString() + "\n\n"); println("Second buildClusterer()"); println(evaluation1B.clusterResultsToString() + "\n\n"); println("yes"); result[0] = true; println("no"); result[0] = false; if (m_Debug) { println("\n=== Full Report ==="); print("Problem during"); if (built) { break; println(": " + ex.getMessage() + "\n"); println("here are the datasets:\n"); println("=== Train1 Dataset ===\n" + train1.toString() + "\n"); println("=== Train2 Dataset ===\n" + train2.toString() + "\n");