Classes
Methods
distance_matrix(A, metricopt) → {Matrix}
Computes the distance matrix of datamatrix A
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
A | Matrix | Matrix. | ||
metric | function | <optional> | euclidean | The diistance metric. |
- Source
Returns:
D - The distance matrix of A
.
- Type:
- Matrix
k_nearest_neigbhors(A, k, metricopt) → {Array.<Object>}
Computes the k-nearest neighbors of each row of A
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
A | Matrix | Either the data matrix, or a distance matrix. | ||
k | Number | The number of neighbors to compute. | ||
metric | function | | <optional> | euclidean |
Returns:
- Type:
- Array.<Object>
linspace(start, end, numberopt) → {Array}
Creates an Array containing number
numbers from start
to end
. If number
= null.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start | Number | Start value. | ||
end | Number | End value. | ||
number | Number | <optional> | null | Number of number between |
- Source
Returns:
- An array with
number
entries, beginning atstart
ending atend
.
- Type:
- Array
norm(v, metricopt) → {Number}
Computes the norm of a vector, by computing its distance to 0.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
v | Matrix | | Vector. | ||
metric | function | <optional> | euclidean | Which metric should be used to compute the norm. |
- Source
Returns:
- The norm of
v
.
- Type:
- Number
normalize(v, metric) → {Array.<Number>|Float64Array}
Normalizes Vector v
.
Parameters:
Name | Type | Description |
---|---|---|
v | Array.<Number> | | Vector |
metric | function |
- Source
Returns:
- The normalized vector with length 1.
- Type:
- Array.<Number> |
Float64Array