|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.utilities.DatabaseUtil
public final class DatabaseUtil
Class with Database-related utility functions such as centroid computation, covariances etc.
Nested Class Summary | |
---|---|
static class |
DatabaseUtil.CollectionFromRelation<O>
Collection view on a database that retrieves the objects when needed. |
static class |
DatabaseUtil.RelationObjectIterator<O>
Iterator class that retrieves the given objects from the database. |
Constructor Summary | |
---|---|
DatabaseUtil()
|
Method Summary | ||
---|---|---|
static
|
assumeVectorField(Relation<V> relation)
Get the dimensionality of a database |
|
static
|
centroid(Relation<? extends V> relation)
Returns the centroid as a NumberVector object of the specified database. |
|
static
|
centroid(Relation<? extends V> relation,
DBIDs ids)
Returns the centroid as a NumberVector object of the specified objects stored in the given database. |
|
static
|
centroid(Relation<? extends V> relation,
DBIDs ids,
BitSet dimensions)
Returns the centroid w.r.t. the dimensions specified by the given BitSet as a NumberVector object of the specified objects stored in the given database. |
|
static
|
computeMinMax(Relation<NV> database)
Determines the minimum and maximum values in each dimension of all objects stored in the given database. |
|
static Matrix |
covarianceMatrix(Matrix data)
Determines the d x d covariance matrix of the given n x d data matrix. |
|
static
|
covarianceMatrix(Relation<? extends V> database,
DBIDs ids)
Determines the covariance matrix of the objects stored in the given database. |
|
static int |
dimensionality(Relation<? extends FeatureVector<?,?>> relation)
Get the dimensionality of a database |
|
static
|
exactMedian(Relation<V> relation,
DBIDs ids,
int dimension)
Returns the median of a data set in the given dimension. |
|
static
|
getBaseObjectClassExpensive(Relation<O> database)
Do a full inspection of the database to find the base object class. |
|
static SortedSet<ClassLabel> |
getClassLabels(Database database)
Retrieves all class labels within the database. |
|
static SortedSet<ClassLabel> |
getClassLabels(Relation<? extends ClassLabel> database)
Retrieves all class labels within the database. |
|
static
|
getColumnLabel(Relation<? extends V> rel,
int col)
Get the column name or produce a generic label "Column XY". |
|
static ArrayModifiableDBIDs |
getObjectsByLabelMatch(Database database,
Pattern name_pattern)
Find object by matching their labels. |
|
static Relation<String> |
guessLabelRepresentation(Database database)
Guess a potentially label-like representation. |
|
static
|
guessObjectClass(Relation<O> database)
Do a cheap guess at the databases object class. |
|
static Relation<String> |
guessObjectLabelRepresentation(Database database)
Guess a potentially object label-like representation. |
|
static
|
quickMedian(Relation<V> relation,
ArrayDBIDs ids,
int dimension,
int numberOfSamples)
Returns the median of a data set in the given dimension by using a sampling method. |
|
static
|
relationUglyVectorCast(Relation<T> database)
An ugly vector type cast unavoidable in some situations due to Generics. |
|
static double[] |
variances(Relation<? extends NumberVector<?,?>> database,
NumberVector<?,?> centroid,
DBIDs ids)
Determines the variances in each dimension of the specified objects stored in the given database. |
|
static
|
variances(Relation<V> database)
Determines the variances in each dimension of all objects stored in the given database. |
|
static
|
variances(Relation<V> database,
DBIDs ids)
Determines the variances in each dimension of the specified objects stored in the given database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseUtil()
Method Detail |
---|
public static <V extends FeatureVector<?,?>> VectorFieldTypeInformation<V> assumeVectorField(Relation<V> relation)
relation
- relation
public static int dimensionality(Relation<? extends FeatureVector<?,?>> relation)
relation
- relation
public static <V extends NumberVector<? extends V,?>> V centroid(Relation<? extends V> relation)
NumberVector
.
V
- Vector typerelation
- the Relation storing the objects
IllegalArgumentException
- if the database is emptypublic static <V extends NumberVector<? extends V,?>> V centroid(Relation<? extends V> relation, DBIDs ids)
NumberVector
.
V
- Vector typerelation
- the relationids
- the ids of the objects
IllegalArgumentException
- if the id list is emptypublic static <V extends NumberVector<? extends V,?>> V centroid(Relation<? extends V> relation, DBIDs ids, BitSet dimensions)
NumberVector
.
V
- Vector typerelation
- the database storing the objectsids
- the identifiable objectsdimensions
- the BitSet representing the dimensions to be considered
IllegalArgumentException
- if the id list is emptypublic static <V extends NumberVector<? extends V,?>> Matrix covarianceMatrix(Relation<? extends V> database, DBIDs ids)
V
- Vector typedatabase
- the database storing the objectsids
- the ids of the objects
public static Matrix covarianceMatrix(Matrix data)
data
- the database storing the objects
public static <V extends NumberVector<? extends V,?>> double[] variances(Relation<V> database)
database
- the database storing the objects
public static <V extends NumberVector<? extends V,?>> double[] variances(Relation<V> database, DBIDs ids)
variances(database, centroid(database, ids), ids)
database
- the database storing the objectsids
- the ids of the objects
public static double[] variances(Relation<? extends NumberVector<?,?>> database, NumberVector<?,?> centroid, DBIDs ids)
database
- the database storing the objectsids
- the ids of the objectscentroid
- the centroid or reference vector of the ids
public static <NV extends NumberVector<NV,?>> Pair<NV,NV> computeMinMax(Relation<NV> database)
NV
- vector typedatabase
- the database storing the objects
public static <V extends NumberVector<?,?>> double quickMedian(Relation<V> relation, ArrayDBIDs ids, int dimension, int numberOfSamples)
relation
- Relation to processids
- DBIDs to processdimension
- DimensionalitynumberOfSamples
- Number of samples to draw
public static <V extends NumberVector<?,?>> double exactMedian(Relation<V> relation, DBIDs ids, int dimension)
relation
- Relation to processids
- DBIDs to processdimension
- Dimensionality
public static Relation<String> guessLabelRepresentation(Database database) throws NoSupportedDataTypeException
database
-
NoSupportedDataTypeException
public static Relation<String> guessObjectLabelRepresentation(Database database) throws NoSupportedDataTypeException
database
-
NoSupportedDataTypeException
public static SortedSet<ClassLabel> getClassLabels(Relation<? extends ClassLabel> database)
database
- the database to be scanned for class labels
public static SortedSet<ClassLabel> getClassLabels(Database database)
database
- the database to be scanned for class labels
public static <O> Class<? extends O> guessObjectClass(Relation<O> database)
O
- Restriction typedatabase
- Database
public static <O> Class<?> getBaseObjectClassExpensive(Relation<O> database)
O
- Restriction typedatabase
- Database
public static ArrayModifiableDBIDs getObjectsByLabelMatch(Database database, Pattern name_pattern)
database
- Database to search inname_pattern
- Name to match against class or object label
public static <V extends NumberVector<?,?>,T extends NumberVector<?,?>> Relation<V> relationUglyVectorCast(Relation<T> database)
V
- Base vector typeT
- Derived vector type (is actually V, too)database
- Database
public static <V extends FeatureVector<?,?>> String getColumnLabel(Relation<? extends V> rel, int col)
rel
- Relationcol
- Column
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |