public final class DatabaseUtil extends Object
Modifier and Type | Class and Description |
---|---|
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.
|
Modifier | Constructor and Description |
---|---|
private |
DatabaseUtil()
Fake constructor: Do not instantiate!
|
Modifier and Type | Method and Description |
---|---|
static <NV extends NumberVector<?>> |
computeMinMax(Relation<NV> relation)
Determines the minimum and maximum values in each dimension of all objects
stored in the given database.
|
static <V extends FeatureVector<?>> |
dimensionality(Relation<V> relation)
Deprecated.
Use
RelationUtil.dimensionality(Relation) instead! |
static <V extends NumberVector<?>> |
exactMedian(Relation<V> relation,
DBIDs ids,
int dimension)
Returns the median of a data set in the given dimension.
|
static <O> Class<?> |
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 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, preferring class labels.
|
static <O> Class<? extends O> |
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 <V extends NumberVector<?>> |
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 <V extends NumberVector<?>,T extends NumberVector<?>> |
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.
|
@Deprecated public static <V extends FeatureVector<?>> int dimensionality(Relation<V> relation)
RelationUtil.dimensionality(Relation)
instead!relation
- Relationpublic 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 idspublic static <NV extends NumberVector<?>> Pair<NV,NV> computeMinMax(Relation<NV> relation)
NV
- vector typerelation
- the database storing the objectspublic 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 drawpublic static <V extends NumberVector<?>> double exactMedian(Relation<V> relation, DBIDs ids, int dimension)
relation
- Relation to processids
- DBIDs to processdimension
- Dimensionalitypublic 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 labelspublic static SortedSet<ClassLabel> getClassLabels(Database database)
database
- the database to be scanned for class labelspublic static <O> Class<? extends O> guessObjectClass(Relation<O> database)
O
- Restriction typedatabase
- Databasepublic static <O> Class<?> getBaseObjectClassExpensive(Relation<O> database)
O
- Restriction typedatabase
- Databasepublic static ArrayModifiableDBIDs getObjectsByLabelMatch(Database database, Pattern name_pattern)
database
- Database to search inname_pattern
- Name to match against class or object labelpublic 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