public class Centroid extends Vector
DatabaseUtil
for
easier to use APIs.Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
Serial version
|
protected double |
wsum
The current weight
|
Constructor and Description |
---|
Centroid(int dim)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static Centroid |
make(Matrix mat)
Static Constructor from an existing matrix columns.
|
static Centroid |
make(Relation<? extends NumberVector<?,?>> relation)
Static constructor from an existing relation.
|
static Centroid |
make(Relation<? extends NumberVector<?,?>> relation,
Iterable<DBID> ids)
Static constructor from an existing relation.
|
void |
put(double[] val)
Add a single value with weight 1.0
|
void |
put(double[] val,
double weight)
Add data with a given weight.
|
void |
put(NumberVector<?,?> val)
Add a single value with weight 1.0
|
void |
put(NumberVector<?,?> val,
double weight)
Add data with a given weight.
|
void |
put(Vector val)
Add a single value with weight 1.0
|
void |
put(Vector val,
double weight)
Add data with a given weight.
|
<F extends NumberVector<? extends F,?>> |
toVector(Relation<? extends F> relation)
Get the data as vector
|
clone, copy, equals, euclideanLength, get, get, getArrayCopy, getArrayRef, getColumnDimensionality, getColumnVector, getDimensionality, getRowDimensionality, hashCode, increment, inverseVector, minus, minusEquals, minusEquals, minusTimes, minusTimesEquals, normalize, normF, plus, plusEquals, plusEquals, plusTimes, plusTimesEquals, projection, randomNormalizedVector, scalarProduct, set, set, setZero, sqrtVector, times, times, timesEquals, timesTranspose, toString, toStringNoWhitespace, transpose, transposeTimes, transposeTimes, unitVector
private static final long serialVersionUID
protected double wsum
public void put(double[] val)
val
- Valuepublic void put(double[] val, double weight)
val
- dataweight
- weightpublic final void put(Vector val)
val
- Valuepublic final void put(Vector val, double weight)
val
- dataweight
- weightpublic void put(NumberVector<?,?> val)
val
- Valuepublic void put(NumberVector<?,?> val, double weight)
val
- dataweight
- weightpublic <F extends NumberVector<? extends F,?>> F toVector(Relation<? extends F> relation)
public static Centroid make(Matrix mat)
mat
- Matrix to use the columns from.public static Centroid make(Relation<? extends NumberVector<?,?>> relation)
relation
- Relation to usepublic static Centroid make(Relation<? extends NumberVector<?,?>> relation, Iterable<DBID> ids)
relation
- Relation to useids
- IDs to use