com.rapidminer.operator.clustering
Class ClusterModel

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
      extended by com.rapidminer.operator.ResultObjectAdapter
          extended by com.rapidminer.operator.AbstractModel
              extended by com.rapidminer.operator.clustering.ClusterModel
All Implemented Interfaces:
ClusterModelInterface, IOObject, Model, ResultObject, Readable, Reportable, LoggingHandler, java.io.Serializable
Direct Known Subclasses:
CentroidClusterModel, FlatFuzzyClusterModel

public class ClusterModel
extends AbstractModel
implements ClusterModelInterface

This class is the standard flat cluster model, using the example ids to remember which examples were assigned to which cluster. This information is stored within the single clusters. Since this, the id attribute needs to be unchanged when cluster model is applied onto an example set.

Author:
Sebastian Land
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.rapidminer.operator.AbstractIOObject
AbstractIOObject.InputStreamProvider
 
Field Summary
static int UNASSIGNABLE
           
 
Constructor Summary
ClusterModel(ExampleSet exampleSet, int k, boolean addClusterAsLabel, boolean removeUnknown)
           
 
Method Summary
 ExampleSet apply(ExampleSet exampleSet)
          Applies the model on the given example set.
 void checkCapabilities(ExampleSet exampleSet)
           
 Cluster getCluster(int i)
           
 int[] getClusterAssignments(ExampleSet exampleSet)
          This method returns an array with the indices or the cluster for all examples in the set.
 int getClusterIndexOfId(java.lang.Object id)
          This method returns the index of the cluster, this Id's example has been assigned to.
 java.util.Collection<Cluster> getClusters()
           
 java.lang.String getExtension()
           
 java.lang.String getFileDescription()
           
 java.lang.String getName()
          The default implementation returns the result of the super class.
 int getNumberOfClusters()
           
 boolean isAddingLabel()
          This method returns whether this cluster model should add the assignment as a label.
 boolean isRemovingUnknownAssignments()
          This method returns whether examples which can't be assigned should be removed from the resulting example set.
 void setClusterAssignments(int[] clusterId, ExampleSet exampleSet)
           
 java.lang.String toString()
           
 
Methods inherited from class com.rapidminer.operator.AbstractModel
getTrainingHeader, isInTargetEncoding, isUpdatable, setParameter, updateModel
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, getAnnotations, getResultIcon, log, log, logError, logNote, logWarning, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
appendOperatorToHistory, copy, getLog, getProcessingHistory, getSource, initWriting, read, read, read, read, setLoggingHandler, setSource, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.IOObject
appendOperatorToHistory, copy, getAnnotations, getLog, getProcessingHistory, getSource, setLoggingHandler, setSource, write
 
Methods inherited from interface com.rapidminer.operator.ResultObject
getActions, getResultIcon, toResultString
 

Field Detail

UNASSIGNABLE

public static final int UNASSIGNABLE
See Also:
Constant Field Values
Constructor Detail

ClusterModel

public ClusterModel(ExampleSet exampleSet,
                    int k,
                    boolean addClusterAsLabel,
                    boolean removeUnknown)
Method Detail

apply

public ExampleSet apply(ExampleSet exampleSet)
                 throws OperatorException
Description copied from interface: Model
Applies the model on the given example set. Please note that the delivered example set might be the same as the input example set. This does, however, no always to be the case.

Specified by:
apply in interface Model
Throws:
OperatorException

getNumberOfClusters

public int getNumberOfClusters()

isAddingLabel

public boolean isAddingLabel()
This method returns whether this cluster model should add the assignment as a label.


isRemovingUnknownAssignments

public boolean isRemovingUnknownAssignments()
This method returns whether examples which can't be assigned should be removed from the resulting example set.

Returns:

setClusterAssignments

public void setClusterAssignments(int[] clusterId,
                                  ExampleSet exampleSet)

getClusterAssignments

public int[] getClusterAssignments(ExampleSet exampleSet)
This method returns an array with the indices or the cluster for all examples in the set. This will work with new examples, if centroid based clustering has been used before. Otherwise new examples cannot be assigned.


getClusterIndexOfId

public int getClusterIndexOfId(java.lang.Object id)
This method returns the index of the cluster, this Id's example has been assigned to. Please note, that this can only be applied to examples included in the clustering process. New examples might be assigned to clusters using the getClusterAssignments method, if and only if the cluster model supports this. Currently only centroid based cluster models do.


getCluster

public Cluster getCluster(int i)

getClusters

public java.util.Collection<Cluster> getClusters()

getExtension

public java.lang.String getExtension()
Overrides:
getExtension in class AbstractModel

getFileDescription

public java.lang.String getFileDescription()
Overrides:
getFileDescription in class AbstractModel

checkCapabilities

public void checkCapabilities(ExampleSet exampleSet)
                       throws OperatorException
Throws:
OperatorException

getName

public java.lang.String getName()
Description copied from class: AbstractModel
The default implementation returns the result of the super class. If the string ends with model, the substring "model" is removed.

Specified by:
getName in interface ResultObject
Overrides:
getName in class AbstractModel

toString

public java.lang.String toString()
Specified by:
toString in interface Readable
Overrides:
toString in class java.lang.Object


Copyright © 2001-2009 by Rapid-I