|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.stats.svm.SparseVector
An implementation of a sparse vector.
Memory is only allocated for dimensions that have non-zero values.
Inner Class Summary | |
static class |
SparseVector.NormalizingKernel
A version of the standard dot-product kernel that scales each column independantly. |
Field Summary | |
static SVMKernel |
kernel
|
Constructor Summary | |
SparseVector()
|
|
SparseVector(int capacity)
|
Method Summary | |
double |
get(int dim)
Retrieve the value at dimension dim. |
int |
getDimAtIndex(int indx)
Retrieve the dimension at a specific index. |
double |
getValueAtIndex(int indx)
Retrieve the value at a specific index. |
int |
maxIndex()
|
static SparseVector |
normalLengthVector(SparseVector v,
double length)
|
void |
put(int dim,
double value)
Set the value at a particular dimension. |
int |
size()
The number of used dimensions. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final SVMKernel kernel
Constructor Detail |
public SparseVector()
public SparseVector(int capacity)
Method Detail |
public int size()
This is the total number of non-zero dimensions. It is not equal to the number of the highest indexed dimension.
public void put(int dim, double value)
This silently handles the case when previously there was no value at dim. It does not contract the sparse array if you set a value to zero.
dim
- the dimension to altervalue
- the new valuepublic double get(int dim)
dim
- the dimension to retrieve a value forpublic int getDimAtIndex(int indx)
E.g., if the sparse vector had dimensions 5, 11, 12, 155 set to non-zero
values then sv.getDimAtIndex(2)
would return 12.
indx
- the indexpublic double getValueAtIndex(int indx)
E.g., if the sparse vector contained the data 5->0.1, 11->100, 12->8.5, 155->-10
then sv.geValueAtIndex(2)
would return 8.5.
indx
- the indexpublic int maxIndex()
public static SparseVector normalLengthVector(SparseVector v, double length)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |