Package elki.data.model
Class ModelUtil
- java.lang.Object
-
- elki.data.model.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 NumberVector
getPrototype(Model model, Relation<? extends NumberVector> relation)
Get the representative vector for a cluster model.static <V extends NumberVector>
VgetPrototype(Model model, Relation<? extends V> relation, NumberVector.Factory<V> factory)
Get (and convert!)static NumberVector
getPrototypeOrCentroid(Model model, Relation<? extends NumberVector> relation, DBIDs ids)
Get the representative vector for a cluster model, or compute the centroid.static <V extends NumberVector>
VgetPrototypeOrCentroid(Model model, Relation<? extends V> relation, DBIDs ids, NumberVector.Factory<V> factory)
Get the representative vector for a cluster model, or compute the centroid.
-
-
-
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
- Modelrelation
- 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
- Modelrelation
- 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
- Modelrelation
- 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
- Modelrelation
- Data relation (for representatives specified per DBID)ids
- Cluster ids (must not be empty.- Returns:
- Some
NumberVector
.
-
-