public void textValueChanged(TextEvent e) { ((TextListener) a).textValueChanged(e); ((TextListener) b).textValueChanged(e); }
@Override protected void notifyJobOutputListeners() { weka.classifiers.Classifier finalClassifier = ((weka.distributed.spark.WekaClassifierSparkJob) m_runningJob).getClassifier(); Instances modelHeader = ((weka.distributed.spark.WekaClassifierSparkJob) m_runningJob).getTrainingHeader(); String classAtt = ((weka.distributed.spark.WekaClassifierSparkJob) m_runningJob).getClassAttribute(); try { weka.distributed.spark.WekaClassifierSparkJob.setClassIndex(classAtt, modelHeader, true); } catch (Exception ex) { if (m_log != null) { m_log.logMessage(statusMessagePrefix() + ex.getMessage()); } ex.printStackTrace(); } if (finalClassifier == null) { if (m_log != null) { m_log.logMessage(statusMessagePrefix() + "No classifier produced!"); } } if (modelHeader == null) { if (m_log != null) { m_log.logMessage(statusMessagePrefix() + "No training header available for the model!"); } } if (finalClassifier != null) { if (m_textListeners.size() > 0) { String textual = finalClassifier.toString(); String title = "Spark: "; String classifierSpec = finalClassifier.getClass().getName(); if (finalClassifier instanceof OptionHandler) { classifierSpec += " " + Utils.joinOptions(((OptionHandler) finalClassifier).getOptions()); } title += classifierSpec; TextEvent te = new TextEvent(this, textual, title); for (TextListener t : m_textListeners) { t.acceptText(te); } } if (modelHeader != null) { // have to add a single bogus instance to the header to trick // the SerializedModelSaver into saving it (since it ignores // structure only DataSetEvents) :-) double[] vals = new double[modelHeader.numAttributes()]; for (int i = 0; i < vals.length; i++) { vals[i] = Utils.missingValue(); } Instance tempI = new DenseInstance(1.0, vals); modelHeader.add(tempI); DataSetEvent dse = new DataSetEvent(this, modelHeader); BatchClassifierEvent be = new BatchClassifierEvent(this, finalClassifier, dse, dse, 1, 1); for (BatchClassifierListener b : m_classifierListeners) { b.acceptClassifier(be); } } } }