From c2697799e7045d7078049ca269584030859965d2 Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Sat, 7 Mar 2026 12:01:46 +0530 Subject: [PATCH 1/7] feat: add `ml/cluster/base/kmeans/algorithms` --- .../kmeans/algorithm-enum2str/README.md | 121 ++++++++++++ .../algorithm-enum2str/benchmark/benchmark.js | 55 ++++++ .../kmeans/algorithm-enum2str/docs/repl.txt | 23 +++ .../algorithm-enum2str/docs/types/index.d.ts | 41 ++++ .../algorithm-enum2str/docs/types/test.ts | 39 ++++ .../algorithm-enum2str/examples/index.js | 30 +++ .../kmeans/algorithm-enum2str/lib/index.js | 44 +++++ .../kmeans/algorithm-enum2str/lib/main.js | 60 ++++++ .../kmeans/algorithm-enum2str/package.json | 66 +++++++ .../kmeans/algorithm-enum2str/test/test.js | 65 ++++++ .../kmeans/algorithm-resolve-enum/README.md | 124 ++++++++++++ .../benchmark/benchmark.js | 81 ++++++++ .../algorithm-resolve-enum/docs/repl.txt | 29 +++ .../docs/types/index.d.ts | 40 ++++ .../algorithm-resolve-enum/docs/types/test.ts | 28 +++ .../algorithm-resolve-enum/examples/index.js | 29 +++ .../algorithm-resolve-enum/lib/index.js | 40 ++++ .../kmeans/algorithm-resolve-enum/lib/main.js | 57 ++++++ .../algorithm-resolve-enum/package.json | 66 +++++++ .../algorithm-resolve-enum/test/test.js | 74 +++++++ .../kmeans/algorithm-resolve-str/README.md | 121 ++++++++++++ .../benchmark/benchmark.js | 81 ++++++++ .../algorithm-resolve-str/docs/repl.txt | 25 +++ .../docs/types/index.d.ts | 38 ++++ .../algorithm-resolve-str/docs/types/test.ts | 28 +++ .../algorithm-resolve-str/examples/index.js | 30 +++ .../kmeans/algorithm-resolve-str/lib/index.js | 41 ++++ .../kmeans/algorithm-resolve-str/lib/main.js | 55 ++++++ .../kmeans/algorithm-resolve-str/package.json | 66 +++++++ .../kmeans/algorithm-resolve-str/test/test.js | 74 +++++++ .../kmeans/algorithm-str2enum/README.md | 119 +++++++++++ .../algorithm-str2enum/benchmark/benchmark.js | 54 +++++ .../kmeans/algorithm-str2enum/docs/repl.txt | 27 +++ .../algorithm-str2enum/docs/types/index.d.ts | 40 ++++ .../algorithm-str2enum/docs/types/test.ts | 39 ++++ .../algorithm-str2enum/examples/index.js | 29 +++ .../kmeans/algorithm-str2enum/lib/index.js | 40 ++++ .../kmeans/algorithm-str2enum/lib/main.js | 56 ++++++ .../kmeans/algorithm-str2enum/package.json | 66 +++++++ .../kmeans/algorithm-str2enum/test/test.js | 66 +++++++ .../base/cluster/kmeans/algorithms/README.md | 186 ++++++++++++++++++ .../kmeans/algorithms/benchmark/benchmark.js | 48 +++++ .../cluster/kmeans/algorithms/docs/repl.txt | 22 +++ .../kmeans/algorithms/docs/types/index.d.ts | 35 ++++ .../kmeans/algorithms/docs/types/test.ts | 32 +++ .../kmeans/algorithms/examples/index.js | 36 ++++ .../ml/cluster/base/kmeans/algorithms.h | 33 ++++ .../cluster/kmeans/algorithms/lib/data.json | 4 + .../cluster/kmeans/algorithms/lib/enum.js | 51 +++++ .../cluster/kmeans/algorithms/lib/index.js | 47 +++++ .../cluster/kmeans/algorithms/lib/main.js | 44 +++++ .../cluster/kmeans/algorithms/manifest.json | 36 ++++ .../cluster/kmeans/algorithms/package.json | 67 +++++++ .../cluster/kmeans/algorithms/test/test.js | 73 +++++++ 54 files changed, 2921 insertions(+) create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/data.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/manifest.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md new file mode 100644 index 000000000000..9695974bd6dd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md @@ -0,0 +1,121 @@ + + +# enum2str + +> Return the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); +``` + +#### enum2str( value ) + +Returns the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); + +var v = str2enum( 'lloyd' ); +// returns + +var s = enum2str( v ); +// returns 'lloyd' +``` + +If unable to resolve a KMeans clustering algorithm string, the function returns `null`. + +```javascript +var v = enum2str( -999999999 ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); + +var str = enum2str( str2enum( 'lloyd' ) ); +// returns 'lloyd' + +str = enum2str( str2enum( 'elkan' ) ); +// returns 'elkan' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js new file mode 100644 index 000000000000..df439bd396f0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var pkg = require( './../package.json' ).name; +var enum2str = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'lloyd' ), + str2enum( 'elkan' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = enum2str( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt new file mode 100644 index 000000000000..d690d2aeccc2 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt @@ -0,0 +1,23 @@ + +{{alias}}( value ) + Returns the KMeans clustering algorithm string associated with a KMeans + clustering algorithm enumeration constant. + + Parameters + ---------- + value: integer + Clustering algorithm enumeration constant. + + Returns + ------- + out: string|null + Clustering algorithm string. + + Examples + -------- + > var out = {{alias}}( {{alias:@stdlib/ml/base/cluster/kmeans/algorithm-str2enum}}( 'lloyd' ) ) + 'lloyd' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts new file mode 100644 index 000000000000..2a49201baa3e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts @@ -0,0 +1,41 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. +* +* @param value - enumeration constant +* @returns clustering algorithm string +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* +* var v = str2enum( 'lloyd' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'lloyd' +*/ +declare function enum2str( value: number ): string | null; + + +// EXPORTS // + +export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts new file mode 100644 index 000000000000..fe80992105ef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import enum2str = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + enum2str( 0 ); // $ExpectType string | null +} + +// The compiler throws an error if not provided a number... +{ + enum2str( '10' ); // $ExpectError + enum2str( true ); // $ExpectError + enum2str( false ); // $ExpectError + enum2str( null ); // $ExpectError + enum2str( undefined ); // $ExpectError + enum2str( [] ); // $ExpectError + enum2str( {} ); // $ExpectError + enum2str( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js new file mode 100644 index 000000000000..b3db3661c12a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var enum2str = require( './../lib' ); + +var str = enum2str( str2enum( 'elkan' ) ); +console.log( str ); +// => 'elkan' + +str = enum2str( str2enum( 'lloyd' ) ); +console.log( str ); +// => 'lloyd' diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js new file mode 100644 index 000000000000..68fb98fd1aea --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. +* +* @module @stdlib/ml/base/cluster/kmeans/algorithm-enum2str +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); +* +* var v = str2enum( 'lloyd' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'lloyd' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js new file mode 100644 index 000000000000..3b4d10b8e3c7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var objectInverse = require( '@stdlib/object/inverse' ); +var enumeration = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ).enum; + + +// VARIABLES // + +var hash = objectInverse( enumeration(), { + 'duplicates': false +}); + + +// MAIN // + +/** +* Returns the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. +* +* @param {integer} value - clustering algorithm enumeration constant +* @returns {(string|null)} clustering algorithm string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* +* var v = str2enum( 'lloyd' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'lloyd' +*/ +function enum2str( value ) { + var v = hash[ value ]; + return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json new file mode 100644 index 000000000000..f86e908733ef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/ml/base/cluster/kmeans/algorithm-enum2str", + "version": "0.0.0", + "description": "Return the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "cluster", + "kmeans", + "algorithm", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js new file mode 100644 index 000000000000..5a13af0af6b5 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var enum2str = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'lloyd', + 'elkan' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an enumeration constant', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + -9999999, + -999999999, + -99999999999 + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md new file mode 100644 index 000000000000..0fd2b5b23cc7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md @@ -0,0 +1,124 @@ + + +# resolve + +> Return the enumeration constant associated with a supported KMeans clustering algorithm value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum' ); +``` + +#### resolve( value ) + +Returns the enumeration constant associated with a KMeans clustering algorithm value. + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); + +var v = resolve( 'lloyd' ); +// returns + +v = resolve( str2enum( 'elkan' ) ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum' ); + +var v = resolve( 'lloyd' ); +// returns + +v = resolve( 'elkan' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js new file mode 100644 index 000000000000..dd9731209440 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'lloyd', + 'elkan' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'lloyd' ), + str2enum( 'elkan' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt new file mode 100644 index 000000000000..c56f89b21327 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( value ) + Returns the enumeration constant associated with a supported KMeans + clustering algorithm value. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `LLOYD == 0`). Instead, the function should be used in an + opaque manner. + + Parameters + ---------- + value: any + Clustering algorithm value. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'lloyd' ) + + > out = {{alias}}( {{alias:@stdlib/ml/base/cluster/kmeans/algorithm-str2enum}}( 'lloyd' ) ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts new file mode 100644 index 000000000000..606a4b64e9c2 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with a KMeans clustering algorithm value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. +* +* @param value - clustering algorithm value +* @returns enumeration constant +* +* @example +* var v = resolve( 'lloyd' ); +* // returns +*/ +declare function resolve( value: any ): number | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts new file mode 100644 index 000000000000..70a9aa2ce477 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + resolve( 0 ); // $ExpectType number | null + resolve( 'lloyd' ); // $ExpectType number | null +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js new file mode 100644 index 000000000000..95b5dedd82bb --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var resolve = require( './../lib' ); + +var v = resolve( 'lloyd' ); +console.log( v ); +// => + +v = resolve( 'elkan' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js new file mode 100644 index 000000000000..6b4c09fa1a94 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with a supported KMeans clustering algorithm value. +* +* @module @stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum +* +* @example +* var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum' ); +* +* var v = resolve( 'lloyd' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js new file mode 100644 index 000000000000..39c50bbb7aa6 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); + + +// MAIN // + +/** +* Returns the enumeration constant associated with a supported KMeans clustering algorithm value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. +* +* @param {*} value - clustering algorithm value +* @returns {(integer|null)} enumeration constant or null +* +* @example +* var v = resolve( 'lloyd' ); +* // returns +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'number' ) { + return ( enum2str( value ) ) ? value : null; + } + if ( t === 'string' ) { + return str2enum( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json new file mode 100644 index 000000000000..91ec718753bd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with a supported KMeans clustering algorithm value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "cluster", + "kmeans", + "algorithm", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js new file mode 100644 index 000000000000..7a427e136cd4 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'lloyd', + 'elkan' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with a KMeans clustering algorithm value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); + t.strictEqual( resolve( v ), v, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md new file mode 100644 index 000000000000..0bb25a94936e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md @@ -0,0 +1,121 @@ + + +# resolve + +> Return the clustering algorithm string associated with a supported KMeans clustering algorithm value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str' ); +``` + +#### resolve( value ) + +Returns the clustering algorithm string associated with a KMeans clustering algorithm value. + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); + +var v = resolve( 'elkan' ); +// returns 'elkan' + +v = resolve( str2enum( 'elkan' ) ); +// returns 'elkan' +``` + +If unable to resolve a KMeans clustering algorithm string, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str' ); + +var v = resolve( str2enum( 'elkan' ) ); +// returns 'elkan' + +v = resolve( str2enum( 'lloyd' ) ); +// returns 'lloyd' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js new file mode 100644 index 000000000000..3234b82def6a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'lloyd', + 'elkan' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'lloyd' ), + str2enum( 'elkan' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt new file mode 100644 index 000000000000..22afaad9c03f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( value ) + Returns the clustering algorithm string associated with a supported KMeans + clustering algorithm value. + + Parameters + ---------- + value: any + Clustering algorithm value. + + Returns + ------- + out: string|null + Clustering algorithm string. + + Examples + -------- + > var out = {{alias}}( 'elkan' ) + 'elkan' + > out = {{alias}}( {{alias:@stdlib/ml/base/cluster/kmeans/algorithm-str2enum}}( 'elkan' ) ) + 'elkan' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts new file mode 100644 index 000000000000..807810680e9d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts @@ -0,0 +1,38 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the clustering algorithm string associated with a KMeans clustering algorithm value. +* +* @param value - clustering algorithm value +* @returns clustering algorithm string +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* +* var v = resolve( str2enum( 'elkan' ) ); +* // returns 'elkan' +*/ +declare function resolve( value: any ): string | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts new file mode 100644 index 000000000000..84fea09b087f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + resolve( 0 ); // $ExpectType string | null + resolve( 'elkan' ); // $ExpectType string | null +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js new file mode 100644 index 000000000000..37cef4a66794 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var resolve = require( './../lib' ); + +var v = resolve( str2enum( 'elkan' ) ); +console.log( v ); +// => 'elkan' + +v = resolve( str2enum( 'lloyd' ) ); +console.log( v ); +// => 'lloyd' diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js new file mode 100644 index 000000000000..ed99666b577a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the clustering algorithm string associated with a supported KMeans clustering algorithm value. +* +* @module @stdlib/ml/base/cluster/kmeans/algorithm-resolve-str +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str' ); +* +* var v = resolve( str2enum( 'elkan' ) ); +* // returns 'elkan' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js new file mode 100644 index 000000000000..d990f047d3a7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); + + +// MAIN // + +/** +* Returns the clustering algorithm string associated with a supported KMeans clustering algorithm value. +* +* @param {*} value - clustering algorithm value +* @returns {(string|null)} clustering algorithm string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* +* var v = resolve( str2enum( 'elkan' ) ); +* // returns 'elkan' +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'string' ) { + return ( str2enum( value ) === null ) ? null : value; + } + if ( t === 'number' ) { + return enum2str( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json new file mode 100644 index 000000000000..ecb61af282c1 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str", + "version": "0.0.0", + "description": "Return the clustering algorithm string associated with a supported KMeans clustering algorithm value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "cluster", + "kmeans", + "algorithm", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js new file mode 100644 index 000000000000..80649c7ccade --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'lloyd', + 'elkan' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with a KMeans clustering algorithm value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); + t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md new file mode 100644 index 000000000000..770ca03dee3e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md @@ -0,0 +1,119 @@ + + +# str2enum + +> Return the enumeration constant associated with a KMeans clustering algorithm string. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +``` + +#### str2enum( algorithms ) + +Returns the enumeration constant associated with a KMeans clustering algorithm string. + +```javascript +var v = str2enum( 'elkan' ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = str2enum( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); + +var v = str2enum( 'elkan' ); +// returns + +v = str2enum( 'lloyd' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js new file mode 100644 index 000000000000..9b7356a2a5a4 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var str2enum = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'elkan', + 'lloyd' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = str2enum( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt new file mode 100644 index 000000000000..52a5557d7fc8 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt @@ -0,0 +1,27 @@ + +{{alias}}( algorithms ) + Returns the enumeration constant associated with a KMeans clustering + algorithm string. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `LLOYD == 0`). Instead, the function should be used in an + opaque manner. + + Parameters + ---------- + algorithms: string + Clustering algorithm. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'elkan' ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts new file mode 100644 index 000000000000..ece940e29bc0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with a KMeans clustering algorithm string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. +* +* @param algorithms - clustering algorithm string +* @returns enumeration constant +* +* @example +* var v = str2enum( 'elkan' ); +* // returns +*/ +declare function str2enum( algorithms: string ): number | null; + + +// EXPORTS // + +export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts new file mode 100644 index 000000000000..ce603b6b7090 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import str2enum = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + str2enum( 'elkan' ); // $ExpectType number | null +} + +// The compiler throws an error if not provided a string... +{ + str2enum( 10 ); // $ExpectError + str2enum( true ); // $ExpectError + str2enum( false ); // $ExpectError + str2enum( null ); // $ExpectError + str2enum( undefined ); // $ExpectError + str2enum( [] ); // $ExpectError + str2enum( {} ); // $ExpectError + str2enum( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js new file mode 100644 index 000000000000..70ff04accc9f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( './../lib' ); + +var v = str2enum( 'elkan' ); +console.log( v ); +// => + +v = str2enum( 'lloyd' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js new file mode 100644 index 000000000000..a3de3abbb9d9 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with a KMeans clustering algorithm string. +* +* @module @stdlib/ml/base/cluster/kmeans/algorithm-str2enum +* +* @example +* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); +* +* var v = str2enum( 'elkan' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js new file mode 100644 index 000000000000..91239b247fa3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var enumeration = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ).enum; + + +// VARIABLES // + +var ENUM = enumeration(); + + +// MAIN // + +/** +* Returns the enumeration constant associated with a KMeans clustering algorithm string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. +* +* @param {string} algorithms - clustering algorithm string +* @returns {(integer|null)} integer value or null +* +* @example +* var v = str2enum( 'elkan' ); +* // returns +*/ +function str2enum( algorithms ) { + var v = ENUM[ algorithms ]; + return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json new file mode 100644 index 000000000000..52233c05440a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/ml/base/cluster/kmeans/algorithm-str2enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with a KMeans clustering algorithm string.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "cluster", + "kmeans", + "algorithm", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js new file mode 100644 index 000000000000..49863bfbd250 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); +var str2enum = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'elkan', + 'lloyd' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with a string', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar' + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md new file mode 100644 index 000000000000..0eecdf005729 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md @@ -0,0 +1,186 @@ + + +# Clustering Algorithms + +> KMeans clustering algorithms. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); +``` + +#### algorithms() + +Returns a list of KMeans clustering algorithms. + +```javascript +var out = algorithms(); +// e.g., returns [ 'lloyd', 'elkan' ] +``` + +The output array contains the following algorithms: + +- `lloyd`: classic EM-style algorithm. +- `elkan`: optimized algorithm using triangle inequality. + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); + +var isAlgorithm = contains( algorithms() ); + +var bool = isAlgorithm( 'lloyd' ); +// returns true + +bool = isAlgorithm( 'elkan' ); +// returns true + +bool = isAlgorithm( 'beep' ); +// returns false +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/ml/base/cluster/kmeans/algorithms.h" +``` + +#### STDLIB_ML_CLUSTER_KMEANS_ALGORITHM + +An enumeration of KMeans clustering algorithms with the following fields: + +- **STDLIB_ML_CLUSTER_KMEANS_LLOYD**: classic EM-style algorithm. +- **STDLIB_ML_CLUSTER_KMEANS_ELKAN**: optimized algorithm using triangle inequality. + +```c +#include "stdlib/ml/base/cluster/kmeans/algorithms.h" + +const enum STDLIB_ML_CLUSTER_KMEANS_ALGORITHM v = STDLIB_ML_CLUSTER_KMEANS_LLOYD; +``` + +
+ + + + + +
+ +### Notes + +- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. + +
+ + + + + +
+ +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/benchmark/benchmark.js new file mode 100644 index 000000000000..1c08c06dd2c3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var algorithms = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = algorithms(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt new file mode 100644 index 000000000000..57e347ab73ee --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt @@ -0,0 +1,22 @@ + +{{alias}}() + Returns a list of clustering algorithms. + + The output array contains the following algorithms: + + - lloyd: classic EM-style algorithm. + - elkan: optimized algorithm using triangle inequality. + + Returns + ------- + out: Array + List of algorithms. + + Examples + -------- + > var out = {{alias}}() + [ 'lloyd', 'elkan' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts new file mode 100644 index 000000000000..29ec2420b102 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of clustering algorithms. +* +* @returns list of clustering algorithms +* +* @example +* var list = algorithms(); +* // e.g., returns [ 'lloyd', 'elkan' ] +*/ +declare function algorithms(): Array; + + +// EXPORTS // + +export = algorithms; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/test.ts new file mode 100644 index 000000000000..d2c24ff02a3d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import algorithms = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + algorithms(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + algorithms( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js new file mode 100644 index 000000000000..346f224f9b00 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var algorithms = require( './../lib' ); + +var isAlternative = contains( algorithms() ); + +var bool = isAlternative( 'lloyd' ); +console.log( bool ); +// => true + +bool = isAlternative( 'elkan' ); +console.log( bool ); +// => true + +bool = isAlternative( 'beep' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h new file mode 100644 index 000000000000..497b1fba3979 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H +#define STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H + +/** +* Enumeration of clustering algorithms. +*/ +enum STDLIB_ML_CLUSTER_KMEANS_ALGORITHMS { + // Classic EM-style algorithm: + STDLIB_ML_CLUSTER_KMEANS_LLOYD = 0, + + // Optimized algorithm using triangle inequality: + STDLIB_ML_CLUSTER_KMEANS_ELKAN, +}; + +#endif // !STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/data.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/data.json new file mode 100644 index 000000000000..a29165499031 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/data.json @@ -0,0 +1,4 @@ +[ + "lloyd", + "elkan" +] diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js new file mode 100644 index 000000000000..68157ba33663 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns an object mapping supported algorithms to integer values for purposes of C inter-operation. +* +* ## Notes +* +* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the object should be used in an opaque manner. +* - The main purpose of this function is JavaScript and C inter-operation. +* +* @returns {Object} object mapping supported algorithms to integer values +* +* @example +* var table = enumerated(); +* // returns +*/ +function enumerated() { + // NOTE: the following should match the C `algorithms.h` enumeration!!!! + return { + // Classic EM-style algorithm: + 'lloyd': 0, + + // Optimized algorithm using triangle inequality: + 'elkan': 1 + }; +} + + +// EXPORTS // + +module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js new file mode 100644 index 000000000000..96023c90d007 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of KMeans clustering algorithms. +* +* @module @stdlib/ml/base/cluster/kmeans/algorithms +* +* @example +* var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); +* +* var list = algorithms(); +* // e.g., returns [ 'lloyd', 'elkan' ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var enumeration = require( './enum.js' ); + + +// MAIN // + +setReadOnly( main, 'enum', enumeration ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js new file mode 100644 index 000000000000..aad9cd45c3c0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of KMeans clustering algorithms. +* +* @returns {StringArray} list of clustering algorithms +* +* @example +* var list = algorithms(); +* // e.g., returns [ 'lloyd', 'elkan' ] +*/ +function algorithms() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = algorithms; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/manifest.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/manifest.json @@ -0,0 +1,36 @@ +{ + "options": {}, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "src": [], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [] + } + ] +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json new file mode 100644 index 000000000000..b4f34385b3dd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json @@ -0,0 +1,67 @@ +{ + "name": "@stdlib/ml/base/cluster/kmeans/algorithms", + "version": "0.0.0", + "description": "KMeans clustering algorithms.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "cluster", + "kmeans", + "algorithms", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js new file mode 100644 index 000000000000..66ef5f471229 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js @@ -0,0 +1,73 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var algorithms = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof algorithms, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of algorithms', function test( t ) { + var expected; + var actual; + + expected = [ + 'lloyd', + 'elkan' + ]; + actual = algorithms(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main function is an `enum` method to return an object mapping algorithms to integer values for C inter-operation', function test( t ) { + var obj; + var o; + var i; + + t.strictEqual( hasOwnProp( algorithms, 'enum' ), true, 'has property' ); + t.strictEqual( typeof algorithms.enum, 'function', 'has method' ); + + obj = algorithms.enum(); + t.strictEqual( typeof obj, 'object', 'returns expected value type' ); + + // List of values which should be supported... + o = [ + 'lloyd', + 'elkan' + ]; + for ( i = 0; i < o.length; i++ ) { + t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); + t.strictEqual( isNonNegativeInteger( obj[ o[i] ] ), true, 'returns expected value' ); + } + + t.end(); +}); From 7ebe84baa41eeb0bfa7400e1bd9687c4bf2970f9 Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Wed, 6 May 2026 13:36:20 +0530 Subject: [PATCH 2/7] remove: remove all supporting packages --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../kmeans/algorithm-enum2str/README.md | 121 ----------------- .../algorithm-enum2str/benchmark/benchmark.js | 55 -------- .../kmeans/algorithm-enum2str/docs/repl.txt | 23 ---- .../algorithm-enum2str/docs/types/index.d.ts | 41 ------ .../algorithm-enum2str/docs/types/test.ts | 39 ------ .../algorithm-enum2str/examples/index.js | 30 ----- .../kmeans/algorithm-enum2str/lib/index.js | 44 ------- .../kmeans/algorithm-enum2str/lib/main.js | 60 --------- .../kmeans/algorithm-enum2str/package.json | 66 ---------- .../kmeans/algorithm-enum2str/test/test.js | 65 --------- .../kmeans/algorithm-resolve-enum/README.md | 124 ------------------ .../benchmark/benchmark.js | 81 ------------ .../algorithm-resolve-enum/docs/repl.txt | 29 ---- .../docs/types/index.d.ts | 40 ------ .../algorithm-resolve-enum/docs/types/test.ts | 28 ---- .../algorithm-resolve-enum/examples/index.js | 29 ---- .../algorithm-resolve-enum/lib/index.js | 40 ------ .../kmeans/algorithm-resolve-enum/lib/main.js | 57 -------- .../algorithm-resolve-enum/package.json | 66 ---------- .../algorithm-resolve-enum/test/test.js | 74 ----------- .../kmeans/algorithm-resolve-str/README.md | 121 ----------------- .../benchmark/benchmark.js | 81 ------------ .../algorithm-resolve-str/docs/repl.txt | 25 ---- .../docs/types/index.d.ts | 38 ------ .../algorithm-resolve-str/docs/types/test.ts | 28 ---- .../algorithm-resolve-str/examples/index.js | 30 ----- .../kmeans/algorithm-resolve-str/lib/index.js | 41 ------ .../kmeans/algorithm-resolve-str/lib/main.js | 55 -------- .../kmeans/algorithm-resolve-str/package.json | 66 ---------- .../kmeans/algorithm-resolve-str/test/test.js | 74 ----------- .../kmeans/algorithm-str2enum/README.md | 119 ----------------- .../algorithm-str2enum/benchmark/benchmark.js | 54 -------- .../kmeans/algorithm-str2enum/docs/repl.txt | 27 ---- .../algorithm-str2enum/docs/types/index.d.ts | 40 ------ .../algorithm-str2enum/docs/types/test.ts | 39 ------ .../algorithm-str2enum/examples/index.js | 29 ---- .../kmeans/algorithm-str2enum/lib/index.js | 40 ------ .../kmeans/algorithm-str2enum/lib/main.js | 56 -------- .../kmeans/algorithm-str2enum/package.json | 66 ---------- .../kmeans/algorithm-str2enum/test/test.js | 66 ---------- 40 files changed, 2207 deletions(-) delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md deleted file mode 100644 index 9695974bd6dd..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# enum2str - -> Return the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); -``` - -#### enum2str( value ) - -Returns the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); - -var v = str2enum( 'lloyd' ); -// returns - -var s = enum2str( v ); -// returns 'lloyd' -``` - -If unable to resolve a KMeans clustering algorithm string, the function returns `null`. - -```javascript -var v = enum2str( -999999999 ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); - -var str = enum2str( str2enum( 'lloyd' ) ); -// returns 'lloyd' - -str = enum2str( str2enum( 'elkan' ) ); -// returns 'elkan' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js deleted file mode 100644 index df439bd396f0..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var pkg = require( './../package.json' ).name; -var enum2str = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'lloyd' ), - str2enum( 'elkan' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = enum2str( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt deleted file mode 100644 index d690d2aeccc2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( value ) - Returns the KMeans clustering algorithm string associated with a KMeans - clustering algorithm enumeration constant. - - Parameters - ---------- - value: integer - Clustering algorithm enumeration constant. - - Returns - ------- - out: string|null - Clustering algorithm string. - - Examples - -------- - > var out = {{alias}}( {{alias:@stdlib/ml/base/cluster/kmeans/algorithm-str2enum}}( 'lloyd' ) ) - 'lloyd' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts deleted file mode 100644 index 2a49201baa3e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. -* -* @param value - enumeration constant -* @returns clustering algorithm string -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* -* var v = str2enum( 'lloyd' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'lloyd' -*/ -declare function enum2str( value: number ): string | null; - - -// EXPORTS // - -export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts deleted file mode 100644 index fe80992105ef..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import enum2str = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - enum2str( 0 ); // $ExpectType string | null -} - -// The compiler throws an error if not provided a number... -{ - enum2str( '10' ); // $ExpectError - enum2str( true ); // $ExpectError - enum2str( false ); // $ExpectError - enum2str( null ); // $ExpectError - enum2str( undefined ); // $ExpectError - enum2str( [] ); // $ExpectError - enum2str( {} ); // $ExpectError - enum2str( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js deleted file mode 100644 index b3db3661c12a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var enum2str = require( './../lib' ); - -var str = enum2str( str2enum( 'elkan' ) ); -console.log( str ); -// => 'elkan' - -str = enum2str( str2enum( 'lloyd' ) ); -console.log( str ); -// => 'lloyd' diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js deleted file mode 100644 index 68fb98fd1aea..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. -* -* @module @stdlib/ml/base/cluster/kmeans/algorithm-enum2str -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); -* -* var v = str2enum( 'lloyd' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'lloyd' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js deleted file mode 100644 index 3b4d10b8e3c7..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/lib/main.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var objectInverse = require( '@stdlib/object/inverse' ); -var enumeration = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ).enum; - - -// VARIABLES // - -var hash = objectInverse( enumeration(), { - 'duplicates': false -}); - - -// MAIN // - -/** -* Returns the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant. -* -* @param {integer} value - clustering algorithm enumeration constant -* @returns {(string|null)} clustering algorithm string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* -* var v = str2enum( 'lloyd' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'lloyd' -*/ -function enum2str( value ) { - var v = hash[ value ]; - return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json deleted file mode 100644 index f86e908733ef..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/ml/base/cluster/kmeans/algorithm-enum2str", - "version": "0.0.0", - "description": "Return the KMeans clustering algorithm string associated with a KMeans clustering algorithm enumeration constant.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "cluster", - "kmeans", - "algorithm", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js deleted file mode 100644 index 5a13af0af6b5..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-enum2str/test/test.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var enum2str = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'lloyd', - 'elkan' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an enumeration constant', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - -9999999, - -999999999, - -99999999999 - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md deleted file mode 100644 index 0fd2b5b23cc7..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/README.md +++ /dev/null @@ -1,124 +0,0 @@ - - -# resolve - -> Return the enumeration constant associated with a supported KMeans clustering algorithm value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum' ); -``` - -#### resolve( value ) - -Returns the enumeration constant associated with a KMeans clustering algorithm value. - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); - -var v = resolve( 'lloyd' ); -// returns - -v = resolve( str2enum( 'elkan' ) ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum' ); - -var v = resolve( 'lloyd' ); -// returns - -v = resolve( 'elkan' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js deleted file mode 100644 index dd9731209440..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/benchmark/benchmark.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'lloyd', - 'elkan' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'lloyd' ), - str2enum( 'elkan' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt deleted file mode 100644 index c56f89b21327..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( value ) - Returns the enumeration constant associated with a supported KMeans - clustering algorithm value. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `LLOYD == 0`). Instead, the function should be used in an - opaque manner. - - Parameters - ---------- - value: any - Clustering algorithm value. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'lloyd' ) - - > out = {{alias}}( {{alias:@stdlib/ml/base/cluster/kmeans/algorithm-str2enum}}( 'lloyd' ) ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts deleted file mode 100644 index 606a4b64e9c2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with a KMeans clustering algorithm value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. -* -* @param value - clustering algorithm value -* @returns enumeration constant -* -* @example -* var v = resolve( 'lloyd' ); -* // returns -*/ -declare function resolve( value: any ): number | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts deleted file mode 100644 index 70a9aa2ce477..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - resolve( 0 ); // $ExpectType number | null - resolve( 'lloyd' ); // $ExpectType number | null -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js deleted file mode 100644 index 95b5dedd82bb..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var resolve = require( './../lib' ); - -var v = resolve( 'lloyd' ); -console.log( v ); -// => - -v = resolve( 'elkan' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js deleted file mode 100644 index 6b4c09fa1a94..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with a supported KMeans clustering algorithm value. -* -* @module @stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum -* -* @example -* var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum' ); -* -* var v = resolve( 'lloyd' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js deleted file mode 100644 index 39c50bbb7aa6..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/lib/main.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); - - -// MAIN // - -/** -* Returns the enumeration constant associated with a supported KMeans clustering algorithm value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. -* -* @param {*} value - clustering algorithm value -* @returns {(integer|null)} enumeration constant or null -* -* @example -* var v = resolve( 'lloyd' ); -* // returns -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'number' ) { - return ( enum2str( value ) ) ? value : null; - } - if ( t === 'string' ) { - return str2enum( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json deleted file mode 100644 index 91ec718753bd..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with a supported KMeans clustering algorithm value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "cluster", - "kmeans", - "algorithm", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js deleted file mode 100644 index 7a427e136cd4..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-enum/test/test.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'lloyd', - 'elkan' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with a KMeans clustering algorithm value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); - t.strictEqual( resolve( v ), v, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md deleted file mode 100644 index 0bb25a94936e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# resolve - -> Return the clustering algorithm string associated with a supported KMeans clustering algorithm value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str' ); -``` - -#### resolve( value ) - -Returns the clustering algorithm string associated with a KMeans clustering algorithm value. - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); - -var v = resolve( 'elkan' ); -// returns 'elkan' - -v = resolve( str2enum( 'elkan' ) ); -// returns 'elkan' -``` - -If unable to resolve a KMeans clustering algorithm string, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str' ); - -var v = resolve( str2enum( 'elkan' ) ); -// returns 'elkan' - -v = resolve( str2enum( 'lloyd' ) ); -// returns 'lloyd' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js deleted file mode 100644 index 3234b82def6a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/benchmark/benchmark.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'lloyd', - 'elkan' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'lloyd' ), - str2enum( 'elkan' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt deleted file mode 100644 index 22afaad9c03f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/repl.txt +++ /dev/null @@ -1,25 +0,0 @@ - -{{alias}}( value ) - Returns the clustering algorithm string associated with a supported KMeans - clustering algorithm value. - - Parameters - ---------- - value: any - Clustering algorithm value. - - Returns - ------- - out: string|null - Clustering algorithm string. - - Examples - -------- - > var out = {{alias}}( 'elkan' ) - 'elkan' - > out = {{alias}}( {{alias:@stdlib/ml/base/cluster/kmeans/algorithm-str2enum}}( 'elkan' ) ) - 'elkan' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts deleted file mode 100644 index 807810680e9d..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the clustering algorithm string associated with a KMeans clustering algorithm value. -* -* @param value - clustering algorithm value -* @returns clustering algorithm string -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* -* var v = resolve( str2enum( 'elkan' ) ); -* // returns 'elkan' -*/ -declare function resolve( value: any ): string | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts deleted file mode 100644 index 84fea09b087f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - resolve( 0 ); // $ExpectType string | null - resolve( 'elkan' ); // $ExpectType string | null -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js deleted file mode 100644 index 37cef4a66794..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var resolve = require( './../lib' ); - -var v = resolve( str2enum( 'elkan' ) ); -console.log( v ); -// => 'elkan' - -v = resolve( str2enum( 'lloyd' ) ); -console.log( v ); -// => 'lloyd' diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js deleted file mode 100644 index ed99666b577a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the clustering algorithm string associated with a supported KMeans clustering algorithm value. -* -* @module @stdlib/ml/base/cluster/kmeans/algorithm-resolve-str -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* var resolve = require( '@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str' ); -* -* var v = resolve( str2enum( 'elkan' ) ); -* // returns 'elkan' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js deleted file mode 100644 index d990f047d3a7..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/lib/main.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); - - -// MAIN // - -/** -* Returns the clustering algorithm string associated with a supported KMeans clustering algorithm value. -* -* @param {*} value - clustering algorithm value -* @returns {(string|null)} clustering algorithm string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* -* var v = resolve( str2enum( 'elkan' ) ); -* // returns 'elkan' -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'string' ) { - return ( str2enum( value ) === null ) ? null : value; - } - if ( t === 'number' ) { - return enum2str( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json deleted file mode 100644 index ecb61af282c1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str", - "version": "0.0.0", - "description": "Return the clustering algorithm string associated with a supported KMeans clustering algorithm value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "cluster", - "kmeans", - "algorithm", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js deleted file mode 100644 index 80649c7ccade..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-resolve-str/test/test.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'lloyd', - 'elkan' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with a KMeans clustering algorithm value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); - t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md deleted file mode 100644 index 770ca03dee3e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/README.md +++ /dev/null @@ -1,119 +0,0 @@ - - -# str2enum - -> Return the enumeration constant associated with a KMeans clustering algorithm string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -``` - -#### str2enum( algorithms ) - -Returns the enumeration constant associated with a KMeans clustering algorithm string. - -```javascript -var v = str2enum( 'elkan' ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = str2enum( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); - -var v = str2enum( 'elkan' ); -// returns - -v = str2enum( 'lloyd' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js deleted file mode 100644 index 9b7356a2a5a4..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/benchmark/benchmark.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var str2enum = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'elkan', - 'lloyd' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str2enum( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt deleted file mode 100644 index 52a5557d7fc8..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( algorithms ) - Returns the enumeration constant associated with a KMeans clustering - algorithm string. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `LLOYD == 0`). Instead, the function should be used in an - opaque manner. - - Parameters - ---------- - algorithms: string - Clustering algorithm. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'elkan' ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts deleted file mode 100644 index ece940e29bc0..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with a KMeans clustering algorithm string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. -* -* @param algorithms - clustering algorithm string -* @returns enumeration constant -* -* @example -* var v = str2enum( 'elkan' ); -* // returns -*/ -declare function str2enum( algorithms: string ): number | null; - - -// EXPORTS // - -export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts deleted file mode 100644 index ce603b6b7090..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import str2enum = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - str2enum( 'elkan' ); // $ExpectType number | null -} - -// The compiler throws an error if not provided a string... -{ - str2enum( 10 ); // $ExpectError - str2enum( true ); // $ExpectError - str2enum( false ); // $ExpectError - str2enum( null ); // $ExpectError - str2enum( undefined ); // $ExpectError - str2enum( [] ); // $ExpectError - str2enum( {} ); // $ExpectError - str2enum( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js deleted file mode 100644 index 70ff04accc9f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( './../lib' ); - -var v = str2enum( 'elkan' ); -console.log( v ); -// => - -v = str2enum( 'lloyd' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js deleted file mode 100644 index a3de3abbb9d9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with a KMeans clustering algorithm string. -* -* @module @stdlib/ml/base/cluster/kmeans/algorithm-str2enum -* -* @example -* var str2enum = require( '@stdlib/ml/base/cluster/kmeans/algorithm-str2enum' ); -* -* var v = str2enum( 'elkan' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js deleted file mode 100644 index 91239b247fa3..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/lib/main.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var enumeration = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ).enum; - - -// VARIABLES // - -var ENUM = enumeration(); - - -// MAIN // - -/** -* Returns the enumeration constant associated with a KMeans clustering algorithm string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `LLOYD == 0`). Instead, the function should be used in an opaque manner. -* -* @param {string} algorithms - clustering algorithm string -* @returns {(integer|null)} integer value or null -* -* @example -* var v = str2enum( 'elkan' ); -* // returns -*/ -function str2enum( algorithms ) { - var v = ENUM[ algorithms ]; - return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json deleted file mode 100644 index 52233c05440a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/ml/base/cluster/kmeans/algorithm-str2enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with a KMeans clustering algorithm string.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "cluster", - "kmeans", - "algorithm", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js deleted file mode 100644 index 49863bfbd250..000000000000 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithm-str2enum/test/test.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var enum2str = require( '@stdlib/ml/base/cluster/kmeans/algorithm-enum2str' ); -var str2enum = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'elkan', - 'lloyd' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with a string', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); From 7b6ec9eb3bcd856c73bf52c43fde34606800a064 Mon Sep 17 00:00:00 2001 From: Nakul Krishnakumar Date: Wed, 6 May 2026 13:41:38 +0530 Subject: [PATCH 3/7] chore: update according to code review Co-authored-by: Nakul Krishnakumar Signed-off-by: Nakul Krishnakumar --- .../@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt | 2 +- .../include/stdlib/ml/cluster/base/kmeans/algorithms.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt index 57e347ab73ee..213fd8330820 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}() - Returns a list of clustering algorithms. + Returns a list of kmeans clustering algorithms. The output array contains the following algorithms: diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h index 497b1fba3979..ba137c7d313e 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h @@ -20,7 +20,7 @@ #define STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H /** -* Enumeration of clustering algorithms. +* Enumeration of kmeans clustering algorithms. */ enum STDLIB_ML_CLUSTER_KMEANS_ALGORITHMS { // Classic EM-style algorithm: From 8bec0e0101a9de1409c3b1e2d866106e44d02fc5 Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Wed, 6 May 2026 13:44:57 +0530 Subject: [PATCH 4/7] chore: update according to code eview --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/ml/base/cluster/kmeans/algorithms/README.md | 8 ++++---- .../ml/{cluster/base => base/cluster}/kmeans/algorithms.h | 6 +++--- .../@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js | 2 +- .../ml/base/cluster/kmeans/algorithms/test/test.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) rename lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/{cluster/base => base/cluster}/kmeans/algorithms.h (89%) diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md index 0eecdf005729..c527aa877855 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md @@ -120,17 +120,17 @@ bool = isAlgorithm( 'beep' ); #include "stdlib/ml/base/cluster/kmeans/algorithms.h" ``` -#### STDLIB_ML_CLUSTER_KMEANS_ALGORITHM +#### STDLIB_ML_KMEANS_ALGORITHM An enumeration of KMeans clustering algorithms with the following fields: -- **STDLIB_ML_CLUSTER_KMEANS_LLOYD**: classic EM-style algorithm. -- **STDLIB_ML_CLUSTER_KMEANS_ELKAN**: optimized algorithm using triangle inequality. +- **STDLIB_ML_KMEANS_LLOYD**: classic EM-style algorithm. +- **STDLIB_ML_KMEANS_ELKAN**: optimized algorithm using triangle inequality. ```c #include "stdlib/ml/base/cluster/kmeans/algorithms.h" -const enum STDLIB_ML_CLUSTER_KMEANS_ALGORITHM v = STDLIB_ML_CLUSTER_KMEANS_LLOYD; +const enum STDLIB_ML_KMEANS_ALGORITHM v = STDLIB_ML_KMEANS_LLOYD; ``` diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h similarity index 89% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h rename to lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h index ba137c7d313e..fa82f3f9bd32 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/cluster/base/kmeans/algorithms.h +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h @@ -22,12 +22,12 @@ /** * Enumeration of kmeans clustering algorithms. */ -enum STDLIB_ML_CLUSTER_KMEANS_ALGORITHMS { +enum STDLIB_ML_KMEANS_ALGORITHMS { // Classic EM-style algorithm: - STDLIB_ML_CLUSTER_KMEANS_LLOYD = 0, + STDLIB_ML_KMEANS_LLOYD = 0, // Optimized algorithm using triangle inequality: - STDLIB_ML_CLUSTER_KMEANS_ELKAN, + STDLIB_ML_KMEANS_ELKAN, }; #endif // !STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js index 68157ba33663..604204d7735f 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js @@ -21,7 +21,7 @@ // MAIN // /** -* Returns an object mapping supported algorithms to integer values for purposes of C inter-operation. +* Returns an object mapping supported KMeans clustering algorithms to integer values for purposes of C inter-operation. * * ## Notes * diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js index 66ef5f471229..5fa189ef27f1 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js @@ -34,7 +34,7 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function returns a list of algorithms', function test( t ) { +tape( 'the function returns a list of kmeans clustering algorithms', function test( t ) { var expected; var actual; From 862392a13d6b63e53320393178c780b44f377e30 Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Wed, 6 May 2026 22:35:33 +0530 Subject: [PATCH 5/7] chore: update according to code review --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/ml/base/cluster/kmeans/algorithms/README.md | 6 +++--- .../ml/base/cluster/kmeans/algorithms/docs/repl.txt | 2 +- .../base/cluster/kmeans/algorithms/docs/types/index.d.ts | 2 +- .../ml/base/cluster/kmeans/algorithms/examples/index.js | 8 ++++---- .../include/stdlib/ml/base/cluster/kmeans/algorithms.h | 2 +- .../@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js | 2 +- .../ml/base/cluster/kmeans/algorithms/lib/index.js | 2 +- .../@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js | 4 ++-- .../ml/base/cluster/kmeans/algorithms/package.json | 2 +- .../ml/base/cluster/kmeans/algorithms/test/test.js | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md index c527aa877855..9f809fd314ec 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md @@ -20,7 +20,7 @@ limitations under the License. # Clustering Algorithms -> KMeans clustering algorithms. +> k-means clustering algorithms. @@ -42,7 +42,7 @@ var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); #### algorithms() -Returns a list of KMeans clustering algorithms. +Returns a list of k-means clustering algorithms. ```javascript var out = algorithms(); @@ -122,7 +122,7 @@ bool = isAlgorithm( 'beep' ); #### STDLIB_ML_KMEANS_ALGORITHM -An enumeration of KMeans clustering algorithms with the following fields: +An enumeration of k-means clustering algorithms with the following fields: - **STDLIB_ML_KMEANS_LLOYD**: classic EM-style algorithm. - **STDLIB_ML_KMEANS_ELKAN**: optimized algorithm using triangle inequality. diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt index 213fd8330820..a99709a2362b 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}() - Returns a list of kmeans clustering algorithms. + Returns a list of k-means clustering algorithms. The output array contains the following algorithms: diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts index 29ec2420b102..2b65c44d01c1 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts @@ -19,7 +19,7 @@ // TypeScript Version: 4.1 /** -* Returns a list of clustering algorithms. +* Returns a list of k-means clustering algorithms. * * @returns list of clustering algorithms * diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js index 346f224f9b00..dab64b6c583b 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js @@ -21,16 +21,16 @@ var contains = require( '@stdlib/array/base/assert/contains' ).factory; var algorithms = require( './../lib' ); -var isAlternative = contains( algorithms() ); +var isAlgorithm = contains( algorithms() ); -var bool = isAlternative( 'lloyd' ); +var bool = isAlgorithm( 'lloyd' ); console.log( bool ); // => true -bool = isAlternative( 'elkan' ); +bool = isAlgorithm( 'elkan' ); console.log( bool ); // => true -bool = isAlternative( 'beep' ); +bool = isAlgorithm( 'beep' ); console.log( bool ); // => false diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h index fa82f3f9bd32..4984cb2d82d7 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h @@ -20,7 +20,7 @@ #define STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H /** -* Enumeration of kmeans clustering algorithms. +* Enumeration of k-means clustering algorithms. */ enum STDLIB_ML_KMEANS_ALGORITHMS { // Classic EM-style algorithm: diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js index 604204d7735f..68157ba33663 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js @@ -21,7 +21,7 @@ // MAIN // /** -* Returns an object mapping supported KMeans clustering algorithms to integer values for purposes of C inter-operation. +* Returns an object mapping supported algorithms to integer values for purposes of C inter-operation. * * ## Notes * diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js index 96023c90d007..cacd938af163 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Return a list of KMeans clustering algorithms. +* Return a list of k-means clustering algorithms. * * @module @stdlib/ml/base/cluster/kmeans/algorithms * diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js index aad9cd45c3c0..7781e9820a63 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js @@ -26,9 +26,9 @@ var DATA = require( './data.json' ); // MAIN // /** -* Returns a list of KMeans clustering algorithms. +* Returns a list of k-means clustering algorithms. * -* @returns {StringArray} list of clustering algorithms +* @returns {Array} list of clustering algorithms * * @example * var list = algorithms(); diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json index b4f34385b3dd..3bc1ff0241c0 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/ml/base/cluster/kmeans/algorithms", "version": "0.0.0", - "description": "KMeans clustering algorithms.", + "description": "k-means clustering algorithms.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js index 5fa189ef27f1..4609593a9398 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js +++ b/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js @@ -34,7 +34,7 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function returns a list of kmeans clustering algorithms', function test( t ) { +tape( 'the function returns a list of k-means clustering algorithms', function test( t ) { var expected; var actual; From 06d21820d09938d904d25986644f6cf84f5697ce Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Thu, 7 May 2026 11:34:13 +0530 Subject: [PATCH 6/7] refactor!: migrate `ml/base/cluster/kmeans/algorithms` to `ml/base/kmeans/algorithms` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../ml/base/{cluster => }/kmeans/algorithms/README.md | 8 ++++---- .../kmeans/algorithms/benchmark/benchmark.js | 0 .../ml/base/{cluster => }/kmeans/algorithms/docs/repl.txt | 0 .../{cluster => }/kmeans/algorithms/docs/types/index.d.ts | 0 .../{cluster => }/kmeans/algorithms/docs/types/test.ts | 0 .../{cluster => }/kmeans/algorithms/examples/index.js | 0 .../include/stdlib/ml/base}/kmeans/algorithms.h | 6 +++--- .../ml/base/{cluster => }/kmeans/algorithms/lib/data.json | 0 .../ml/base/{cluster => }/kmeans/algorithms/lib/enum.js | 0 .../ml/base/{cluster => }/kmeans/algorithms/lib/index.js | 4 ++-- .../ml/base/{cluster => }/kmeans/algorithms/lib/main.js | 0 .../ml/base/{cluster => }/kmeans/algorithms/manifest.json | 0 .../ml/base/{cluster => }/kmeans/algorithms/package.json | 2 +- .../ml/base/{cluster => }/kmeans/algorithms/test/test.js | 0 14 files changed, 10 insertions(+), 10 deletions(-) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/README.md (93%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/benchmark/benchmark.js (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/docs/repl.txt (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/docs/types/index.d.ts (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/docs/types/test.ts (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/examples/index.js (100%) rename lib/node_modules/@stdlib/ml/base/{cluster/kmeans/algorithms/include/stdlib/ml/base/cluster => kmeans/algorithms/include/stdlib/ml/base}/kmeans/algorithms.h (84%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/lib/data.json (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/lib/enum.js (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/lib/index.js (89%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/lib/main.js (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/manifest.json (100%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/package.json (95%) rename lib/node_modules/@stdlib/ml/base/{cluster => }/kmeans/algorithms/test/test.js (100%) diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/README.md similarity index 93% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/README.md index 9f809fd314ec..6b50984c6421 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/README.md +++ b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/README.md @@ -37,7 +37,7 @@ limitations under the License. ## Usage ```javascript -var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); +var algorithms = require( '@stdlib/ml/base/kmeans/algorithms' ); ``` #### algorithms() @@ -76,7 +76,7 @@ The output array contains the following algorithms: ```javascript var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); +var algorithms = require( '@stdlib/ml/base/kmeans/algorithms' ); var isAlgorithm = contains( algorithms() ); @@ -117,7 +117,7 @@ bool = isAlgorithm( 'beep' ); ### Usage ```c -#include "stdlib/ml/base/cluster/kmeans/algorithms.h" +#include "stdlib/ml/base/kmeans/algorithms.h" ``` #### STDLIB_ML_KMEANS_ALGORITHM @@ -128,7 +128,7 @@ An enumeration of k-means clustering algorithms with the following fields: - **STDLIB_ML_KMEANS_ELKAN**: optimized algorithm using triangle inequality. ```c -#include "stdlib/ml/base/cluster/kmeans/algorithms.h" +#include "stdlib/ml/base/kmeans/algorithms.h" const enum STDLIB_ML_KMEANS_ALGORITHM v = STDLIB_ML_KMEANS_LLOYD; ``` diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/benchmark/benchmark.js similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/benchmark/benchmark.js rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/docs/repl.txt similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/docs/repl.txt diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/docs/types/index.d.ts similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/index.d.ts rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/docs/types/index.d.ts diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/docs/types/test.ts similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/types/test.ts rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/examples/index.js similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/examples/index.js rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/examples/index.js diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/include/stdlib/ml/base/kmeans/algorithms.h similarity index 84% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/include/stdlib/ml/base/kmeans/algorithms.h index 4984cb2d82d7..ff5e6b8d7559 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/include/stdlib/ml/base/cluster/kmeans/algorithms.h +++ b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/include/stdlib/ml/base/kmeans/algorithms.h @@ -16,8 +16,8 @@ * limitations under the License. */ -#ifndef STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H -#define STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H +#ifndef STDLIB_ML_BASE_KMEANS_ALGORITHMS_H +#define STDLIB_ML_BASE_KMEANS_ALGORITHMS_H /** * Enumeration of k-means clustering algorithms. @@ -30,4 +30,4 @@ enum STDLIB_ML_KMEANS_ALGORITHMS { STDLIB_ML_KMEANS_ELKAN, }; -#endif // !STDLIB_ML_BASE_CLUSTER_KMEANS_ALGORITHMS_H +#endif // !STDLIB_ML_BASE_KMEANS_ALGORITHMS_H diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/data.json b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/data.json similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/data.json rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/data.json diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/enum.js similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/enum.js rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/enum.js diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/index.js similarity index 89% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/index.js index cacd938af163..cea7b8e47f9c 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/index.js +++ b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/index.js @@ -21,10 +21,10 @@ /** * Return a list of k-means clustering algorithms. * -* @module @stdlib/ml/base/cluster/kmeans/algorithms +* @module @stdlib/ml/base/kmeans/algorithms * * @example -* var algorithms = require( '@stdlib/ml/base/cluster/kmeans/algorithms' ); +* var algorithms = require( '@stdlib/ml/base/kmeans/algorithms' ); * * var list = algorithms(); * // e.g., returns [ 'lloyd', 'elkan' ] diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/lib/main.js rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/lib/main.js diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/manifest.json b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/manifest.json similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/manifest.json rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/manifest.json diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json similarity index 95% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json index 3bc1ff0241c0..7e1e0eee8e2f 100644 --- a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/package.json +++ b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json @@ -1,5 +1,5 @@ { - "name": "@stdlib/ml/base/cluster/kmeans/algorithms", + "name": "@stdlib/ml/base/kmeans/algorithms", "version": "0.0.0", "description": "k-means clustering algorithms.", "license": "Apache-2.0", diff --git a/lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/test/test.js similarity index 100% rename from lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/test/test.js rename to lib/node_modules/@stdlib/ml/base/kmeans/algorithms/test/test.js From 5f959eb451e7c0c4c9aadd53c743f62768a0032b Mon Sep 17 00:00:00 2001 From: Nakul Krishnakumar Date: Thu, 7 May 2026 13:34:09 +0530 Subject: [PATCH 7/7] chore: remove `cluster` from keywords Signed-off-by: Nakul Krishnakumar --- lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json index 7e1e0eee8e2f..fc90aeefa7d9 100644 --- a/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json +++ b/lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json @@ -54,7 +54,6 @@ "ml", "machine", "learning", - "cluster", "kmeans", "algorithms", "utilities",