Class ProjectedCentroid

  • All Implemented Interfaces:
    FeatureVector<java.lang.Number>, NumberVector, SpatialComparable

    public class ProjectedCentroid
    extends Centroid
    Centroid only using a subset of dimensions.

    This class abstracts the mathematics of efficient and numerically stable computation of projected centroids.

    See DatabaseUtil for easier to use APIs.

    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • dims

        private long[] dims
        The selected dimensions.
    • Constructor Detail

      • ProjectedCentroid

        public ProjectedCentroid​(long[] dims,
                                 int dim)
        Constructor for updating use.
        Parameters:
        dims - Dimensions to use (indexed with 0)
        dim - Full dimensionality
    • Method Detail

      • put

        public void put​(double[] val)
        Add a single value with weight 1.0.
        Overrides:
        put in class Centroid
        Parameters:
        val - Value
      • put

        public void put​(double[] val,
                        double weight)
        Add data with a given weight.
        Overrides:
        put in class Centroid
        Parameters:
        val - data
        weight - weight
      • put

        public void put​(NumberVector val)
        Add a single value with weight 1.0.
        Overrides:
        put in class Centroid
        Parameters:
        val - Value
      • put

        public void put​(NumberVector val,
                        double weight)
        Add data with a given weight.
        Overrides:
        put in class Centroid
        Parameters:
        val - data
        weight - weight
      • make

        public static ProjectedCentroid make​(long[] dims,
                                             Relation<? extends NumberVector> relation)
        Static Constructor from a relation.
        Parameters:
        dims - Dimensions to use (indexed with 0)
        relation - Relation to process
        Returns:
        Centroid
      • make

        public static ProjectedCentroid make​(long[] dims,
                                             Relation<? extends NumberVector> relation,
                                             DBIDs ids)
        Static Constructor from a relation.
        Parameters:
        dims - Dimensions to use (indexed with 0)
        relation - Relation to process
        ids - IDs to process
        Returns:
        Centroid