Tabnine Logo
UpdateableClassifier
Code IndexAdd Tabnine to your IDE (free)

How to use
UpdateableClassifier
in
weka.classifiers

Best Java code snippets using weka.classifiers.UpdateableClassifier (Showing top 20 results out of 315)

origin: net.sf.meka/meka

@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);
    }
  }
}
origin: nz.ac.waikato.cms.weka/meka

@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(":- ");
}
origin: nz.ac.waikato.cms.weka/meka

@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);
    }
  }
}
origin: Waikato/meka

@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);
    }
  }
}
origin: net.sf.meka/meka

@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(":- ");
}
origin: net.sf.meka/meka

@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(":- ");
}
origin: Waikato/meka

@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(":- ");
}
origin: Waikato/meka

@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(":- ");
}
origin: nz.ac.waikato.cms.weka/distributedWekaBase

/**
 * 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);
}
origin: net.sf.meka/meka

@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);
    }
  }
}
origin: nz.ac.waikato.cms.weka/meka

@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);
    }
  }
}
origin: Waikato/meka

@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);
    }
  }
}
origin: nz.ac.waikato.cms.weka/distributedWekaBase

 ((UpdateableClassifier) m_classifier).updateClassifier(inst);
} catch (Exception e) {
 throw new DistributedWekaException(e);
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * 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();
     }
    }
   }
  }
 }
}
origin: nz.ac.waikato.cms.moa/moa

  ((UpdateableClassifier) classifier).updateClassifier(x);
} catch(Exception e) {
  System.err.println("[ERROR] Failed to update classifier");
origin: net.sf.meka/meka

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);
}
origin: Waikato/weka-trunk

/**
 * 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();
     }
    }
   }
  }
 }
}
origin: nz.ac.waikato.cms.weka/meka

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);
}
origin: Waikato/meka

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);
}
origin: net.sf.meka/meka

((UpdateableClassifier)h).updateClassifier(x);
long after = System.currentTimeMillis();
train_time += (after-before); 
weka.classifiersUpdateableClassifier

Javadoc

Interface to incremental classification models that can learn using one instance at a time.

Most used methods

  • updateClassifier
    Updates a classifier using the given instance.

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now