new SparseVector(size, indices, values)
Parameters:
Name | Type | Description |
---|---|---|
size |
integer | |
indices |
Array.<integer> | |
values |
Array.<float> |
Extends
Methods
apply(i) → {number}
Gets the value of the ith element.
Parameters:
Name | Type | Description |
---|---|---|
i |
number | index |
- Inherited From:
- Source:
Returns:
- Type
- number
argmax() → {integer}
Find the index of a maximal element. Returns the first maximal element in case of a tie.
Returns -1 if vector has length 0.
- Inherited From:
- Source:
Returns:
- Type
- integer
compressed() → {module:eclairjs/mllib/linalg.Vector}
Returns a vector in either dense or sparse format, whichever uses less storage.
- Inherited From:
- Source:
Returns:
copy() → {module:eclairjs/mllib/linalg.Vector}
Makes a deep copy of this vector.
- Inherited From:
- Source:
Returns:
equals(other) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Inherited From:
- Source:
Returns:
- Type
- boolean
hashCode() → {number}
Returns a hash code value for the vector. The hash code is based on its size and its first 128
nonzero entries, using a hash algorithm similar to hashCode.
- Inherited From:
- Source:
Returns:
- Type
- number
indices() → {Array.<integer>}
Returns:
- Type
- Array.<integer>
numActives() → {integer}
Number of active entries. An "active entry" is an element which is explicitly stored,
regardless of its value. Note that inactive entries have value 0.
- Inherited From:
- Source:
Returns:
- Type
- integer
numNonzeros() → {integer}
Number of nonzero elements. This scans all active values and count nonzeros.
- Inherited From:
- Source:
Returns:
- Type
- integer
size() → {integer}
Size of the vector.
- Inherited From:
- Source:
Returns:
- Type
- integer
toArray() → {Array.<float>}
Converts the instance to a double array.
- Inherited From:
- Source:
Returns:
- Type
- Array.<float>
toDense() → {module:eclairjs/mllib/linalg.DenseVector}
Converts this vector to a dense vector.
- Inherited From:
- Source:
Returns:
toSparse() → {module:eclairjs/mllib/linalg.SparseVector}
Converts this vector to a sparse vector with all explicit zeros removed.
- Inherited From:
- Source: