Class ModelUtil


  • public final class ModelUtil
    extends java.lang.Object
    Utility classes for dealing with cluster models.
    Since:
    0.7.0
    Author:
    Erich Schubert
    • Constructor Detail

      • ModelUtil

        private ModelUtil()
        Private constructor. Static methods only.
    • Method Detail

      • getPrototype

        public static <V extends NumberVector> V getPrototype​(Model model,
                                                              Relation<? extends V> relation,
                                                              NumberVector.Factory<V> factory)
        Get (and convert!) the representative vector for a cluster model. Only representative-based models are supported! null is returned when the model is not supported!
        Type Parameters:
        V - desired vector type
        Parameters:
        model - Model
        relation - Data relation (for representatives specified per DBID)
        factory - Vector factory, for type conversion.
        Returns:
        Vector of type V, null if not supported.
      • getPrototype

        public static NumberVector getPrototype​(Model model,
                                                Relation<? extends NumberVector> relation)
        Get the representative vector for a cluster model. Only representative-based models are supported! null is returned when the model is not supported!
        Parameters:
        model - Model
        relation - Data relation (for representatives specified per DBID)
        Returns:
        Some NumberVector, null if not supported.
      • getPrototypeOrCentroid

        public static <V extends NumberVector> V getPrototypeOrCentroid​(Model model,
                                                                        Relation<? extends V> relation,
                                                                        DBIDs ids,
                                                                        NumberVector.Factory<V> factory)
        Get the representative vector for a cluster model, or compute the centroid.
        Type Parameters:
        V - desired vector type
        Parameters:
        model - Model
        relation - Data relation (for representatives specified per DBID)
        ids - Cluster ids (must not be empty.
        Returns:
        Vector of type V, null if not supported.
      • getPrototypeOrCentroid

        public static NumberVector getPrototypeOrCentroid​(Model model,
                                                          Relation<? extends NumberVector> relation,
                                                          DBIDs ids)
        Get the representative vector for a cluster model, or compute the centroid.
        Parameters:
        model - Model
        relation - Data relation (for representatives specified per DBID)
        ids - Cluster ids (must not be empty.
        Returns:
        Some NumberVector.