|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<F,Float>
edu.umd.cloud9.io.VectorFloat<F>
F - type of featurepublic class VectorFloat<F extends WritableComparable>
Writable representing a vector of float values. This generic class, based on
the Java HashMap, supports the use of any class for the features
(i.e., component of the vector), but all values are floats.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Constructor Summary | |
|---|---|
VectorFloat()
Creates a VectorFloat object. |
|
| Method Summary | |
|---|---|
float |
dot(VectorFloat<F> v)
Computes the dot product between this vector and another vector. |
float |
get(F f)
Returns the value of a feature. |
SortedSet<Map.Entry<F,Float>> |
getSortedEntries()
Returns feature-value entries sorted by descending value. |
SortedSet<Map.Entry<F,Float>> |
getSortedEntries(int n)
Returns top n feature-value entries sorted by descending value. |
float |
length()
Computes the length of this vector. |
void |
normalize()
Normalizes this vector to a unit-length vector. |
void |
plus(VectorFloat<F> v)
Adds another vector to this vector, based on feature-wise addition. |
void |
readFields(DataInput in)
Deserializes the vector. |
void |
set(F f,
float v)
Sets the value of a feature. |
void |
write(DataOutput out)
Serializes the vector. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public VectorFloat()
| Method Detail |
|---|
public void readFields(DataInput in)
throws IOException
readFields in interface Writablein - source for raw byte representation
IOException
public void write(DataOutput out)
throws IOException
write in interface Writableout - where to write the raw byte representation
IOException
public void set(F f,
float v)
f - the featurev - the valuepublic float get(F f)
f - the feature
public void plus(VectorFloat<F> v)
v - vector to addpublic float dot(VectorFloat<F> v)
v - the other vectorpublic float length()
public void normalize()
public SortedSet<Map.Entry<F,Float>> getSortedEntries()
public SortedSet<Map.Entry<F,Float>> getSortedEntries(int n)
n - number of entries to return
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||