@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); for (int j = 0; j < L; j++) { if(x.value(j) > 0.0) { Instance x_j = convertInstance(x); x_j.setClassValue(j); ((UpdateableClassifier)m_Classifier).updateClassifier(x_j); } } }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); if(getDebug()) System.out.print("-: Updating "+L+" models"); for(int j = 0; j < L; j++) { Instance x_j = (Instance)x.copy(); x_j.setDataset(null); x_j = MLUtils.keepAttributesAt(x_j,new int[]{j},L); x_j.setDataset(m_InstancesTemplates[j]); ((UpdateableClassifier)m_MultiClassifiers[j]).updateClassifier(x_j); } if(getDebug()) System.out.println(":- "); }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); for (int j = 0; j < L; j++) { if(x.value(j) > 0.0) { Instance x_j = convertInstance(x); x_j.setClassValue(j); ((UpdateableClassifier)m_Classifier).updateClassifier(x_j); } } }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); for (int j = 0; j < L; j++) { if(x.value(j) > 0.0) { Instance x_j = convertInstance(x); x_j.setClassValue(j); ((UpdateableClassifier)m_Classifier).updateClassifier(x_j); } } }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); if(getDebug()) System.out.print("-: Updating "+L+" models"); for(int j = 0; j < L; j++) { Instance x_j = (Instance)x.copy(); x_j.setDataset(null); x_j = MLUtils.keepAttributesAt(x_j,new int[]{j},L); x_j.setDataset(m_InstancesTemplates[j]); ((UpdateableClassifier)m_MultiClassifiers[j]).updateClassifier(x_j); } if(getDebug()) System.out.println(":- "); }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); if(getDebug()) System.out.print("-: Updating "+L+" models"); for(int j = 0; j < L; j++) { Instance x_j = (Instance)x.copy(); x_j.setDataset(null); x_j = MLUtils.keepAttributesAt(x_j,new int[]{j},L); x_j.setDataset(m_InstancesTemplates[j]); ((UpdateableClassifier)m_MultiClassifiers[j]).updateClassifier(x_j); } if(getDebug()) System.out.println(":- "); }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); if(getDebug()) System.out.print("-: Updating "+L+" models"); for(int j = 0; j < L; j++) { Instance x_j = (Instance)x.copy(); x_j.setDataset(null); x_j = MLUtils.keepAttributesAt(x_j,new int[]{j},L); x_j.setDataset(m_Templates[j]); ((UpdateableClassifier)m_MultiClassifiers[j]).updateClassifier(x_j); } if(getDebug()) System.out.println(":- "); }
@Override public void updateClassifier(Instance x) throws Exception { int L = x.classIndex(); if(getDebug()) System.out.print("-: Updating "+L+" models"); for(int j = 0; j < L; j++) { Instance x_j = (Instance)x.copy(); x_j.setDataset(null); x_j = MLUtils.keepAttributesAt(x_j,new int[]{j},L); x_j.setDataset(m_InstancesTemplates[j]); ((UpdateableClassifier)m_MultiClassifiers[j]).updateClassifier(x_j); } if(getDebug()) System.out.println(":- "); }
/** * Updates a classifier using the given instance. * * @param instance the instance to included * @throws Exception if instance could not be incorporated successfully or not * successfully filtered */ @Override public void updateClassifier(Instance instance) throws Exception { if (m_Filter.numPendingOutput() > 0) { throw new Exception("Filter output queue not empty!"); } if (!m_Filter.input(instance)) { if (m_Filter.numPendingOutput() > 0) { throw new Exception("Filter output queue not empty!"); } // nothing to train on if the filter does not make an instance available return; // throw new // Exception("Filter didn't make the train instance immediately available!"); } m_Filter.batchFinished(); Instance newInstance = m_Filter.output(); ((UpdateableClassifier) m_Classifier).updateClassifier(newInstance); }
@Override public void updateClassifier(Instance x) throws Exception { for(int i = 0; i < m_NumIterations; i++) { // Oza-Bag style int k = poisson(1.0, random); if (m_BagSizePercent == 100) { // Train on all instances k = 1; } if (k > 0) { // Train on this instance only if k > 0 Instance x_weighted = (Instance) x.copy(); x_weighted.setWeight(x.weight() * (double)k); ((UpdateableClassifier)m_Classifiers[i]).updateClassifier(x_weighted); } } }
@Override public void updateClassifier(Instance x) throws Exception { for(int i = 0; i < m_NumIterations; i++) { // Oza-Bag style int k = poisson(1.0, random); if (m_BagSizePercent == 100) { // Train on all instances k = 1; } if (k > 0) { // Train on this instance only if k > 0 Instance x_weighted = (Instance) x.copy(); x_weighted.setWeight(x.weight() * (double)k); ((UpdateableClassifier)m_Classifiers[i]).updateClassifier(x_weighted); } } }
@Override public void updateClassifier(Instance x) throws Exception { for(int i = 0; i < m_NumIterations; i++) { // Oza-Bag style int k = poisson(1.0, random); if (m_BagSizePercent == 100) { // Train on all instances k = 1; } if (k > 0) { // Train on this instance only if k > 0 Instance x_weighted = (Instance) x.copy(); x_weighted.setWeight(x.weight() * (double)k); ((UpdateableClassifier)m_Classifiers[i]).updateClassifier(x_weighted); } } }
((UpdateableClassifier) m_classifier).updateClassifier(inst); } catch (Exception e) { throw new DistributedWekaException(e);
/** * Updates the classifier with the given instance. * * @param instance the new training instance to include in the model * @exception Exception if the instance could not be incorporated in the * model. */ @Override public void updateClassifier(Instance instance) throws Exception { if (!instance.classIsMissing()) { if (m_Classifiers.length == 1) { ((UpdateableClassifier) m_Classifiers[0]).updateClassifier(instance); return; } for (int i = 0; i < m_Classifiers.length; i++) { if (m_Classifiers[i] != null) { m_ClassFilters[i].input(instance); Instance converted = m_ClassFilters[i].output(); if (converted != null) { converted.dataset().setClassIndex(m_ClassAttribute.index()); ((UpdateableClassifier) m_Classifiers[i]) .updateClassifier(converted); if (m_Method == METHOD_1_AGAINST_1) { m_SumOfWeights[i] += converted.weight(); } } } } } }
((UpdateableClassifier) classifier).updateClassifier(x); } catch(Exception e) { System.err.println("[ERROR] Failed to update classifier");
protected void update(Instance x) throws Exception { Instance x_ = (Instance)x.copy(); x_.setDataset(null); // delete all except one (leaving a binary problem) // delete all the attributes (and track where our index ends up) int c_index = this.value; for(int i = excld.length-1; i >= 0; i--) { x_.deleteAttributeAt(excld[i]); if (excld[i] < this.index) c_index--; } x_.setDataset(this._template); ((UpdateableClassifier)this.classifier).updateClassifier(x_); if (next != null) next.update(x); }
/** * Updates the classifier with the given instance. * * @param instance the new training instance to include in the model * @exception Exception if the instance could not be incorporated in the * model. */ @Override public void updateClassifier(Instance instance) throws Exception { if (!instance.classIsMissing()) { if (m_Classifiers.length == 1) { ((UpdateableClassifier) m_Classifiers[0]).updateClassifier(instance); return; } for (int i = 0; i < m_Classifiers.length; i++) { if (m_Classifiers[i] != null) { m_ClassFilters[i].input(instance); Instance converted = m_ClassFilters[i].output(); if (converted != null) { converted.dataset().setClassIndex(m_ClassAttribute.index()); ((UpdateableClassifier) m_Classifiers[i]) .updateClassifier(converted); if (m_Method == METHOD_1_AGAINST_1) { m_SumOfWeights[i] += converted.weight(); } } } } } }
protected void update(Instance x) throws Exception { Instance x_ = (Instance)x.copy(); x_.setDataset(null); // delete all except one (leaving a binary problem) // delete all the attributes (and track where our index ends up) int c_index = this.value; for(int i = excld.length-1; i >= 0; i--) { x_.deleteAttributeAt(excld[i]); if (excld[i] < this.index) c_index--; } x_.setDataset(this._template); ((UpdateableClassifier)this.classifier).updateClassifier(x_); if (next != null) next.update(x); }
protected void update(Instance x) throws Exception { Instance x_ = (Instance)x.copy(); x_.setDataset(null); // delete all except one (leaving a binary problem) // delete all the attributes (and track where our index ends up) int c_index = this.value; for(int i = excld.length-1; i >= 0; i--) { x_.deleteAttributeAt(excld[i]); if (excld[i] < this.index) c_index--; } x_.setDataset(this._template); ((UpdateableClassifier)this.classifier).updateClassifier(x_); if (next != null) next.update(x); }
((UpdateableClassifier)h).updateClassifier(x); long after = System.currentTimeMillis(); train_time += (after-before);