Documentation of 'jsat.clustering.MeanShift' Java class
MeanShift
jsat.clustering

Class MeanShift

  • All Implemented Interfaces:
    java.io.Serializable, Clusterer


    public class MeanShift
    extends java.lang.Object
    implements Clusterer
    The MeanShift algorithms performs clustering on a data set by letting the data speak for itself and performing a mode search amongst the data set, returning a cluster for each discovered mode.

    While not normally discussed in the context of Mean Shift, this implementation has rudimentary outlier-removal, outliers will not be included in the clustering.

    The mean shift requires a MultivariateKDE to run. Contrary to use in density estimation, where the KernelFunction used has only a minor impact on the results, it is highly recommended you use the GaussKF for the MeanShift method. This is because of the large support and better behaved derivative, which adds in the avoidance of oscillating convergence.

    Implementation Note: This implementation does not snap the values to a grid. This causes the prior noted oscillation in convergence.
    See Also:
    Serialized Form
    • Constructor Detail

      • MeanShift

        public MeanShift(DistanceMetric dm)
        Creates a new MeanShift clustering object using a MetricKDE and the GaussKF.
        Parameters:
        dm - the distance metric to use
      • MeanShift

        public MeanShift(MultivariateKDE mkde)
        Creates a new MeanShift clustering object.
        NOTE: ProductKDE does not currently support the functions needed to work with MeanShift.
        Parameters:
        mkde - the KDE to use in the clustering process.
      • MeanShift

        public MeanShift(MeanShift toCopy)
        Copy constructor
        Parameters:
        toCopy - the object to copy
    • Method Detail

      • setMaxIterations

        public void setMaxIterations(int maxIterations)
        Sets the maximum number of iterations the algorithm will go through, terminating early if convergence has not occurred.
        Parameters:
        maxIterations - the maximum number of iterations
        Throws:
        java.lang.ArithmeticException - if a value less than 1 is given
      • getMaxIterations

        public int getMaxIterations()
        Returns the maximum number of iterations the algorithm will go through, terminating early if convergence has not occurred.
        Returns:
        the maximum number of iterations
      • setScaleBandwidthFactor

        public void setScaleBandwidthFactor(double scaleBandwidthFactor)
        Sets the value by which the bandwidth of the MultivariateKDE will be scaled by.
        Parameters:
        scaleBandwidthFactor - the value to scale bandwidth by
        Throws:
        java.lang.ArithmeticException - if the value given is NaN or infinity
      • getScaleBandwidthFactor

        public double getScaleBandwidthFactor()
        Returns the value by which the bandwidth of the MultivariateKDE will be scaled by.
        Returns:
        the value to scale bandwidth by
      • cluster

        public int[] cluster(DataSet dataSet,
                             boolean parallel,
                             int[] designations)
        Description copied from interface: Clusterer
        Performs clustering on the given data set. Parameters may be estimated by the method, or other heuristics performed.
        Specified by:
        cluster in interface Clusterer
        Parameters:
        dataSet - the data set to perform clustering on
        parallel - true if multiple threads should be used to perform clustering. false if it should be done in a single threaded manner.
        designations - the array which will contain the designated values. The array will be altered and returned by the function. If null is given, a new array will be created and returned.
        Returns:
        the int[]
      • clone

        public MeanShift clone()
        Specified by:
        clone in interface Clusterer
        Overrides:
        clone in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.