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 Summary

      Constructors 
      Modifier Constructor Description
      private ModelUtil()
      Private constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static elki.data.NumberVector getPrototype​(Model model, elki.database.relation.Relation<? extends elki.data.NumberVector> relation)
      Get the representative vector for a cluster model.
      static <V extends elki.data.NumberVector>
      V
      getPrototype​(Model model, elki.database.relation.Relation<? extends V> relation, elki.data.NumberVector.Factory<V> factory)
      Get (and convert!)
      static elki.data.NumberVector getPrototypeOrCentroid​(Model model, elki.database.relation.Relation<? extends elki.data.NumberVector> relation, elki.database.ids.DBIDs ids)
      Get the representative vector for a cluster model, or compute the centroid.
      static <V extends elki.data.NumberVector>
      V
      getPrototypeOrCentroid​(Model model, elki.database.relation.Relation<? extends V> relation, elki.database.ids.DBIDs ids, elki.data.NumberVector.Factory<V> factory)
      Get the representative vector for a cluster model, or compute the centroid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModelUtil

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

      • getPrototype

        public static <V extends elki.data.NumberVector> V getPrototype​(Model model,
                                                                        elki.database.relation.Relation<? extends V> relation,
                                                                        elki.data.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 elki.data.NumberVector getPrototype​(Model model,
                                                          elki.database.relation.Relation<? extends elki.data.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 elki.data.NumberVector> V getPrototypeOrCentroid​(Model model,
                                                                                  elki.database.relation.Relation<? extends V> relation,
                                                                                  elki.database.ids.DBIDs ids,
                                                                                  elki.data.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 elki.data.NumberVector getPrototypeOrCentroid​(Model model,
                                                                    elki.database.relation.Relation<? extends elki.data.NumberVector> relation,
                                                                    elki.database.ids.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.