Tabnine Logo
Clusterer.clusterInstance
Code IndexAdd Tabnine to your IDE (free)

How to use
clusterInstance
method
in
weka.clusterers.Clusterer

Best Java code snippets using weka.clusterers.Clusterer.clusterInstance (Showing top 19 results out of 315)

origin: net.sf.meka.thirdparty/mulan

@Override
protected MultiLabelOutput makePredictionInternal(Instance instance) throws Exception, InvalidDataException {
  Instance newInstance = RemoveAllLabels.transformInstance(instance, labelIndices);
  int cluster = clusterer.clusterInstance(newInstance);
  return multi[cluster].makePrediction(instance);
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Add a cluster label to an instance using a clusterer
 *
 * @param clusterer the clusterer to use
 * @param inst the instance to append a prediction to
 * @param instOrig the original instance
 * @throws WekaException if a problem occurs
 */
protected void predictLabelClusterer(weka.clusterers.Clusterer clusterer,
 Instance inst, Instance instOrig) throws WekaException {
 try {
  int cluster = clusterer.clusterInstance(instOrig);
  inst.setValue(inst.numAttributes() - 1, (double) cluster);
 } catch (Exception ex) {
  throw new WekaException(ex);
 }
}
origin: Waikato/weka-trunk

/**
 * Add a cluster label to an instance using a clusterer
 *
 * @param clusterer the clusterer to use
 * @param inst the instance to append a prediction to
 * @param instOrig the original instance
 * @throws WekaException if a problem occurs
 */
protected void predictLabelClusterer(weka.clusterers.Clusterer clusterer,
 Instance inst, Instance instOrig) throws WekaException {
 try {
  int cluster = clusterer.clusterInstance(instOrig);
  inst.setValue(inst.numAttributes() - 1, (double) cluster);
 } catch (Exception ex) {
  throw new WekaException(ex);
 }
}
origin: net.sourceforge/javaml

public Dataset[] cluster(Dataset data) {
  try {
    /*
     * Weka cannot handle class values in clustering, so we have to
     * store and remove them first
     */
    HashMap<Integer, Object> classValueMapping = new HashMap<Integer, Object>();
    for (Instance i : data) {
      classValueMapping.put(i.getID(), i.classValue());
      i.setClassValue(null);
    }
    data.classes().clear();
    /* Convert to Weka and train clustering */
    Instances insts = new ToWekaUtils(data).getDataset();
    Vector<Dataset> output = new Vector<Dataset>();
    wekaCluster.buildClusterer(insts);
    /* Apply clustering to the data set and restore class values */
    for (int i = 0; i < insts.numInstances(); i++) {
      int clusterIndex = wekaCluster.clusterInstance(insts.instance(i));
      while (output.size() <= clusterIndex)
        output.add(new DefaultDataset());
      data.instance(i).setClassValue(classValueMapping.get(data.instance(i).getID()));
      output.get(clusterIndex).add(data.instance(i));
    }
    return output.toArray(new Dataset[output.size()]);
  } catch (Exception e) {
    throw new WekaException(e);
  }
}
origin: nz.ac.waikato.cms.weka/weka-stable

} else {
 try {
  cnum = clusterer.clusterInstance(inst);
origin: Waikato/weka-trunk

} else {
 try {
  cnum = clusterer.clusterInstance(inst);
origin: nz.ac.waikato.cms.weka/weka-stable

 loglk +=
  ((DensityBasedClusterer) m_Clusterer).logDensityForInstance(inst);
 cnum = m_Clusterer.clusterInstance(inst);
 clusterAssignments.add((double) cnum);
} else {
 cnum = m_Clusterer.clusterInstance(inst);
 clusterAssignments.add((double) cnum);
origin: Waikato/weka-trunk

 loglk +=
  ((DensityBasedClusterer) m_Clusterer).logDensityForInstance(inst);
 cnum = m_Clusterer.clusterInstance(inst);
 clusterAssignments.add((double) cnum);
} else {
 cnum = m_Clusterer.clusterInstance(inst);
 clusterAssignments.add((double) cnum);
origin: Waikato/weka-trunk

} else {
 try {
  cnum = clusterer.clusterInstance(inst);
origin: nz.ac.waikato.cms.weka/weka-stable

} else {
 try {
  cnum = clusterer.clusterInstance(inst);
origin: net.sf.meka.thirdparty/mulan

int clusterOfInstance = clusterer.clusterInstance(removedInstances.instance(i));
subsetMultiLabelInstances[clusterOfInstance].getDataSet().add(trainInstances.instance(i));
origin: nz.ac.waikato.cms.weka/weka-stable

result += "\n";
 try {
cluster = clusterer.clusterInstance(data.instance(i));
result += "" + (i+1) + ": " + cluster;
origin: Waikato/weka-trunk

result += "\n";
 try {
cluster = clusterer.clusterInstance(data.instance(i));
result += "" + (i+1) + ": " + cluster;
origin: Waikato/weka-trunk

double predCluster = clusterer.clusterInstance(testSet.instance(i));
newInstances.instance(i).setValue(newInstances.numAttributes() - 1,
 predCluster);
origin: nz.ac.waikato.cms.weka/weka-stable

double predCluster = clusterer.clusterInstance(testSet.instance(i));
newInstances.instance(i).setValue(newInstances.numAttributes() - 1,
 predCluster);
origin: nz.ac.waikato.cms.weka/weka-stable

  .clusterInstance(filteredI);
} catch (Exception e) {
origin: Waikato/weka-trunk

  .clusterInstance(filteredI);
} catch (Exception e) {
origin: Waikato/weka-trunk

for (int i = 0; i < data.numInstances(); i++) {
 inst = data.instance(i);
 int cluster = m_wrappedClusterer.clusterInstance(inst);
 m_priors[cluster] += inst.weight();
 for (int j = 0; j < data.numAttributes(); j++) {
origin: nz.ac.waikato.cms.weka/weka-stable

for (int i = 0; i < data.numInstances(); i++) {
 inst = data.instance(i);
 int cluster = m_wrappedClusterer.clusterInstance(inst);
 m_priors[cluster] += inst.weight();
 for (int j = 0; j < data.numAttributes(); j++) {
weka.clusterersClustererclusterInstance

Javadoc

Classifies a given instance. Either this or distributionForInstance() needs to be implemented by subclasses.

Popular methods of Clusterer

  • buildClusterer
    Generates a clusterer. Has to initialize all fields of the clusterer that are not being set via opti
  • distributionForInstance
    Predicts the cluster memberships for a given instance. Either this or clusterInstance() needs to be
  • numberOfClusters
    Returns the number of clusters.
  • getCapabilities
    Returns the Capabilities of this clusterer. Derived classifiers have to override this method to enab

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • findViewById (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Best IntelliJ plugins
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