UpdateModel & ClassifyInstance
{"Image DocumentName": "UpdateModel & ClassifyInstance", "Image ImageDescription": "public void classifyMessage(String message) throws Exception { // Check if classifier has been built. if (m_Data.numInstances() == 0) { throw new Exception( No classifier available. ); } // Convert message string into instance. Instance instance = makeInstance(cleanupString(message)); // Filter instance. m_Filter.input(instance); Instance filteredInstance = m_Filter.output(); // Get index of predicted class value. double predicted = m_Classifier.classifyInstance(filteredInstance); // Classify instance. System.err.println( Message classified as : + m_Data.classAttribute().value((int)predicted)); public void updateModel(String message, String classValue) throws Exception { // Convert message string into instance. Instance instance = makeInstance(cleanupString(message)); // Add class value to instance. instance.setClassValue(classValue); // Add instance to training data. m_Data.add(instance); // Use filter. m_Filter.setInputFormat(m_Data); Instances filteredData = Filter.useFilter(m_Data, m_Filter); // Rebuild classifier. m_Classifier.buildClassifier(filteredData); }", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}