ClusterKmeansResults

ClusterKmeansResults

Wrapper around the k-means clustering results on the Wasm heap, produced by clusterKmeans.

Classes

ClusterKmeansResults

Methods

clusterCenters(optionsopt) → (nullable) {Float64Array|Float64WasmArray}

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean | string <optional>
true

Whether to copy the results from the Wasm heap, see possibleCopy.

fillable boolean <optional>
false

Whether to return a fillable array, to write to this object. If true, this method automatically sets copy = false if copy was previously true. If false and the array was not previously filled, null is returned.

Returns:

Array containing the cluster centers in column-major format, where rows are dimensions and columns are the clusters. Alternatively null, if fillable = false and the array was not already filled.

Type
Float64Array | Float64WasmArray

clusters(optionsopt) → (nullable) {Int32Array|Int32WasmArray}

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean | string <optional>
true

Whether to copy the results from the Wasm heap, see possibleCopy.

fillable boolean <optional>
false

Whether to return a fillable array, to write to this object. If true, this method automatically sets copy = false if copy was previously true. If false and the array was not previously filled, null is returned.

Returns:

Array containing the cluster assignment for each cell. Alternatively null, if fillable = false and the array was not already filled.

Type
Int32Array | Int32WasmArray

clusterSizes(optionsopt) → (nullable) {Int32Array|Int32WasmArray}

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean | string <optional>
true

Whether to copy the results from the Wasm heap, see possibleCopy.

fillable boolean <optional>
false

Whether to return a fillable array, to write to this object. If true, this method automatically sets copy = false if copy was previously true. If false and the array was not previously filled, null is returned.

Returns:

Array containing the number of cells in each cluster. Alternatively null, if fillable = false and the array was not already filled.

Type
Int32Array | Int32WasmArray

free()

Source:
Returns:

Frees the memory allocated on the Wasm heap for this object. This invalidates this object and all references to it.

iterations() → (nullable) {number}

Source:
Returns:

Number of refinement iterations performed by the algorithm. Alternatively null, if this value has not been filled by setIterations.

Type
number

numberOfCells() → {number}

Source:
Returns:

Number of cells in the results.

Type
number

numberOfClusters() → {number}

Source:
Returns:

Number of clusters in the results.

Type
number

setIterations(iterations)

Source:
Parameters:
Name Type Description
iterations number

Number of iterations.

Returns:

The specified number of iterations is set in this object. Typically only used after emptyClusterKmeansResults.

setStatus(status)

Source:
Parameters:
Name Type Description
status number

Status of the k-means clustering.

Returns:

The status is set in this object. Typically only used after emptyClusterKmeansResults.

status() → (nullable) {number}

Source:
Returns:

Status of the algorithm - anything other than zero usually indicates a problem with convergence. Alternatively null, if this value has not been filled by setStatus.

Type
number

withinClusterSumSquares(optionsopt) → (nullable) {Float64Array|Float64WasmArray}

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean | string <optional>
true

Whether to copy the results from the Wasm heap, see possibleCopy.

fillable boolean <optional>
false

Whether to return a fillable array, to write to this object. If true, this method automatically sets copy = false if copy was previously true. If false and the array was not previously filled, null is returned.

Returns:

Array containing the within-cluster sum of squares in each cluster. Alternatively null, if fillable = false and the array was not already filled.

Type
Float64Array | Float64WasmArray