new Vectors()
- Source:
Methods
dense(…values) → {module:eclairjs/mllib/linalg.Vector}
Creates a dense vector from a double array.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
float |
<repeatable> |
Array of floats or float1, ....., floatN |
- Source:
Returns:
fromJson(json) → {module:eclairjs/mllib/linalg.Vector}
Parses the JSON representation of a vector into a module:eclairjs/mllib/linalg.Vector.
Parameters:
Name | Type | Description |
---|---|---|
json |
string |
- Source:
Returns:
norm(vector, p) → {float}
Returns the p-norm of this vector.
Parameters:
Name | Type | Description |
---|---|---|
vector |
module:eclairjs/mllib/linalg.Vector | input vector. |
p |
float | norm. |
- Source:
Returns:
norm in L^p^ space.
- Type
- float
parse(s) → {module:eclairjs/mllib/linalg.Vector}
Parses a string resulted from [[Vector.toString]] into a module:eclairjs/mllib/linalg.Vector.
Parameters:
Name | Type | Description |
---|---|---|
s |
string |
- Source:
Returns:
sparse(size, indices, values) → {module:eclairjs/mllib/linalg.Vector}
Creates a sparse vector providing its index array and value array.
Parameters:
Name | Type | Description |
---|---|---|
size |
integer | vector size. |
indices |
Array.<integer> | index array, must be strictly increasing. |
values |
Array.<float> | value array, must have the same length as indices. |
- Source:
Returns:
sqdist(v1, v2) → {float}
Returns the squared distance between two Vectors.
Parameters:
Name | Type | Description |
---|---|---|
v1 |
module:eclairjs/mllib/linalg.Vector | first Vector. |
v2 |
module:eclairjs/mllib/linalg.Vector | second Vector. |
- Source:
Returns:
squared distance between two Vectors.
- Type
- float
zeros(size) → {module:eclairjs/mllib/linalg.Vector}
Creates a vector of all zeros.
Parameters:
Name | Type | Description |
---|---|---|
size |
integer | vector size |
- Source:
Returns:
a zero vector