diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/README.md b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/README.md
new file mode 100644
index 000000000000..7b08aa6c1c29
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/README.md
@@ -0,0 +1,210 @@
+
+
+# paramsFactory
+
+> Create a new constructor for creating an SGD trainer parameters object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var paramsFactory = require( '@stdlib/ml/base/sgd/params/factory' );
+```
+
+#### paramsFactory( dtype )
+
+Returns a new constructor for creating an SGD trainer parameters object.
+
+```javascript
+var Params = paramsFactory( 'float64' );
+// returns
+
+var r = new Params();
+// returns
+```
+
+The function supports the following parameters:
+
+- **dtype**: floating-point data type for storing floating-point parameters. Must be either `'float64'` or `'float32'`.
+
+A returned [`struct`][@stdlib/dstructs/struct] constructor supports the following fields:
+
+- **penalty**: [regularization function][@stdlib/ml/base/sgd/penalties].
+
+- **penaltyParams**: parameters specific to the regularization function being used. Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on `penalty`:
+
+ - **l1**: `[ lambda, 0.0 ]`
+ - **l2**: `[ lambda, 0.0 ]`
+ - **elasticnet**: `[ lambda, l1Ratio ]`
+ - **none**: `[ 0.0, 0.0 ]` (unused)
+
+ where
+
+ - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+
+- **learningRate**: [learning rate scheduler][@stdlib/ml/base/sgd/learning-rates].
+
+- **learningRateParams**: parameters specific to the learning rate scheduler being used. Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on `learningRate`:
+
+ - **basic**: `[ 0.0, 0.0 ]` (unused)
+ - **constant**: `[ eta0, 0.0 ]`
+ - **invscaling**: `[ eta0, powerT ]`
+ - **pegasos**: `[ lambda, 0.0 ]`
+
+ where
+
+ - **eta0**: initial learning rate.
+ - **powerT**: exponent controlling how quickly the learning rate decreases.
+ - **lambda**: regularization parameter.
+
+- **lossFunction**: [loss function][@stdlib/ml/base/sgd/loss-functions].
+
+- **lossFunctionParams**: parameters specific to the loss function being used. Must be an array having length `1`. The expected array contents depend on `lossFunction`:
+
+ - **epsilon-insensitive**: `[ epsilon ]`
+ - **squared-epsilon-insensitive**: `[ epsilon ]`
+ - **huber**: `[ threshold ]`
+ - all other loss functions: `[ 0.0 ]` (unused)
+
+ where
+
+ - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+
+- **fitIntercept**: boolean indicating whether to include an intercept. If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+
+- **intercept**: initial intercept value. Only applicable when `fitIntercept` is `true`.
+
+- **maxIter**: maximum number of iterations to run.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A parameters object is a [`struct`][@stdlib/dstructs/struct] providing a fixed-width composite data structure for storing SGD trainer parameters and providing an ABI-stable data layout for JavaScript-C interoperation.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+var Float32Array = require( '@stdlib/array/float32' );
+var paramsFactory = require( '@stdlib/ml/base/sgd/params/factory' );
+
+var Params = paramsFactory( 'float64' );
+var params = new Params({
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+var str = params.toString({
+ 'format': 'linear'
+});
+console.log( str );
+
+Params = paramsFactory( 'float32' );
+params = new Params({
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+str = params.toString({
+ 'format': 'linear'
+});
+console.log( str );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/dstructs/struct]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct
+
+[@stdlib/ml/base/sgd/penalties]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/penalties
+
+[@stdlib/ml/base/sgd/learning-rates]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/learning-rates
+
+[@stdlib/ml/base/sgd/loss-functions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/loss-functions
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/benchmark/benchmark.js
new file mode 100644
index 000000000000..61d8755d75b3
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/benchmark/benchmark.js
@@ -0,0 +1,106 @@
+/**
+* @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 isFunction = require( '@stdlib/assert/is-function' );
+var isObject = require( '@stdlib/assert/is-object' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var factory = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ 'float64',
+ 'float32'
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = factory( values[ i%values.length ] );
+ if ( typeof v !== 'function' ) {
+ b.fail( 'should return a function' );
+ }
+ }
+ b.toc();
+ if ( !isFunction( v ) ) {
+ b.fail( 'should return a function' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,new', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ factory( 'float64' ),
+ factory( 'float32' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = new ( values[ i%values.length ] )();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,no_new', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ factory( 'float64' ),
+ factory( 'float32' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = values[ i%values.length ]();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/repl.txt
new file mode 100644
index 000000000000..54686b2e7233
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/repl.txt
@@ -0,0 +1,24 @@
+
+{{alias}}( dtype )
+ Returns a constructor for creating an SGD trainer parameters object.
+
+ Parameters
+ ----------
+ dtype: string
+ Floating-point data type for storing floating-point parameters.
+
+ Returns
+ -------
+ fcn: Function
+ Constructor.
+
+ Examples
+ --------
+ > var P = {{alias}}( 'float64' );
+ > var p = new P();
+ > p.toString()
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/types/index.d.ts
new file mode 100644
index 000000000000..792192572d10
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/types/index.d.ts
@@ -0,0 +1,287 @@
+/*
+* @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
+
+/**
+* Regularization Function.
+*/
+type Penalty = 'elasticnet' | 'l1' | 'l2' | 'none';
+
+/**
+* Learning Rate Scheduler.
+*/
+type LearningRate = 'basic' | 'constant' | 'invscaling' | 'pegasos';
+
+/**
+* Loss Function.
+*/
+type LossFunction = 'epsilon-insensitive' | 'hinge' | 'huber' | 'log' | 'modified-huber' | 'perceptron' | 'squared-epsilon-insensitive' | 'squared-error' | 'squared-hinge';
+
+/**
+* Interface describing SGD trainer parameters.
+*/
+interface Params {
+ /**
+ * Parameters specific to the regularization function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the penalty:
+ *
+ * - **l1**: `[ lambda, 0.0 ]`
+ * - **l2**: `[ lambda, 0.0 ]`
+ * - **elasticnet**: `[ lambda, l1Ratio ]`
+ * - **none**: `[ 0.0, 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ * - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+ */
+ penaltyParams?: T;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the learning rate scheduler:
+ *
+ * - **basic**: `[ 0.0, 0.0 ]` (unused)
+ * - **constant**: `[ eta0, 0.0 ]`
+ * - **invscaling**: `[ eta0, powerT ]`
+ * - **pegasos**: `[ lambda, 0.0 ]`
+ *
+ * where:
+ *
+ * - **eta0**: initial learning rate.
+ * - **powerT**: exponent controlling how quickly the learning rate decreases.
+ * - **lambda**: regularization parameter.
+ */
+ learningRateParams?: T;
+
+ /**
+ * Parameters specific to the loss function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `1`. The expected array contents depend on the loss function:
+ *
+ * - **epsilon-insensitive**: `[ epsilon ]`
+ * - **squared-epsilon-insensitive**: `[ epsilon ]`
+ * - **huber**: `[ threshold ]`
+ * - all other loss functions: `[ 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ * - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+ */
+ lossFunctionParams?: T;
+
+ /**
+ * Initial intercept value.
+ *
+ * ## Notes
+ *
+ * - Only applicable when `fitIntercept` is `true`.
+ */
+ intercept?: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter?: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty?: Penalty;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate?: LearningRate;
+
+ /**
+ * Loss function.
+ */
+ lossFunction?: LossFunction;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ *
+ * ## Notes
+ *
+ * - If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+ */
+ fitIntercept?: boolean;
+}
+
+/**
+* Interface describing options when serializing an SGD trainer parameters object to a string.
+*/
+interface ToStringOptions {
+ /**
+ * Number of digits to display after decimal points. Default: `4`.
+ */
+ digits?: number;
+}
+
+/**
+* Interface describing an SGD trainer parameters data structure.
+*/
+declare class ParamsStruct {
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ constructor( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number );
+
+ /**
+ * Parameters specific to the regularization function being used.
+ */
+ penaltyParams: T;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ */
+ learningRateParams: T;
+
+ /**
+ * Parameters specific to the loss function being used.
+ */
+ lossFunctionParams: T;
+
+ /**
+ * Initial intercept value.
+ */
+ intercept: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty: Penalty;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate: LearningRate;
+
+ /**
+ * Loss function.
+ */
+ lossFunction: LossFunction;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ */
+ fitIntercept: boolean;
+
+ /**
+ * Serializes an SGD trainer parameters object as a formatted string.
+ *
+ * @param options - options object
+ * @returns serialized parameters
+ */
+ toString( options?: ToStringOptions ): string;
+
+ /**
+ * Serializes an SGD trainer parameters object as a JSON object.
+ *
+ * @returns serialized object
+ */
+ toJSON(): object;
+
+ /**
+ * Returns a DataView of an SGD trainer parameters object.
+ *
+ * @returns DataView
+ */
+ toDataView(): DataView;
+}
+
+/**
+* Interface defining an SGD trainer parameters constructor which is both "newable" and "callable".
+*/
+interface ParamsConstructor {
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ new( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number ): ParamsStruct;
+
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ ( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number ): ParamsStruct;
+}
+
+/**
+* Returns a new SGD trainer parameters constructor for creating an SGD trainer parameters object.
+*
+* @param dtype - floating-point data type for storing floating-point parameters
+* @returns parameters constructor
+*
+* @example
+* var Params = paramsFactory( 'float64' );
+* // returns
+*
+* var r = new Params();
+* // returns
+*/
+declare function paramsFactory( dtype: 'float64' ): ParamsConstructor;
+
+/**
+* Returns a constructor for creating an SGD trainer parameters object.
+*
+* @param dtype - floating-point data type for storing floating-point parameters
+* @returns parameters constructor
+*
+* @example
+* var Params = paramsFactory( 'float32' );
+* // returns
+*
+* var r = new Params();
+* // returns
+*/
+declare function paramsFactory( dtype: 'float32' ): ParamsConstructor;
+
+
+// EXPORTS //
+
+export = paramsFactory;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/types/test.ts
new file mode 100644
index 000000000000..6b9cf55139bc
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/docs/types/test.ts
@@ -0,0 +1,199 @@
+/*
+* @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 paramsFactory = require( './index' );
+
+
+// TESTS //
+
+// The function returns a function...
+{
+ paramsFactory( 'float64' ); // $ExpectType ParamsConstructor
+ paramsFactory( 'float32' ); // $ExpectType ParamsConstructor
+}
+
+// The compiler throws an error if not provided a supported data type...
+{
+ paramsFactory( 10 ); // $ExpectError
+ paramsFactory( true ); // $ExpectError
+ paramsFactory( false ); // $ExpectError
+ paramsFactory( null ); // $ExpectError
+ paramsFactory( undefined ); // $ExpectError
+ paramsFactory( [] ); // $ExpectError
+ paramsFactory( {} ); // $ExpectError
+ paramsFactory( ( x: number ): number => x ); // $ExpectError
+}
+
+// The function returns a function which returns a parameters object...
+{
+ const Params = paramsFactory( 'float64' );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = new Params( new ArrayBuffer( 80 ) ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = new Params( new ArrayBuffer( 80 ), 8 ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = new Params( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ParamsStruct
+}
+
+// The returned constructor can be invoked without `new`...
+{
+ const Params = paramsFactory( 'float64' );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = Params( new ArrayBuffer( 80 ) ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = Params( new ArrayBuffer( 80 ), 8 ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = Params( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ParamsStruct
+}
+
+// The parameters object has the expected properties (float64)...
+{
+ const Params = paramsFactory( 'float64' );
+ const r = new Params( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penaltyParams; // $ExpectType Float64Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRateParams; // $ExpectType Float64Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunctionParams; // $ExpectType Float64Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.intercept; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.maxIter; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penalty; // $ExpectType Penalty
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRate; // $ExpectType LearningRate
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunction; // $ExpectType LossFunction
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.fitIntercept; // $ExpectType boolean
+}
+
+// The parameters object has the expected properties (float32)...
+{
+ const Params = paramsFactory( 'float32' );
+ const r = new Params( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penaltyParams; // $ExpectType Float32Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRateParams; // $ExpectType Float32Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunctionParams; // $ExpectType Float32Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.intercept; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.maxIter; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penalty; // $ExpectType Penalty
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRate; // $ExpectType LearningRate
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunction; // $ExpectType LossFunction
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.fitIntercept; // $ExpectType boolean
+}
+
+// The compiler throws an error if the constructor is provided a first argument which is not an ArrayBuffer or object...
+{
+ const Params = paramsFactory( 'float64' );
+
+ new Params( 'abc' ); // $ExpectError
+ new Params( 123 ); // $ExpectError
+ new Params( true ); // $ExpectError
+ new Params( false ); // $ExpectError
+ new Params( null ); // $ExpectError
+ new Params( [] ); // $ExpectError
+ new Params( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a second argument which is not a number...
+{
+ const Params = paramsFactory( 'float64' );
+
+ new Params( new ArrayBuffer( 80 ), 'abc' ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), true ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), false ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), null ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), [] ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), {} ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a third argument which is not a number...
+{
+ const Params = paramsFactory( 'float64' );
+
+ new Params( new ArrayBuffer( 80 ), 8, 'abc' ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, true ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, false ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, null ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, [] ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
+}
+
+// The parameters object has a `toString` method...
+{
+ const Params = paramsFactory( 'float64' );
+ const r = new Params( {} );
+
+ r.toString(); // $ExpectType string
+ r.toString( {} ); // $ExpectType string
+ r.toString( { 'digits': 4 } ); // $ExpectType string
+}
+
+// The parameters object has a `toJSON` method...
+{
+ const Params = paramsFactory( 'float64' );
+ const r = new Params( {} );
+
+ r.toJSON(); // $ExpectType object
+}
+
+// The parameters object has a `toDataView` method...
+{
+ const Params = paramsFactory( 'float64' );
+ const r = new Params( {} );
+
+ r.toDataView(); // $ExpectType DataView
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/examples/index.js
new file mode 100644
index 000000000000..de75bd30925c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/examples/index.js
@@ -0,0 +1,59 @@
+/**
+* @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 Float64Array = require( '@stdlib/array/float64' );
+var Float32Array = require( '@stdlib/array/float32' );
+var paramsFactory = require( './../lib' );
+
+var Params = paramsFactory( 'float64' );
+var params = new Params({
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+var str = params.toString({
+ 'format': 'linear'
+});
+console.log( str );
+
+Params = paramsFactory( 'float32' );
+params = new Params({
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+str = params.toString({
+ 'format': 'linear'
+});
+console.log( str );
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/lib/index.js
new file mode 100644
index 000000000000..21725c19eb55
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/lib/index.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';
+
+/**
+* Return a constructor for creating an SGD trainer parameters object.
+*
+* @module @stdlib/ml/base/sgd/params/factory
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var paramsFactory = require( '@stdlib/ml/base/sgd/params/factory' );
+*
+* var Params = paramsFactory( 'float64' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/lib/main.js
new file mode 100644
index 000000000000..04c33880526c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/lib/main.js
@@ -0,0 +1,506 @@
+/**
+* @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.
+*/
+
+/* eslint-disable no-invalid-this, no-restricted-syntax */
+
+'use strict';
+
+// MODULES //
+
+var isArrayBuffer = require( '@stdlib/assert/is-arraybuffer' );
+var isObject = require( '@stdlib/assert/is-object' );
+var hasProp = require( '@stdlib/assert/has-property' );
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var setReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' );
+var setReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' );
+var propertyDescriptor = require( '@stdlib/utils/property-descriptor' );
+var contains = require( '@stdlib/array/base/assert/contains' ).factory;
+var join = require( '@stdlib/array/base/join' );
+var objectAssign = require( '@stdlib/object/assign' );
+var inherit = require( '@stdlib/utils/inherit' );
+var resolvePenaltyStr = require( '@stdlib/ml/base/sgd/penalty-resolve-str' );
+var resolveLRStr = require( '@stdlib/ml/base/sgd/learning-rate-resolve-str' );
+var resolveLossFnStr = require( '@stdlib/ml/base/sgd/loss-function-resolve-str' );
+var resolvePenaltyEnum = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' );
+var resolveLREnum = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' );
+var resolveLossFnEnum = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' );
+var structFactory = require( '@stdlib/ml/base/sgd/params/struct-factory' );
+var params2json = require( '@stdlib/ml/base/sgd/params/to-json' );
+var params2str = require( '@stdlib/ml/base/sgd/params/to-string' );
+var format = require( '@stdlib/string/format' );
+
+
+// VARIABLES //
+
+var DTYPES = [
+ 'float64',
+ 'float32'
+];
+
+var isDataType = contains( DTYPES );
+
+
+// MAIN //
+
+/**
+* Returns a constructor for creating an SGD trainer parameters object.
+*
+* @param {string} dtype - storage data type for floating-point values
+* @throws {TypeError} first argument must be a supported data type
+* @returns {Function} constructor
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var Params = factory( 'float64' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+function factory( dtype ) {
+ var learningRateDescriptor;
+ var lossFunctionDescriptor;
+ var penaltyDescriptor;
+ var Struct;
+
+ if ( !isDataType( dtype ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be one of the following: "%s". Value: `%s`.', join( DTYPES, ', ' ), dtype ) );
+ }
+
+ // Create a struct constructor:
+ Struct = structFactory( dtype );
+
+ // Cache a reference to a property descriptors on the parent prototype so that we can intercept the return value:
+ learningRateDescriptor = propertyDescriptor( Struct.prototype, 'learningRate' );
+ lossFunctionDescriptor = propertyDescriptor( Struct.prototype, 'lossFunction' );
+ penaltyDescriptor = propertyDescriptor( Struct.prototype, 'penalty' );
+
+ /**
+ * Returns an SGD trainer parameters object.
+ *
+ * @private
+ * @constructor
+ * @param {(ArrayBuffer|Object)} [arg] - underlying byte buffer or a data object
+ * @param {NonNegativeInteger} [byteOffset] - byte offset
+ * @param {NonNegativeInteger} [byteLength] - maximum byte length
+ * @throws {TypeError} first argument must be an ArrayBuffer or a data object
+ * @returns {Params} parameters object
+ */
+ function Params( arg, byteOffset, byteLength ) {
+ var nargs;
+ var args;
+ var v;
+ var i;
+
+ nargs = arguments.length;
+ if ( !( this instanceof Params ) ) {
+ if ( nargs === 0 ) {
+ return new Params();
+ }
+ if ( nargs === 1 ) {
+ return new Params( arg );
+ }
+ if ( nargs === 2 ) {
+ return new Params( arg, byteOffset );
+ }
+ return new Params( arg, byteOffset, byteLength );
+ }
+ args = [];
+ if ( nargs > 0 ) {
+ if ( isArrayBuffer( arg ) ) {
+ for ( i = 0; i < nargs; i++ ) {
+ args.push( arguments[ i ] );
+ }
+ } else if ( isObject( arg ) ) {
+ args.push( objectAssign( {}, arg ) );
+ if ( hasProp( arg, 'learningRate' ) ) {
+ v = resolveLREnum( args[ 0 ].learningRate );
+ args[ 0 ].learningRate = ( v === null ) ? NaN : v;
+ }
+ if ( hasProp( arg, 'lossFunction' ) ) {
+ v = resolveLossFnEnum( args[ 0 ].lossFunction );
+ args[ 0 ].lossFunction = ( v === null ) ? NaN : v;
+ }
+ if ( hasProp( arg, 'penalty' ) ) {
+ v = resolvePenaltyEnum( args[ 0 ].penalty );
+ args[ 0 ].penalty = ( v === null ) ? NaN : v;
+ }
+ } else {
+ throw new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer or a data object. Value: `%s`.', arg ) );
+ }
+ }
+ // Call the parent constructor...
+ Struct.apply( this, args );
+ return this;
+ }
+
+ /*
+ * Inherit from the parent constructor.
+ */
+ inherit( Params, Struct );
+
+ /**
+ * Constructor name.
+ *
+ * @private
+ * @name name
+ * @memberof Params
+ * @readonly
+ * @type {string}
+ */
+ setReadOnly( Params, 'name', Struct.name );
+
+ /**
+ * Alignment.
+ *
+ * @private
+ * @name alignment
+ * @memberof Params
+ * @readonly
+ * @type {PositiveInteger}
+ */
+ setReadOnly( Params, 'alignment', Struct.alignment );
+
+ /**
+ * Size (in bytes) of the `struct`.
+ *
+ * @private
+ * @name byteLength
+ * @memberof Params
+ * @readonly
+ * @type {PositiveInteger}
+ */
+ setReadOnly( Params, 'byteLength', Struct.byteLength );
+
+ /**
+ * Returns a list of `struct` fields.
+ *
+ * @private
+ * @name fields
+ * @memberof Params
+ * @readonly
+ * @type {Array}
+ */
+ setReadOnlyAccessor( Params, 'fields', function get() {
+ return Struct.fields;
+ });
+
+ /**
+ * Returns a string corresponding to the `struct` layout.
+ *
+ * @private
+ * @name layout
+ * @memberof Params
+ * @readonly
+ * @type {string}
+ */
+ setReadOnlyAccessor( Params, 'layout', function get() {
+ return Struct.layout;
+ });
+
+ /**
+ * Returns the underlying byte buffer of a `struct`.
+ *
+ * @private
+ * @name bufferOf
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {Object} obj - struct instance
+ * @throws {TypeError} must provide a `struct` instance
+ * @returns {ArrayBuffer} underlying byte buffer
+ */
+ setReadOnly( Params, 'bufferOf', Struct.bufferOf );
+
+ /**
+ * Returns the length, in bytes, of the value specified by the provided field name.
+ *
+ * @private
+ * @name byteLengthOf
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {NonNegativeInteger} byte length
+ */
+ setReadOnly( Params, 'byteLengthOf', Struct.byteLengthOf );
+
+ /**
+ * Returns the offset, in bytes, from the beginning of a `struct` to the value specified by the provided field name.
+ *
+ * @private
+ * @name byteOffsetOf
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {NonNegativeInteger} byte offset
+ */
+ setReadOnly( Params, 'byteOffsetOf', Struct.byteOffsetOf );
+
+ /**
+ * Returns the description associated with a provided field name.
+ *
+ * @private
+ * @name descriptionOf
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {string} description
+ */
+ setReadOnly( Params, 'descriptionOf', Struct.descriptionOf );
+
+ /**
+ * Returns a boolean indicating whether a provided value is a `struct` instance.
+ *
+ * @private
+ * @name isStruct
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {*} value - input value
+ * @returns {boolean} boolean indicating whether a value is a `struct` instance
+ */
+ setReadOnly( Params, 'isStruct', Struct.isStruct );
+
+ /**
+ * Returns the type associated with a provided field name.
+ *
+ * @private
+ * @name typeOf
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {(string|Object)} type
+ */
+ setReadOnly( Params, 'typeOf', Struct.typeOf );
+
+ /**
+ * Returns the underlying byte buffer of a `struct` as a `DataView`.
+ *
+ * @private
+ * @name viewOf
+ * @memberof Params
+ * @readonly
+ * @type {Function}
+ * @param {Object} obj - struct instance
+ * @throws {TypeError} must provide a `struct` instance
+ * @returns {DataView} view of underlying byte buffer
+ */
+ setReadOnly( Params, 'viewOf', Struct.viewOf );
+
+ /**
+ * Method name.
+ *
+ * @private
+ * @name method
+ * @memberof Params.prototype
+ * @type {string}
+ * @default 'Stochastic Gradient Descent'
+ */
+ setReadOnly( Params.prototype, 'method', 'Stochastic Gradient Descent' );
+
+ /**
+ * Regularization function.
+ *
+ * @private
+ * @name penalty
+ * @memberof Params.prototype
+ * @type {string}
+ */
+ setReadWriteAccessor( Params.prototype, 'penalty', getPenalty, setPenalty );
+
+ /**
+ * Learning rate scheduler.
+ *
+ * @private
+ * @name learningRate
+ * @memberof Params.prototype
+ * @type {string}
+ */
+ setReadWriteAccessor( Params.prototype, 'learningRate', getLearningRate, setLearningRate );
+
+ /**
+ * Loss function.
+ *
+ * @private
+ * @name lossFunction
+ * @memberof Params.prototype
+ * @type {string}
+ */
+ setReadWriteAccessor( Params.prototype, 'lossFunction', getLossFunction, setLossFunction );
+
+ /**
+ * Serializes an SGD trainer parameters object as a string.
+ *
+ * ## Notes
+ *
+ * - Example output:
+ *
+ * ```text
+ *
+ * Stochastic Gradient Descent
+ *
+ * penalty: l2
+ * learning rate: constant
+ * loss function: hinge
+ * lambda: 2.5000
+ * eta0: 0.0100
+ * fit intercept: true
+ * intercept: 0.0000
+ * max iterations: 1000
+ *
+ * ```
+ *
+ * @private
+ * @name toString
+ * @memberof Params.prototype
+ * @type {Function}
+ * @param {Options} [opts] - options object
+ * @param {PositiveInteger} [opts.digits=4] - number of digits after the decimal point
+ * @throws {TypeError} options argument must be an object
+ * @throws {TypeError} must provide valid options
+ * @returns {string} serialized parameters
+ */
+ setReadOnly( Params.prototype, 'toString', function toString( opts ) {
+ if ( arguments.length ) {
+ return params2str( this, opts );
+ }
+ return params2str( this );
+ });
+
+ /**
+ * Serializes an SGD trainer parameters object as a JSON object.
+ *
+ * ## Notes
+ *
+ * - `JSON.stringify()` implicitly calls this method when stringifying a `Params` instance.
+ *
+ * @private
+ * @name toJSON
+ * @memberof Params.prototype
+ * @type {Function}
+ * @returns {Object} serialized object
+ */
+ setReadOnly( Params.prototype, 'toJSON', function toJSON() {
+ return params2json( this );
+ });
+
+ /**
+ * Returns a DataView of an SGD trainer parameters object.
+ *
+ * @private
+ * @name toDataView
+ * @memberof Params.prototype
+ * @type {Function}
+ * @returns {DataView} DataView
+ */
+ setReadOnly( Params.prototype, 'toDataView', function toDataView() {
+ return Struct.viewOf( this );
+ });
+
+ return Params;
+
+ /**
+ * Returns the regularization function.
+ *
+ * @private
+ * @returns {string} regularization function
+ */
+ function getPenalty() {
+ return resolvePenaltyStr( penaltyDescriptor.get.call( this ) );
+ }
+
+ /**
+ * Sets the regularization function.
+ *
+ * @private
+ * @param {string} value - regularization function
+ */
+ function setPenalty( value ) {
+ penaltyDescriptor.set.call( this, resolvePenaltyEnum( value ) );
+ }
+
+ /**
+ * Returns the learning rate scheduler.
+ *
+ * @private
+ * @returns {string} learning rate scheduler
+ */
+ function getLearningRate() {
+ return resolveLRStr( learningRateDescriptor.get.call( this ) );
+ }
+
+ /**
+ * Sets the learning rate scheduler.
+ *
+ * @private
+ * @param {string} value - learning rate scheduler
+ */
+ function setLearningRate( value ) {
+ learningRateDescriptor.set.call( this, resolveLREnum( value ) );
+ }
+
+ /**
+ * Returns the loss function.
+ *
+ * @private
+ * @returns {string} loss function
+ */
+ function getLossFunction() {
+ return resolveLossFnStr( lossFunctionDescriptor.get.call( this ) );
+ }
+
+ /**
+ * Sets the loss function.
+ *
+ * @private
+ * @param {string} value - loss function
+ */
+ function setLossFunction( value ) {
+ lossFunctionDescriptor.set.call( this, resolveLossFnEnum( value ) );
+ }
+}
+
+
+// EXPORTS //
+
+module.exports = factory;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/package.json b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/package.json
new file mode 100644
index 000000000000..6394f0e46eff
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@stdlib/ml/base/sgd/params/factory",
+ "version": "0.0.0",
+ "description": "Return a constructor for creating an SGD trainer parameters object.",
+ "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",
+ "sgd",
+ "stochastic gradient descent",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "constructor",
+ "ctor",
+ "params"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/factory/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/test/test.js
new file mode 100644
index 000000000000..6fe9db174258
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/factory/test/test.js
@@ -0,0 +1,754 @@
+/**
+* @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 isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' );
+var isSameFloat32Array = require( '@stdlib/assert/is-same-float32array' );
+var isDataView = require( '@stdlib/assert/is-dataview' );
+var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
+var Float64Array = require( '@stdlib/array/float64' );
+var Float32Array = require( '@stdlib/array/float32' );
+var ArrayBuffer = require( '@stdlib/array/buffer' );
+var f32 = require( '@stdlib/number/float64/base/to-float32' );
+var paramsFactory = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof paramsFactory, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not a supported data type', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ paramsFactory( value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided a first argument which is not an ArrayBuffer or data object', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = paramsFactory( 'float64' );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided a second argument which is not a nonnegative integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = paramsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( new ArrayBuffer( 1024 ), value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided a third argument which is not a nonnegative integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = paramsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( new ArrayBuffer( 1024 ), 0, value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided an invalid `penalty` property value', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = paramsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params({
+ 'penalty': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided an invalid `learningRate` property value', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = paramsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params({
+ 'learningRate': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided an invalid `lossFunction` property value', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = paramsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params({
+ 'lossFunction': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns a constructor which does not require the `new` operator', function test( t ) {
+ var params;
+ var p;
+
+ params = paramsFactory( 'float64' );
+
+ p = params();
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( {} );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ) );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ), 0 );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ), 0, 1024 );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (dtype=float64)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ actual = new Params({
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ });
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (dtype=float32)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+
+ Params = paramsFactory( 'float32' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ actual = new Params({
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ });
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (no arguments)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ actual = new Params();
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (empty object)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ actual = new Params( {} );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (ArrayBuffer)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+ var buf;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Params( buf );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 0, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (ArrayBuffer, byteOffset)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+ var buf;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Params( buf, 16 );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width parameters object (ArrayBuffer, byteOffset, byteLength)', function test( t ) {
+ var expected;
+ var Params;
+ var actual;
+ var buf;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Params( buf, 16, 160 );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Params, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a method property', function test( t ) {
+ var Params;
+ var params;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ params = new Params();
+
+ t.strictEqual( params.method, 'Stochastic Gradient Descent', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a `toString` method', function test( t ) {
+ var Params;
+ var params;
+ var actual;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ params = new Params();
+
+ actual = params.toString();
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+
+ actual = params.toString({
+ 'digits': 5
+ });
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a `toJSON` method', function test( t ) {
+ var Params;
+ var params;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ params = new Params();
+ t.strictEqual( typeof params.toJSON, 'function', 'returns expected value' );
+ t.strictEqual( typeof params.toJSON(), 'object', 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a `toDataView` method', function test( t ) {
+ var Params;
+ var params;
+
+ Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+
+ params = new Params();
+ t.strictEqual( typeof params.toDataView, 'function', 'returns expected value' );
+ t.strictEqual( isDataView( params.toDataView() ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `name` property', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.name, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having an `alignment` property', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.alignment, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `byteLength` property', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.byteLength, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `fields` property', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( isStringArray( Params.fields ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `layout` property', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.layout, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `bufferOf` method', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.bufferOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `byteLengthOf` method', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.byteLengthOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `byteOffsetOf` method', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.byteOffsetOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `descriptionOf` method', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.descriptionOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having an `isStruct` method', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.isStruct, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `viewOf` method', function test( t ) {
+ var Params = paramsFactory( 'float64' );
+ t.strictEqual( typeof Params, 'function', 'returns expected value' );
+ t.strictEqual( typeof Params.viewOf, 'function', 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/README.md b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/README.md
new file mode 100644
index 000000000000..e2df36fa918a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/README.md
@@ -0,0 +1,474 @@
+
+
+# Float32Params
+
+> Create a single-precision floating-point SGD parameters object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var Float32Params = require( '@stdlib/ml/base/sgd/params/float32' );
+```
+
+#### Float32Params( \[arg\[, byteOffset\[, byteLength]]] )
+
+Returns a single-precision floating-point SGD parameters object.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+```
+
+The function supports the following parameters:
+
+- **arg**: an [`ArrayBuffer`][@stdlib/array/buffer] or a data object (_optional_).
+- **byteOffset**: byte offset (_optional_).
+- **byteLength**: maximum byte length (_optional_).
+
+A data object argument is an object having one or more of the following properties:
+
+- **penalty**: [regularization function][@stdlib/ml/base/sgd/penalties].
+
+- **penaltyParams**: parameters specific to the regularization function being used. Must be a [`Float32Array`][@stdlib/array/float32] having length `2`, with any unused elements set to zero. The expected array contents depend on `penalty`:
+
+ - **l1**: `[ lambda, 0.0 ]`
+ - **l2**: `[ lambda, 0.0 ]`
+ - **elasticnet**: `[ lambda, l1Ratio ]`
+ - **none**: `[ 0.0, 0.0 ]` (unused)
+
+ where
+
+ - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+
+- **learningRate**: [learning rate scheduler][@stdlib/ml/base/sgd/learning-rates].
+
+- **learningRateParams**: parameters specific to the learning rate scheduler being used. Must be a [`Float32Array`][@stdlib/array/float32] having length `2`, with any unused elements set to zero. The expected array contents depend on `learningRate`:
+
+ - **basic**: `[ 0.0, 0.0 ]` (unused)
+ - **constant**: `[ eta0, 0.0 ]`
+ - **invscaling**: `[ eta0, powerT ]`
+ - **pegasos**: `[ lambda, 0.0 ]`
+
+ where
+
+ - **eta0**: initial learning rate.
+ - **powerT**: exponent controlling how quickly the learning rate decreases.
+ - **lambda**: regularization parameter.
+
+- **lossFunction**: [loss function][@stdlib/ml/base/sgd/loss-functions].
+
+- **lossFunctionParams**: parameters specific to the loss function being used. Must be a [`Float32Array`][@stdlib/array/float32] having length `1`. The expected array contents depend on `lossFunction`:
+
+ - **epsilon-insensitive**: `[ epsilon ]`
+ - **squared-epsilon-insensitive**: `[ epsilon ]`
+ - **huber**: `[ threshold ]`
+ - all other loss functions: `[ 0.0 ]` (unused)
+
+ where
+
+ - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+
+- **fitIntercept**: boolean indicating whether to include an intercept. If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+
+- **intercept**: initial intercept value. Only applicable when `fitIntercept` is `true`.
+
+- **maxIter**: maximum number of iterations to run.
+
+#### Float32Params.prototype.penalty
+
+Regularization function.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.penalty;
+// returns
+```
+
+#### Float32Params.prototype.penaltyParams
+
+Parameters specific to the regularization function being used.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.penaltyParams;
+// returns
+```
+
+#### Float32Params.prototype.learningRate
+
+Learning rate scheduler.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.learningRate;
+// returns
+```
+
+#### Float32Params.prototype.learningRateParams
+
+Parameters specific to the learning rate scheduler being used.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.learningRateParams;
+// returns
+```
+
+#### Float32Params.prototype.lossFunction
+
+Loss function.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.lossFunction;
+// returns
+```
+
+#### Float32Params.prototype.lossFunctionParams
+
+Parameters specific to the loss function being used.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.lossFunctionParams;
+// returns
+```
+
+#### Float32Params.prototype.fitIntercept
+
+Boolean indicating whether to include intercept.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.fitIntercept;
+// returns
+```
+
+#### Float32Params.prototype.intercept
+
+Initial intercept value.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.intercept;
+// returns
+```
+
+#### Float32Params.prototype.maxIter
+
+Maximum number of iterations to run.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.maxIter;
+// returns
+```
+
+#### Float32Params.prototype.toString( \[options] )
+
+Serializes an SGD trainer parameters object to a formatted string.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.toString();
+// returns
+```
+
+The method supports the following options:
+
+- **digits**: number of digits to display after decimal points. Default: `4`.
+
+Example output:
+
+```text
+
+Stochastic Gradient Descent
+
+ penalty: l2
+ learning rate: constant
+ loss function: hinge
+ lambda: 2.5000
+ eta0: 0.0100
+ fit intercept: true
+ intercept: 0.0000
+ max iterations: 1000
+
+```
+
+#### Float32Params.prototype.toJSON( \[options] )
+
+Serializes an SGD trainer parameters object as a JSON object.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.toJSON();
+// returns {...}
+```
+
+`JSON.stringify()` implicitly calls this method when stringifying an SGD trainer parameters instance.
+
+#### Float32Params.prototype.toDataView()
+
+Returns a [`DataView`][@stdlib/array/dataview] of an SGD trainer parameters object.
+
+```javascript
+var params = new Float32Params();
+// returns {...}
+
+// ...
+
+var v = params.toDataView();
+// returns
+```
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A parameters object is a [`struct`][@stdlib/dstructs/struct] providing a fixed-width composite data structure for storing SGD trainer parameters and providing an ABI-stable data layout for JavaScript-C interoperation.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float32Array = require( '@stdlib/array/float32' );
+var Params = require( '@stdlib/ml/base/sgd/params/float32' );
+
+var params = new Params({
+ 'fitIntercept': true,
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge'
+});
+
+var str = params.toString();
+console.log( str );
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/ml/base/sgd/params/float32.h"
+```
+
+#### stdlib_ml_sgd_float32_params
+
+Structure for holding single-precision floating-point SGD parameters.
+
+
+
+```c
+#include
+#include
+
+struct stdlib_ml_sgd_float32_params {
+ // Parameters specific to the regularization function being used:
+ float penaltyParams[ 2 ];
+
+ // Parameters specific to the learning rate scheduler being used:
+ float learningRateParams[ 2 ];
+
+ // Parameters specific to the loss function being used:
+ float lossFunctionParams[ 1 ];
+
+ // Initial intercept value:
+ float intercept;
+
+ // Maximum number of iterations to run:
+ int32_t maxIter;
+
+ // Regularization function:
+ int8_t penalty;
+
+ // Learning rate scheduler:
+ int8_t learningRate;
+
+ // Loss function:
+ int8_t lossFunction;
+
+ // Boolean indicating whether to include intercept:
+ bool fitIntercept;
+};
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/dstructs/struct]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct
+
+[@stdlib/ml/base/sgd/penalties]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/penalties
+
+[@stdlib/ml/base/sgd/learning-rates]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/learning-rates
+
+[@stdlib/ml/base/sgd/loss-functions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/loss-functions
+
+[@stdlib/array/dataview]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/dataview
+
+[@stdlib/array/float32]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/float32
+
+[@stdlib/array/buffer]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/buffer
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/benchmark/benchmark.js
new file mode 100644
index 000000000000..97f687ac1b8c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/benchmark/benchmark.js
@@ -0,0 +1,71 @@
+/**
+* @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 isObject = require( '@stdlib/assert/is-object' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var Float32Params = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s::constructor,new', pkg ), function benchmark( b ) {
+ var v;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = new Float32Params();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,no_new', pkg ), function benchmark( b ) {
+ var params;
+ var v;
+ var i;
+
+ params = Float32Params;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = params();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/repl.txt
new file mode 100644
index 000000000000..ffc574270677
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/repl.txt
@@ -0,0 +1,29 @@
+
+{{alias}}( [arg[, byteOffset[, byteLength]]] )
+ Returns a single-precision floating-point SGD parameters object.
+
+ Parameters
+ ----------
+ arg: Object|ArrayBuffer (optional)
+ ArrayBuffer or data object.
+
+ byteOffset: integer (optional)
+ Byte offset.
+
+ byteLength: integer (optional)
+ Maximum byte length.
+
+ Returns
+ -------
+ out: Object
+ Parameters object.
+
+ Examples
+ --------
+ > var p = new {{alias}}();
+ > p.toString()
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/types/index.d.ts
new file mode 100644
index 000000000000..dc01bd56d502
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/types/index.d.ts
@@ -0,0 +1,291 @@
+/*
+* @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
+
+/**
+* Regularization Function.
+*/
+type Penalty = 'elasticnet' | 'l1' | 'l2' | 'none';
+
+/**
+* Learning Rate Scheduler.
+*/
+type LearningRate = 'basic' | 'constant' | 'invscaling' | 'pegasos';
+
+/**
+* Loss Function.
+*/
+type LossFunction = 'epsilon-insensitive' | 'hinge' | 'huber' | 'log' | 'modified-huber' | 'perceptron' | 'squared-epsilon-insensitive' | 'squared-error' | 'squared-hinge';
+
+/**
+* Interface describing SGD trainer parameters.
+*/
+interface Params {
+ /**
+ * Parameters specific to the regularization function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the penalty:
+ *
+ * - **l1**: `[ lambda, 0.0 ]`
+ * - **l2**: `[ lambda, 0.0 ]`
+ * - **elasticnet**: `[ lambda, l1Ratio ]`
+ * - **none**: `[ 0.0, 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ * - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+ */
+ penaltyParams?: Float32Array;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the learning rate scheduler:
+ *
+ * - **basic**: `[ 0.0, 0.0 ]` (unused)
+ * - **constant**: `[ eta0, 0.0 ]`
+ * - **invscaling**: `[ eta0, powerT ]`
+ * - **pegasos**: `[ lambda, 0.0 ]`
+ *
+ * where:
+ *
+ * - **eta0**: initial learning rate.
+ * - **powerT**: exponent controlling how quickly the learning rate decreases.
+ * - **lambda**: regularization parameter.
+ */
+ learningRateParams?: Float32Array;
+
+ /**
+ * Parameters specific to the loss function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `1`. The expected array contents depend on the loss function:
+ *
+ * - **epsilon-insensitive**: `[ epsilon ]`
+ * - **squared-epsilon-insensitive**: `[ epsilon ]`
+ * - **huber**: `[ threshold ]`
+ * - all other loss functions: `[ 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ * - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+ */
+ lossFunctionParams?: Float32Array;
+
+ /**
+ * Initial intercept value.
+ *
+ * ## Notes
+ *
+ * - Only applicable when `fitIntercept` is `true`.
+ */
+ intercept?: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter?: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty?: Penalty;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate?: LearningRate;
+
+ /**
+ * Loss function.
+ */
+ lossFunction?: LossFunction;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ *
+ * ## Notes
+ *
+ * - If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+ */
+ fitIntercept?: boolean;
+}
+
+/**
+* Interface describing options when serializing an SGD trainer parameters object to a string.
+*/
+interface ToStringOptions {
+ /**
+ * Number of digits to display after decimal points. Default: `4`.
+ */
+ digits?: number;
+}
+
+/**
+* Interface describing an SGD trainer parameters data structure.
+*/
+declare class ParamsStruct {
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ constructor( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number );
+
+ /**
+ * Parameters specific to the regularization function being used.
+ */
+ penaltyParams: Float32Array;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ */
+ learningRateParams: Float32Array;
+
+ /**
+ * Parameters specific to the loss function being used.
+ */
+ lossFunctionParams: Float32Array;
+
+ /**
+ * Initial intercept value.
+ */
+ intercept: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty: Penalty;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate: LearningRate;
+
+ /**
+ * Loss function.
+ */
+ lossFunction: LossFunction;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ */
+ fitIntercept: boolean;
+
+ /**
+ * Algorithm name.
+ */
+ method: string;
+
+ /**
+ * Serializes an SGD trainer parameters object as a formatted string.
+ *
+ * @param options - options object
+ * @returns serialized parameters
+ */
+ toString( options?: ToStringOptions ): string;
+
+ /**
+ * Serializes an SGD trainer parameters object as a JSON object.
+ *
+ * @returns serialized object
+ */
+ toJSON(): object;
+
+ /**
+ * Returns a DataView of an SGD trainer parameters object.
+ *
+ * @returns DataView
+ */
+ toDataView(): DataView;
+}
+
+/**
+* Interface defining an SGD trainer parameters constructor which is both "newable" and "callable".
+*/
+interface ParamsConstructor {
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ new( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number ): ParamsStruct;
+
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ ( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number ): ParamsStruct;
+}
+
+/**
+* Returns a single-precision floating-point SGD parameters object.
+*
+* @param arg - buffer or data object
+* @param byteOffset - byte offset
+* @param byteLength - maximum byte length
+* @returns parameters object
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float32Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+declare var Params: ParamsConstructor;
+
+
+// EXPORTS //
+
+export = Params;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/types/test.ts
new file mode 100644
index 000000000000..4cc71b872ee2
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/docs/types/test.ts
@@ -0,0 +1,140 @@
+/*
+* @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 Params = require( './index' );
+
+
+// TESTS //
+
+// The constructor returns a parameters object...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = new Params( {} ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = new Params( new ArrayBuffer( 80 ) ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = new Params( new ArrayBuffer( 80 ), 8 ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = new Params( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ParamsStruct
+}
+
+// The constructor can be invoked without `new`...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = Params( {} ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = Params( new ArrayBuffer( 80 ) ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = Params( new ArrayBuffer( 80 ), 8 ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = Params( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ParamsStruct
+}
+
+// The parameters object has the expected properties...
+{
+ const r = new Params( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penaltyParams; // $ExpectType Float32Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRateParams; // $ExpectType Float32Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunctionParams; // $ExpectType Float32Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.intercept; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.maxIter; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penalty; // $ExpectType Penalty
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRate; // $ExpectType LearningRate
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunction; // $ExpectType LossFunction
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.fitIntercept; // $ExpectType boolean
+}
+
+// The compiler throws an error if the constructor is provided a first argument which is not an ArrayBuffer or object...
+{
+ new Params( 'abc' ); // $ExpectError
+ new Params( 123 ); // $ExpectError
+ new Params( true ); // $ExpectError
+ new Params( false ); // $ExpectError
+ new Params( null ); // $ExpectError
+ new Params( [] ); // $ExpectError
+ new Params( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a second argument which is not a number...
+{
+ new Params( new ArrayBuffer( 80 ), 'abc' ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), true ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), false ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), null ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), [] ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), {} ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a third argument which is not a number...
+{
+ new Params( new ArrayBuffer( 80 ), 8, 'abc' ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, true ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, false ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, null ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, [] ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
+}
+
+// The parameters object has a `toString` method...
+{
+ const r = new Params( {} );
+
+ r.toString(); // $ExpectType string
+ r.toString( {} ); // $ExpectType string
+ r.toString( { 'digits': 4 } ); // $ExpectType string
+}
+
+// The parameters object has a `toJSON` method...
+{
+ const r = new Params( {} );
+
+ r.toJSON(); // $ExpectType object
+}
+
+// The parameters object has a `toDataView` method...
+{
+ const r = new Params( {} );
+
+ r.toDataView(); // $ExpectType DataView
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/examples/index.js
new file mode 100644
index 000000000000..d3fea794c7fa
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/examples/index.js
@@ -0,0 +1,37 @@
+/**
+* @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 Float32Array = require( '@stdlib/array/float32' );
+var Params = require( './../lib' );
+
+var params = new Params({
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+var str = params.toString();
+console.log( str );
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/include/stdlib/ml/base/sgd/params/float32.h b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/include/stdlib/ml/base/sgd/params/float32.h
new file mode 100644
index 000000000000..92eb9aec442f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/include/stdlib/ml/base/sgd/params/float32.h
@@ -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.
+*/
+
+#ifndef STDLIB_ML_BASE_SGD_PARAMS_FLOAT32_H
+#define STDLIB_ML_BASE_SGD_PARAMS_FLOAT32_H
+
+#include
+#include
+
+/**
+* Struct for storing SGD parameters.
+*/
+struct stdlib_ml_sgd_float32_params {
+ // Parameters specific to the regularization function being used:
+ float penaltyParams[ 2 ];
+
+ // Parameters specific to the learning rate scheduler being used:
+ float learningRateParams[ 2 ];
+
+ // Parameters specific to the loss function being used:
+ float lossFunctionParams[ 1 ];
+
+ // Initial intercept value:
+ float intercept;
+
+ // Maximum number of iterations to run:
+ int32_t maxIter;
+
+ // Regularization function:
+ int8_t penalty;
+
+ // Learning rate scheduler:
+ int8_t learningRate;
+
+ // Loss function:
+ int8_t lossFunction;
+
+ // Boolean indicating whether to include intercept:
+ bool fitIntercept;
+};
+
+#endif // !STDLIB_ML_BASE_SGD_PARAMS_FLOAT32_H
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/lib/index.js
new file mode 100644
index 000000000000..2504e11ab21b
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/lib/index.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';
+
+/**
+* Create a single-precision floating-point SGD parameters object.
+*
+* @module @stdlib/ml/base/sgd/params/float32
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+* var Params = require( '@stdlib/ml/base/sgd/params/float32' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float32Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/lib/main.js
new file mode 100644
index 000000000000..a2459e2f8152
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/lib/main.js
@@ -0,0 +1,63 @@
+/**
+* @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 factory = require( '@stdlib/ml/base/sgd/params/factory' );
+
+
+// MAIN //
+
+/**
+* Returns a single-precision floating-point SGD parameters object.
+*
+* @name Params
+* @constructor
+* @type {Function}
+* @param {(ArrayBuffer|Object)} [arg] - underlying byte buffer or data object
+* @param {NonNegativeInteger} [byteOffset] - byte offset
+* @param {NonNegativeInteger} [byteLength] - maximum byte length
+* @returns {Params} parameters object
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float32Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+var Params = factory( 'float32' );
+
+
+// EXPORTS //
+
+module.exports = Params;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/manifest.json
new file mode 100644
index 000000000000..844d692f6439
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/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/sgd/params/float32/package.json b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/package.json
new file mode 100644
index 000000000000..e6692db4572a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/ml/base/sgd/params/float32",
+ "version": "0.0.0",
+ "description": "Create a single-precision floating-point SGD parameters object.",
+ "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",
+ "sgd",
+ "stochastic gradient descent",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "constructor",
+ "ctor",
+ "params"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float32/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/test/test.js
new file mode 100644
index 000000000000..b5016f158633
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float32/test/test.js
@@ -0,0 +1,507 @@
+/**
+* @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 isSameFloat32Array = require( '@stdlib/assert/is-same-float32array' );
+var isDataView = require( '@stdlib/assert/is-dataview' );
+var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
+var Float32Array = require( '@stdlib/array/float32' );
+var ArrayBuffer = require( '@stdlib/array/buffer' );
+var f32 = require( '@stdlib/number/float64/base/to-float32' );
+var Float32Params = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof Float32Params, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ArrayBuffer or data object', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = Float32Params;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = Float32Params;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( new ArrayBuffer( 1024 ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not a nonnegative integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = Float32Params;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( new ArrayBuffer( 1024 ), 0, value );
+ };
+ }
+});
+
+tape( 'the function is a constructor which does not require the `new` operator', function test( t ) {
+ var params;
+ var p;
+
+ params = Float32Params;
+
+ p = params();
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( {} );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ) );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ), 0 );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ), 0, 1024 );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object ', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float32Params({
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ });
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float32Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (no arguments)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float32Params();
+
+ actual.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float32Array( [ 0.0 ] );
+ actual.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+ actual.intercept = f32( 0.0 );
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float32Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (empty object)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float32Params( {} );
+
+ actual.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float32Array( [ 0.0 ] );
+ actual.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+ actual.intercept = f32( 0.0 );
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float32Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (ArrayBuffer)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float32Params( buf );
+
+ actual.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float32Array( [ 0.0 ] );
+ actual.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+ actual.intercept = f32( 0.0 );
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float32Params, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 0, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (ArrayBuffer, byteOffset)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float32Params( buf, 16 );
+
+ actual.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float32Array( [ 0.0 ] );
+ actual.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+ actual.intercept = f32( 0.0 );
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float32Params, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (ArrayBuffer, byteOffset, byteLength)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float32Params( buf, 16, 160 );
+
+ actual.penaltyParams = new Float32Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float32Array( [ 0.0 ] );
+ actual.learningRateParams = new Float32Array( [ 0.01, 0.0 ] );
+ actual.intercept = f32( 0.0 );
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float32Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float32Array( [ 0.0 ] ),
+ 'learningRateParams': new Float32Array( [ 0.01, 0.0 ] ),
+ 'intercept': f32( 0.0 ),
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float32Params, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat32Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a method property', function test( t ) {
+ var params = new Float32Params();
+
+ t.strictEqual( params.method, 'Stochastic Gradient Descent', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toString` method', function test( t ) {
+ var params;
+ var actual;
+
+ params = new Float32Params();
+
+ actual = params.toString();
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+
+ actual = params.toString({
+ 'digits': 4
+ });
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toJSON` method', function test( t ) {
+ var params = new Float32Params();
+ t.strictEqual( typeof params.toJSON, 'function', 'returns expected value' );
+ t.strictEqual( typeof params.toJSON(), 'object', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toDataView` method', function test( t ) {
+ var params = new Float32Params();
+ t.strictEqual( typeof params.toDataView, 'function', 'returns expected value' );
+ t.strictEqual( isDataView( params.toDataView() ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `name` property', function test( t ) {
+ t.strictEqual( typeof Float32Params.name, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `alignment` property', function test( t ) {
+ t.strictEqual( typeof Float32Params.alignment, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLength` property', function test( t ) {
+ t.strictEqual( typeof Float32Params.byteLength, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `fields` property', function test( t ) {
+ t.strictEqual( isStringArray( Float32Params.fields ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `layout` property', function test( t ) {
+ t.strictEqual( typeof Float32Params.layout, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `bufferOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Params.bufferOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLengthOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Params.byteLengthOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteOffsetOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Params.byteOffsetOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `descriptionOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Params.descriptionOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `isStruct` method', function test( t ) {
+ t.strictEqual( typeof Float32Params.isStruct, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `viewOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Params.viewOf, 'function', 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/README.md b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/README.md
new file mode 100644
index 000000000000..97e898c2e9f7
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/README.md
@@ -0,0 +1,474 @@
+
+
+# Float64Params
+
+> Create a double-precision floating-point SGD parameters object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+```
+
+#### Float64Params( \[arg\[, byteOffset\[, byteLength]]] )
+
+Returns a double-precision floating-point SGD parameters object.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+```
+
+The function supports the following parameters:
+
+- **arg**: an [`ArrayBuffer`][@stdlib/array/buffer] or a data object (_optional_).
+- **byteOffset**: byte offset (_optional_).
+- **byteLength**: maximum byte length (_optional_).
+
+A data object argument is an object having one or more of the following properties:
+
+- **penalty**: [regularization function][@stdlib/ml/base/sgd/penalties].
+
+- **penaltyParams**: parameters specific to the regularization function being used. Must be a [`Float64Array`][@stdlib/array/float64] having length `2`, with any unused elements set to zero. The expected array contents depend on `penalty`:
+
+ - **l1**: `[ lambda, 0.0 ]`
+ - **l2**: `[ lambda, 0.0 ]`
+ - **elasticnet**: `[ lambda, l1Ratio ]`
+ - **none**: `[ 0.0, 0.0 ]` (unused)
+
+ where
+
+ - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+
+- **learningRate**: [learning rate scheduler][@stdlib/ml/base/sgd/learning-rates].
+
+- **learningRateParams**: parameters specific to the learning rate scheduler being used. Must be a [`Float64Array`][@stdlib/array/float64] having length `2`, with any unused elements set to zero. The expected array contents depend on `learningRate`:
+
+ - **basic**: `[ 0.0, 0.0 ]` (unused)
+ - **constant**: `[ eta0, 0.0 ]`
+ - **invscaling**: `[ eta0, powerT ]`
+ - **pegasos**: `[ lambda, 0.0 ]`
+
+ where
+
+ - **eta0**: initial learning rate.
+ - **powerT**: exponent controlling how quickly the learning rate decreases.
+ - **lambda**: regularization parameter.
+
+- **lossFunction**: [loss function][@stdlib/ml/base/sgd/loss-functions].
+
+- **lossFunctionParams**: parameters specific to the loss function being used. Must be a [`Float64Array`][@stdlib/array/float64] having length `1`. The expected array contents depend on `lossFunction`:
+
+ - **epsilon-insensitive**: `[ epsilon ]`
+ - **squared-epsilon-insensitive**: `[ epsilon ]`
+ - **huber**: `[ threshold ]`
+ - all other loss functions: `[ 0.0 ]` (unused)
+
+ where
+
+ - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+
+- **fitIntercept**: boolean indicating whether to include an intercept. If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+
+- **intercept**: initial intercept value. Only applicable when `fitIntercept` is `true`.
+
+- **maxIter**: maximum number of iterations to run.
+
+#### Float64Params.prototype.penalty
+
+Regularization function.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.penalty;
+// returns
+```
+
+#### Float64Params.prototype.penaltyParams
+
+Parameters specific to the regularization function being used.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.penaltyParams;
+// returns
+```
+
+#### Float64Params.prototype.learningRate
+
+Learning rate scheduler.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.learningRate;
+// returns
+```
+
+#### Float64Params.prototype.learningRateParams
+
+Parameters specific to the learning rate scheduler being used.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.learningRateParams;
+// returns
+```
+
+#### Float64Params.prototype.lossFunction
+
+Loss function.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.lossFunction;
+// returns
+```
+
+#### Float64Params.prototype.lossFunctionParams
+
+Parameters specific to the loss function being used.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.lossFunctionParams;
+// returns
+```
+
+#### Float64Params.prototype.fitIntercept
+
+Boolean indicating whether to include intercept.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.fitIntercept;
+// returns
+```
+
+#### Float64Params.prototype.intercept
+
+Initial intercept value.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.intercept;
+// returns
+```
+
+#### Float64Params.prototype.maxIter
+
+Maximum number of iterations to run.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.maxIter;
+// returns
+```
+
+#### Float64Params.prototype.toString( \[options] )
+
+Serializes an SGD trainer parameters object to a formatted string.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.toString();
+// returns
+```
+
+The method supports the following options:
+
+- **digits**: number of digits to display after decimal points. Default: `4`.
+
+Example output:
+
+```text
+
+Stochastic Gradient Descent
+
+ penalty: l2
+ learning rate: constant
+ loss function: hinge
+ lambda: 2.5000
+ eta0: 0.0100
+ fit intercept: true
+ intercept: 0.0000
+ max iterations: 1000
+
+```
+
+#### Float64Params.prototype.toJSON( \[options] )
+
+Serializes an SGD trainer parameters object as a JSON object.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.toJSON();
+// returns {...}
+```
+
+`JSON.stringify()` implicitly calls this method when stringifying an SGD trainer parameters instance.
+
+#### Float64Params.prototype.toDataView()
+
+Returns a [`DataView`][@stdlib/array/dataview] of an SGD trainer parameters object.
+
+```javascript
+var params = new Float64Params();
+// returns {...}
+
+// ...
+
+var v = params.toDataView();
+// returns
+```
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A parameters object is a [`struct`][@stdlib/dstructs/struct] providing a fixed-width composite data structure for storing SGD trainer parameters and providing an ABI-stable data layout for JavaScript-C interoperation.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+var Params = require( '@stdlib/ml/base/sgd/params/float64' );
+
+var params = new Params({
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+var str = params.toString();
+console.log( str );
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/ml/base/sgd/params/float64.h"
+```
+
+#### stdlib_ml_sgd_float64_params
+
+Structure for holding double-precision floating-point SGD parameters.
+
+
+
+```c
+#include
+#include
+
+struct stdlib_ml_sgd_float64_params {
+ // Parameters specific to the regularization function being used:
+ double penaltyParams[ 2 ];
+
+ // Parameters specific to the learning rate scheduler being used:
+ double learningRateParams[ 2 ];
+
+ // Parameters specific to the loss function being used:
+ double lossFunctionParams[ 1 ];
+
+ // Initial intercept value:
+ double intercept;
+
+ // Maximum number of iterations to run:
+ int32_t maxIter;
+
+ // Regularization function:
+ int8_t penalty;
+
+ // Learning rate scheduler:
+ int8_t learningRate;
+
+ // Loss function:
+ int8_t lossFunction;
+
+ // Boolean indicating whether to include intercept:
+ bool fitIntercept;
+};
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/dstructs/struct]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct
+
+[@stdlib/ml/base/sgd/penalties]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/penalties
+
+[@stdlib/ml/base/sgd/learning-rates]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/learning-rates
+
+[@stdlib/ml/base/sgd/loss-functions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ml/base/sgd/loss-functions
+
+[@stdlib/array/dataview]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/dataview
+
+[@stdlib/array/float64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/float64
+
+[@stdlib/array/buffer]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/buffer
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/benchmark/benchmark.js
new file mode 100644
index 000000000000..43173b4b6b52
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/benchmark/benchmark.js
@@ -0,0 +1,71 @@
+/**
+* @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 isObject = require( '@stdlib/assert/is-object' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var Float64Params = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s::constructor,new', pkg ), function benchmark( b ) {
+ var v;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = new Float64Params();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,no_new', pkg ), function benchmark( b ) {
+ var params;
+ var v;
+ var i;
+
+ params = Float64Params;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = params();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/repl.txt
new file mode 100644
index 000000000000..dfe13753fb17
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/repl.txt
@@ -0,0 +1,29 @@
+
+{{alias}}( [arg[, byteOffset[, byteLength]]] )
+ Returns a double-precision floating-point SGD parameters object.
+
+ Parameters
+ ----------
+ arg: Object|ArrayBuffer (optional)
+ ArrayBuffer or data object.
+
+ byteOffset: integer (optional)
+ Byte offset.
+
+ byteLength: integer (optional)
+ Maximum byte length.
+
+ Returns
+ -------
+ out: Object
+ Parameters object.
+
+ Examples
+ --------
+ > var p = new {{alias}}();
+ > p.toString()
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/types/index.d.ts
new file mode 100644
index 000000000000..a0bc18b6e833
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/types/index.d.ts
@@ -0,0 +1,291 @@
+/*
+* @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
+
+/**
+* Regularization Function.
+*/
+type Penalty = 'elasticnet' | 'l1' | 'l2' | 'none';
+
+/**
+* Learning Rate Scheduler.
+*/
+type LearningRate = 'basic' | 'constant' | 'invscaling' | 'pegasos';
+
+/**
+* Loss Function.
+*/
+type LossFunction = 'epsilon-insensitive' | 'hinge' | 'huber' | 'log' | 'modified-huber' | 'perceptron' | 'squared-epsilon-insensitive' | 'squared-error' | 'squared-hinge';
+
+/**
+* Interface describing SGD trainer parameters.
+*/
+interface Params {
+ /**
+ * Parameters specific to the regularization function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the penalty:
+ *
+ * - **l1**: `[ lambda, 0.0 ]`
+ * - **l2**: `[ lambda, 0.0 ]`
+ * - **elasticnet**: `[ lambda, l1Ratio ]`
+ * - **none**: `[ 0.0, 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ * - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+ */
+ penaltyParams?: Float64Array;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the learning rate scheduler:
+ *
+ * - **basic**: `[ 0.0, 0.0 ]` (unused)
+ * - **constant**: `[ eta0, 0.0 ]`
+ * - **invscaling**: `[ eta0, powerT ]`
+ * - **pegasos**: `[ lambda, 0.0 ]`
+ *
+ * where:
+ *
+ * - **eta0**: initial learning rate.
+ * - **powerT**: exponent controlling how quickly the learning rate decreases.
+ * - **lambda**: regularization parameter.
+ */
+ learningRateParams?: Float64Array;
+
+ /**
+ * Parameters specific to the loss function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `1`. The expected array contents depend on the loss function:
+ *
+ * - **epsilon-insensitive**: `[ epsilon ]`
+ * - **squared-epsilon-insensitive**: `[ epsilon ]`
+ * - **huber**: `[ threshold ]`
+ * - all other loss functions: `[ 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ * - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+ */
+ lossFunctionParams?: Float64Array;
+
+ /**
+ * Initial intercept value.
+ *
+ * ## Notes
+ *
+ * - Only applicable when `fitIntercept` is `true`.
+ */
+ intercept?: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter?: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty?: Penalty;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate?: LearningRate;
+
+ /**
+ * Loss function.
+ */
+ lossFunction?: LossFunction;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ *
+ * ## Notes
+ *
+ * - If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+ */
+ fitIntercept?: boolean;
+}
+
+/**
+* Interface describing options when serializing an SGD trainer parameters object to a string.
+*/
+interface ToStringOptions {
+ /**
+ * Number of digits to display after decimal points. Default: `4`.
+ */
+ digits?: number;
+}
+
+/**
+* Interface describing an SGD trainer parameters data structure.
+*/
+declare class ParamsStruct {
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ constructor( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number );
+
+ /**
+ * Parameters specific to the regularization function being used.
+ */
+ penaltyParams: Float64Array;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ */
+ learningRateParams: Float64Array;
+
+ /**
+ * Parameters specific to the loss function being used.
+ */
+ lossFunctionParams: Float64Array;
+
+ /**
+ * Initial intercept value.
+ */
+ intercept: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty: Penalty;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate: LearningRate;
+
+ /**
+ * Loss function.
+ */
+ lossFunction: LossFunction;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ */
+ fitIntercept: boolean;
+
+ /**
+ * Algorithm name.
+ */
+ method: string;
+
+ /**
+ * Serializes an SGD trainer parameters object as a formatted string.
+ *
+ * @param options - options object
+ * @returns serialized parameters
+ */
+ toString( options?: ToStringOptions ): string;
+
+ /**
+ * Serializes an SGD trainer parameters object as a JSON object.
+ *
+ * @returns serialized object
+ */
+ toJSON(): object;
+
+ /**
+ * Returns a DataView of an SGD trainer parameters object.
+ *
+ * @returns DataView
+ */
+ toDataView(): DataView;
+}
+
+/**
+* Interface defining an SGD trainer parameters constructor which is both "newable" and "callable".
+*/
+interface ParamsConstructor {
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ new( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number ): ParamsStruct;
+
+ /**
+ * SGD trainer parameters constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns parameters object
+ */
+ ( arg?: ArrayBuffer | Params, byteOffset?: number, byteLength?: number ): ParamsStruct;
+}
+
+/**
+* Returns a double-precision floating-point SGD parameters object.
+*
+* @param arg - buffer or data object
+* @param byteOffset - byte offset
+* @param byteLength - maximum byte length
+* @returns parameters object
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+declare var Params: ParamsConstructor;
+
+
+// EXPORTS //
+
+export = Params;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/types/test.ts
new file mode 100644
index 000000000000..67747aacd2c7
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/docs/types/test.ts
@@ -0,0 +1,143 @@
+/*
+* @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 Params = require( './index' );
+
+
+// TESTS //
+
+// The constructor returns a parameters object...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = new Params( {} ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = new Params( new ArrayBuffer( 80 ) ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = new Params( new ArrayBuffer( 80 ), 8 ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = new Params( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ParamsStruct
+}
+
+// The constructor can be invoked without `new`...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = Params( {} ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = Params( new ArrayBuffer( 80 ) ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = Params( new ArrayBuffer( 80 ), 8 ); // $ExpectType ParamsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = Params( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ParamsStruct
+}
+
+// The parameters object has the expected properties...
+{
+ const r = new Params( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penaltyParams; // $ExpectType Float64Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRateParams; // $ExpectType Float64Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunctionParams; // $ExpectType Float64Array
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.intercept; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.maxIter; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.penalty; // $ExpectType Penalty
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.learningRate; // $ExpectType LearningRate
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.lossFunction; // $ExpectType LossFunction
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.fitIntercept; // $ExpectType boolean
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.method; // $ExpectType string
+}
+
+// The compiler throws an error if the constructor is provided a first argument which is not an ArrayBuffer or object...
+{
+ new Params( 'abc' ); // $ExpectError
+ new Params( 123 ); // $ExpectError
+ new Params( true ); // $ExpectError
+ new Params( false ); // $ExpectError
+ new Params( null ); // $ExpectError
+ new Params( [] ); // $ExpectError
+ new Params( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a second argument which is not a number...
+{
+ new Params( new ArrayBuffer( 80 ), 'abc' ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), true ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), false ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), null ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), [] ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), {} ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a third argument which is not a number...
+{
+ new Params( new ArrayBuffer( 80 ), 8, 'abc' ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, true ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, false ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, null ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, [] ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
+ new Params( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
+}
+
+// The parameters object has a `toString` method...
+{
+ const r = new Params( {} );
+
+ r.toString(); // $ExpectType string
+ r.toString( {} ); // $ExpectType string
+ r.toString( { 'digits': 4 } ); // $ExpectType string
+}
+
+// The parameters object has a `toJSON` method...
+{
+ const r = new Params( {} );
+
+ r.toJSON(); // $ExpectType object
+}
+
+// The parameters object has a `toDataView` method...
+{
+ const r = new Params( {} );
+
+ r.toDataView(); // $ExpectType DataView
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/examples/index.js
new file mode 100644
index 000000000000..97923165546e
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/examples/index.js
@@ -0,0 +1,37 @@
+/**
+* @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 Float64Array = require( '@stdlib/array/float64' );
+var Params = require( './../lib' );
+
+var params = new Params({
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+});
+
+var str = params.toString();
+console.log( str );
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/include/stdlib/ml/base/sgd/params/float64.h b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/include/stdlib/ml/base/sgd/params/float64.h
new file mode 100644
index 000000000000..93d1552820cd
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/include/stdlib/ml/base/sgd/params/float64.h
@@ -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.
+*/
+
+#ifndef STDLIB_ML_BASE_SGD_PARAMS_FLOAT64_H
+#define STDLIB_ML_BASE_SGD_PARAMS_FLOAT64_H
+
+#include
+#include
+
+/**
+* Struct for storing SGD parameters.
+*/
+struct stdlib_ml_sgd_float64_params {
+ // Parameters specific to the regularization function being used:
+ double penaltyParams[ 2 ];
+
+ // Parameters specific to the learning rate scheduler being used:
+ double learningRateParams[ 2 ];
+
+ // Parameters specific to the loss function being used:
+ double lossFunctionParams[ 1 ];
+
+ // Initial intercept value:
+ double intercept;
+
+ // Maximum number of iterations to run:
+ int32_t maxIter;
+
+ // Regularization function:
+ int8_t penalty;
+
+ // Learning rate scheduler:
+ int8_t learningRate;
+
+ // Loss function:
+ int8_t lossFunction;
+
+ // Boolean indicating whether to include intercept:
+ bool fitIntercept;
+};
+
+#endif // !STDLIB_ML_BASE_SGD_PARAMS_FLOAT64_H
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/lib/index.js
new file mode 100644
index 000000000000..68aabeae07e0
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/lib/index.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';
+
+/**
+* Create a double-precision floating-point SGD parameters object.
+*
+* @module @stdlib/ml/base/sgd/params/float64
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var Params = require( '@stdlib/ml/base/sgd/params/float64' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/lib/main.js
new file mode 100644
index 000000000000..aa0408d72272
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/lib/main.js
@@ -0,0 +1,63 @@
+/**
+* @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 factory = require( '@stdlib/ml/base/sgd/params/factory' );
+
+
+// MAIN //
+
+/**
+* Returns a double-precision floating-point SGD parameters object.
+*
+* @name Params
+* @constructor
+* @type {Function}
+* @param {(ArrayBuffer|Object)} [arg] - underlying byte buffer or data object
+* @param {NonNegativeInteger} [byteOffset] - byte offset
+* @param {NonNegativeInteger} [byteLength] - maximum byte length
+* @returns {Params} parameters object
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var params = new Params();
+* // returns
+*
+* params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+* params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+* params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+* params.intercept = 0.0;
+* params.maxIter = 500;
+* params.penalty = 'l2';
+* params.learningRate = 'constant';
+* params.lossFunction = 'hinge';
+* params.fitIntercept = true;
+*
+* var str = params.toString();
+* // returns
+*/
+var Params = factory( 'float64' );
+
+
+// EXPORTS //
+
+module.exports = Params;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/manifest.json
new file mode 100644
index 000000000000..844d692f6439
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/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/sgd/params/float64/package.json b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/package.json
new file mode 100644
index 000000000000..7be4a675b861
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/ml/base/sgd/params/float64",
+ "version": "0.0.0",
+ "description": "Create a double-precision floating-point SGD parameters object.",
+ "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",
+ "sgd",
+ "stochastic gradient descent",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "constructor",
+ "ctor",
+ "params"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/float64/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/test/test.js
new file mode 100644
index 000000000000..068a40e3d19e
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/float64/test/test.js
@@ -0,0 +1,500 @@
+/**
+* @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 isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' );
+var isDataView = require( '@stdlib/assert/is-dataview' );
+var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
+var Float64Array = require( '@stdlib/array/float64' );
+var ArrayBuffer = require( '@stdlib/array/buffer' );
+var Float64Params = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof Float64Params, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ArrayBuffer or data object', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = Float64Params;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = Float64Params;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( new ArrayBuffer( 1024 ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not a nonnegative integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = Float64Params;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params( new ArrayBuffer( 1024 ), 0, value );
+ };
+ }
+});
+
+tape( 'the function is a constructor which does not require the `new` operator', function test( t ) {
+ var params;
+ var p;
+
+ params = Float64Params;
+
+ p = params();
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( {} );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ) );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ), 0 );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ p = params( new ArrayBuffer( 1024 ), 0, 1024 );
+ t.strictEqual( p instanceof params, true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object ', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float64Params({
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ });
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float64Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (no arguments)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float64Params();
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float64Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (empty object)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float64Params( {} );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float64Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (ArrayBuffer)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float64Params( buf );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float64Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (ArrayBuffer, byteOffset)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float64Params( buf, 16 );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float64Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width parameters object (ArrayBuffer, byteOffset, byteLength)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float64Params( buf, 16, 160 );
+
+ actual.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+ actual.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ actual.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+ actual.intercept = 0.0;
+ actual.maxIter = 500;
+ actual.penalty = 'l2';
+ actual.learningRate = 'constant';
+ actual.lossFunction = 'hinge';
+ actual.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 500,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true
+ };
+
+ t.strictEqual( actual instanceof Float64Params, true, 'returns expected value' );
+ t.strictEqual( actual.fitIntercept, expected.fitIntercept, 'returns expected value' );
+ t.strictEqual( actual.intercept, expected.intercept, 'returns expected value' );
+ t.strictEqual( actual.maxIter, expected.maxIter, 'returns expected value' );
+ t.strictEqual( actual.penalty, expected.penalty, 'returns expected value' );
+ t.strictEqual( actual.lossFunction, expected.lossFunction, 'returns expected value' );
+ t.strictEqual( actual.learningRate, expected.learningRate, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.penaltyParams, expected.penaltyParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.lossFunctionParams, expected.lossFunctionParams ), true, 'returns expected value' );
+ t.strictEqual( isSameFloat64Array( actual.learningRateParams, expected.learningRateParams ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a method property', function test( t ) {
+ var params = new Float64Params();
+
+ t.strictEqual( params.method, 'Stochastic Gradient Descent', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toString` method', function test( t ) {
+ var params;
+ var actual;
+
+ params = new Float64Params();
+
+ actual = params.toString();
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+
+ actual = params.toString({
+ 'digits': 2
+ });
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toJSON` method', function test( t ) {
+ var params = new Float64Params();
+ t.strictEqual( typeof params.toJSON, 'function', 'returns expected value' );
+ t.strictEqual( typeof params.toJSON(), 'object', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toDataView` method', function test( t ) {
+ var params = new Float64Params();
+ t.strictEqual( typeof params.toDataView, 'function', 'returns expected value' );
+ t.strictEqual( isDataView( params.toDataView() ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `name` property', function test( t ) {
+ t.strictEqual( typeof Float64Params.name, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `alignment` property', function test( t ) {
+ t.strictEqual( typeof Float64Params.alignment, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLength` property', function test( t ) {
+ t.strictEqual( typeof Float64Params.byteLength, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `fields` property', function test( t ) {
+ t.strictEqual( isStringArray( Float64Params.fields ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `layout` property', function test( t ) {
+ t.strictEqual( typeof Float64Params.layout, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `bufferOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Params.bufferOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLengthOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Params.byteLengthOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteOffsetOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Params.byteOffsetOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `descriptionOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Params.descriptionOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `isStruct` method', function test( t ) {
+ t.strictEqual( typeof Float64Params.isStruct, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `viewOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Params.viewOf, 'function', 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/README.md b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/README.md
new file mode 100644
index 000000000000..0d1fa7d235fb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/README.md
@@ -0,0 +1,128 @@
+
+
+# params2json
+
+> Serialize an SGD trainer parameters object as a JSON object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var params2json = require( '@stdlib/ml/base/sgd/params/to-json' );
+```
+
+#### params2json( params )
+
+Serializes an SGD trainer parameters object as a JSON object.
+
+```javascript
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+
+var params = new Float64Params();
+
+// ...
+
+var o = params2json( params );
+// returns {...}
+```
+
+The function supports the following parameters:
+
+- **params**: SGD trainer parameters object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var Float64Array = require( '@stdlib/array/float64' );
+var params2json = require( '@stdlib/ml/base/sgd/params/to-json' );
+
+var params = new Float64Params();
+params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+params.intercept = 0.0;
+params.maxIter = 500;
+params.penalty = 'l2';
+params.learningRate = 'constant';
+params.lossFunction = 'hinge';
+params.fitIntercept = true;
+
+var o = params2json( params );
+console.log( o );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/benchmark/benchmark.js
new file mode 100644
index 000000000000..fcfa800518a1
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/benchmark/benchmark.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 bench = require( '@stdlib/bench' );
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var Float32Params = require( '@stdlib/ml/base/sgd/params/float32' );
+var isPlainObject = require( '@stdlib/assert/is-plain-object' );
+var pkg = require( './../package.json' ).name;
+var params2json = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ new Float64Params(),
+ new Float32Params()
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = params2json( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isPlainObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/repl.txt
new file mode 100644
index 000000000000..ba68dfc49224
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/repl.txt
@@ -0,0 +1,34 @@
+
+{{alias}}( params )
+ Serializes an SGD trainer parameters object as a JSON object.
+
+ Parameters
+ ----------
+ params: Object
+ SGD trainer parameters object.
+
+ Returns
+ -------
+ out: Object
+ Serialized object.
+
+ Examples
+ --------
+ > var params = {
+ ... 'penaltyParams': new {{alias:@stdlib/array/float64}}( [ 2.5, 0.0 ] ),
+ ... 'learningRateParams': new {{alias:@stdlib/array/float64}}( [ 0.01, 0.0 ] ),
+ ... 'lossFunctionParams': new {{alias:@stdlib/array/float64}}( [ 0.0 ] ),
+ ... 'intercept': 0.0,
+ ... 'maxIter': 1000,
+ ... 'penalty': 'l2',
+ ... 'learningRate': 'constant',
+ ... 'lossFunction': 'hinge',
+ ... 'fitIntercept': true,
+ ... 'method': 'Stochastic Gradient Descent'
+ ... };
+ > var o = {{alias}}( params )
+ {...}
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/types/index.d.ts
new file mode 100644
index 000000000000..989e057aeedb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/types/index.d.ts
@@ -0,0 +1,152 @@
+/*
+* @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
+
+/**
+* Interface describing SGD trainer parameters.
+*/
+interface Params {
+ /**
+ * Parameters specific to the regularization function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the penalty:
+ *
+ * - **l1**: `[ lambda, 0.0 ]`
+ * - **l2**: `[ lambda, 0.0 ]`
+ * - **elasticnet**: `[ lambda, l1Ratio ]`
+ * - **none**: `[ 0.0, 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ * - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+ */
+ penaltyParams: Float64Array | Float32Array;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the learning rate scheduler:
+ *
+ * - **basic**: `[ 0.0, 0.0 ]` (unused)
+ * - **constant**: `[ eta0, 0.0 ]`
+ * - **invscaling**: `[ eta0, powerT ]`
+ * - **pegasos**: `[ lambda, 0.0 ]`
+ *
+ * where:
+ *
+ * - **eta0**: initial learning rate.
+ * - **powerT**: exponent controlling how quickly the learning rate decreases.
+ * - **lambda**: regularization parameter.
+ */
+ learningRateParams: Float64Array | Float32Array;
+
+ /**
+ * Parameters specific to the loss function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `1`. The expected array contents depend on the loss function:
+ *
+ * - **epsilon-insensitive**: `[ epsilon ]`
+ * - **squared-epsilon-insensitive**: `[ epsilon ]`
+ * - **huber**: `[ threshold ]`
+ * - all other loss functions: `[ 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ * - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+ */
+ lossFunctionParams: Float64Array | Float32Array;
+
+ /**
+ * Initial intercept value.
+ *
+ * ## Notes
+ *
+ * - Only applicable when `fitIntercept` is `true`.
+ */
+ intercept: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty: string;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate: string;
+
+ /**
+ * Loss function.
+ */
+ lossFunction: string;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ *
+ * ## Notes
+ *
+ * - If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+ */
+ fitIntercept: boolean;
+}
+
+/**
+* Serializes an SGD trainer parameters object as a JSON object.
+*
+* @param params - SGD trainer parameters object
+* @returns serialized object
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var params = {
+* 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+* 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+* 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+* 'intercept': 0.0,
+* 'maxIter': 1000,
+* 'penalty': 'l2',
+* 'learningRate': 'constant',
+* 'lossFunction': 'hinge',
+* 'fitIntercept': true,
+* 'method': 'Stochastic Gradient Descent'
+* };
+*
+* var obj = params2json( params );
+* // returns {...}
+*/
+declare function params2json( params: Params ): Params;
+
+
+// EXPORTS //
+
+export = params2json;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/types/test.ts
new file mode 100644
index 000000000000..0ab476959204
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/docs/types/test.ts
@@ -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.
+*/
+
+import params2json = require( './index' );
+
+
+// TESTS //
+
+// The function returns an object...
+{
+ const params = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 1000,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true,
+ 'method': 'Stochastic Gradient Descent'
+ };
+ params2json( params ); // $ExpectType Params
+}
+
+// The compiler throws an error if not provided a parameters object...
+{
+ params2json( 10 ); // $ExpectError
+ params2json( true ); // $ExpectError
+ params2json( false ); // $ExpectError
+ params2json( null ); // $ExpectError
+ params2json( undefined ); // $ExpectError
+ params2json( [] ); // $ExpectError
+ params2json( {} ); // $ExpectError
+ params2json( ( x: number ): number => x ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/examples/index.js
new file mode 100644
index 000000000000..e16eaa835d95
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/examples/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';
+
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var resolveLREnum = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' );
+var resolveLossFunctionEnum = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' );
+var resolvePenaltyEnum = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' );
+var Float64Array = require( '@stdlib/array/float64' );
+var params2json = require( './../lib' );
+
+var params = new Float64Params();
+params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+params.intercept = 0.0;
+params.maxIter = 500;
+params.penalty = resolvePenaltyEnum( 'l2' );
+params.learningRate = resolveLREnum( 'constant' );
+params.lossFunction = resolveLossFunctionEnum( 'hinge' );
+params.fitIntercept = true;
+
+var o = params2json( params );
+console.log( o );
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/lib/index.js
new file mode 100644
index 000000000000..25819128cd2f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/lib/index.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';
+
+/**
+* Serialize an SGD trainer parameters object as a JSON object.
+*
+* @module @stdlib/ml/base/sgd/params/to-json
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var params2json = require( '@stdlib/ml/base/sgd/params/to-json' );
+*
+* var params = {
+* 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+* 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+* 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+* 'intercept': 0.0,
+* 'maxIter': 1000,
+* 'penalty': 'l2',
+* 'learningRate': 'constant',
+* 'lossFunction': 'hinge',
+* 'fitIntercept': true,
+* 'method': 'Stochastic Gradient Descent'
+* };
+*
+* var obj = params2json( params );
+* // returns {...}
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/lib/main.js
new file mode 100644
index 000000000000..742f69482d22
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/lib/main.js
@@ -0,0 +1,71 @@
+/**
+* @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 typedarray2json = require( '@stdlib/array/to-json' );
+
+
+// MAIN //
+
+/**
+* Serializes an SGD trainer parameters object as a JSON object.
+*
+* @param {Object} params - SGD trainer parameters object
+* @returns {Object} serialized object
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var params = {
+* 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+* 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+* 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+* 'intercept': 0.0,
+* 'maxIter': 1000,
+* 'penalty': 'l2',
+* 'learningRate': 'constant',
+* 'lossFunction': 'hinge',
+* 'fitIntercept': true,
+* 'method': 'Stochastic Gradient Descent'
+* };
+*
+* var obj = toJSON( params );
+* // returns {...}
+*/
+function toJSON( params ) {
+ return {
+ 'fitIntercept': params.fitIntercept,
+ 'intercept': params.intercept,
+ 'maxIter': params.maxIter,
+ 'penalty': params.penalty,
+ 'learningRate': params.learningRate,
+ 'lossFunction': params.lossFunction,
+ 'penaltyParams': typedarray2json( params.penaltyParams ),
+ 'learningRateParams': typedarray2json( params.learningRateParams ),
+ 'lossFunctionParams': typedarray2json( params.lossFunctionParams ),
+ 'method': params.method
+ };
+}
+
+
+// EXPORTS //
+
+module.exports = toJSON;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/package.json b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/package.json
new file mode 100644
index 000000000000..906f1ca1d19e
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/package.json
@@ -0,0 +1,65 @@
+{
+ "name": "@stdlib/ml/base/sgd/params/to-json",
+ "version": "0.0.0",
+ "description": "Serialize an SGD trainer parameters object as a JSON object.",
+ "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",
+ "sgd",
+ "stochastic gradient descent",
+ "params",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "json"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/test/test.js
new file mode 100644
index 000000000000..341fbfddef02
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-json/test/test.js
@@ -0,0 +1,86 @@
+/**
+* @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 Float64Array = require( '@stdlib/array/float64' );
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var resolveLREnum = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' );
+var resolveLossFunctionEnum = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' );
+var resolvePenaltyEnum = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' );
+var params2json = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof params2json, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to JSON', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ expected = {
+ 'penaltyParams': {
+ 'type': 'Float64Array',
+ 'data': [ 2.5, 0.0 ]
+ },
+ 'learningRateParams': {
+ 'type': 'Float64Array',
+ 'data': [ 0.01, 0.0 ]
+ },
+ 'lossFunctionParams': {
+ 'type': 'Float64Array',
+ 'data': [ 0.0 ]
+ },
+ 'intercept': 0.0,
+ 'maxIter': 1000,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true,
+ 'method': 'Stochastic Gradient Descent'
+ };
+
+ actual = params2json( value );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/README.md b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/README.md
new file mode 100644
index 000000000000..640c3db78ca1
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/README.md
@@ -0,0 +1,152 @@
+
+
+# params2str
+
+> Serialize an SGD trainer parameters object as a formatted string.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var params2str = require( '@stdlib/ml/base/sgd/params/to-string' );
+```
+
+#### params2str( params\[, options] )
+
+Serializes an SGD trainer parameters object as a formatted string.
+
+```javascript
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+
+var params = new Float64Params();
+
+// ...
+
+var s = params2str( params );
+// returns
+```
+
+The function supports the following parameters:
+
+- **params**: SGD trainer parameters object.
+- **options**: function options.
+
+The function supports the following options:
+
+- **digits**: number of digits to display after decimal points. Default: `4`.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- Example output:
+
+ ```text
+
+ Stochastic Gradient Descent
+
+ penalty: l2
+ learning rate: constant
+ loss function: hinge
+ lambda: 2.5000
+ eta0: 0.0100
+ fit intercept: true
+ intercept: 0.0000
+ max iterations: 1000
+
+ ```
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var Float64Array = require( '@stdlib/array/float64' );
+var params2str = require( '@stdlib/ml/base/sgd/params/to-string' );
+
+var params = new Float64Params();
+params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+params.intercept = 0.0;
+params.maxIter = 500;
+params.penalty = 'l2';
+params.learningRate = 'constant';
+params.lossFunction = 'hinge';
+params.fitIntercept = true;
+
+var s = params2str( params );
+console.log( s );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/benchmark/benchmark.js
new file mode 100644
index 000000000000..ede8648504cf
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/benchmark/benchmark.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 bench = require( '@stdlib/bench' );
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var Float32Params = require( '@stdlib/ml/base/sgd/params/float32' );
+var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
+var pkg = require( './../package.json' ).name;
+var params2str = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ new Float64Params(),
+ new Float32Params()
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = params2str( values[ i%values.length ] );
+ if ( typeof v !== 'string' ) {
+ b.fail( 'should return a string' );
+ }
+ }
+ b.toc();
+ if ( !isString( v ) ) {
+ b.fail( 'should return a string' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/repl.txt
new file mode 100644
index 000000000000..3a438232574a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/repl.txt
@@ -0,0 +1,40 @@
+
+{{alias}}( params[, options] )
+ Serializes an SGD trainer parameters object as a formatted string.
+
+ Parameters
+ ----------
+ params: Object
+ SGD trainer parameters object.
+
+ options: Object (optional)
+ Function options.
+
+ options.digits: number (optional)
+ Number of digits to display after decimal points. Default: 4.
+
+ Returns
+ -------
+ out: string
+ Serialized parameters.
+
+ Examples
+ --------
+ > var params = {
+ ... 'penaltyParams': new {{alias:@stdlib/array/float64}}( [ 2.5, 0.0 ] ),
+ ... 'learningRateParams': new {{alias:@stdlib/array/float64}}( [ 0.01, 0.0 ] ),
+ ... 'lossFunctionParams': new {{alias:@stdlib/array/float64}}( [ 0.0 ] ),
+ ... 'intercept': 0.0,
+ ... 'maxIter': 1000,
+ ... 'penalty': 'l2',
+ ... 'learningRate': 'constant',
+ ... 'lossFunction': 'hinge',
+ ... 'fitIntercept': true,
+ ... 'method': 'Stochastic Gradient Descent'
+ ... };
+ > var s = {{alias}}( params )
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/types/index.d.ts
new file mode 100644
index 000000000000..bc542a388299
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/types/index.d.ts
@@ -0,0 +1,183 @@
+/*
+* @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
+
+/**
+* Interface describing SGD trainer parameters.
+*/
+interface Params {
+ /**
+ * Parameters specific to the regularization function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the penalty:
+ *
+ * - **l1**: `[ lambda, 0.0 ]`
+ * - **l2**: `[ lambda, 0.0 ]`
+ * - **elasticnet**: `[ lambda, l1Ratio ]`
+ * - **none**: `[ 0.0, 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **lambda**: regularization parameter which determines the amount of shrinkage inflicted on the model coefficients.
+ * - **l1Ratio**: mixing parameter on the interval `[0,1]` which determines the relative contribution of the L1 and L2 penalties.
+ */
+ penaltyParams: Float64Array | Float32Array;
+
+ /**
+ * Parameters specific to the learning rate scheduler being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `2`, with any unused elements set to zero. The expected array contents depend on the learning rate scheduler:
+ *
+ * - **basic**: `[ 0.0, 0.0 ]` (unused)
+ * - **constant**: `[ eta0, 0.0 ]`
+ * - **invscaling**: `[ eta0, powerT ]`
+ * - **pegasos**: `[ lambda, 0.0 ]`
+ *
+ * where:
+ *
+ * - **eta0**: initial learning rate.
+ * - **powerT**: exponent controlling how quickly the learning rate decreases.
+ * - **lambda**: regularization parameter.
+ */
+ learningRateParams: Float64Array | Float32Array;
+
+ /**
+ * Parameters specific to the loss function being used.
+ *
+ * ## Notes
+ *
+ * - Must be an array having length `1`. The expected array contents depend on the loss function:
+ *
+ * - **epsilon-insensitive**: `[ epsilon ]`
+ * - **squared-epsilon-insensitive**: `[ epsilon ]`
+ * - **huber**: `[ threshold ]`
+ * - all other loss functions: `[ 0.0 ]` (unused)
+ *
+ * where:
+ *
+ * - **epsilon**: insensitivity parameter (i.e., errors whose absolute value is less than `epsilon` incur no penalty).
+ * - **threshold**: error magnitude at which the loss transitions from squared-error loss to linear loss.
+ */
+ lossFunctionParams: Float64Array | Float32Array;
+
+ /**
+ * Initial intercept value.
+ *
+ * ## Notes
+ *
+ * - Only applicable when `fitIntercept` is `true`.
+ */
+ intercept: number;
+
+ /**
+ * Maximum number of iterations to run.
+ */
+ maxIter: number;
+
+ /**
+ * Regularization function.
+ */
+ penalty: string;
+
+ /**
+ * Learning rate scheduler.
+ */
+ learningRate: string;
+
+ /**
+ * Loss function.
+ */
+ lossFunction: string;
+
+ /**
+ * Boolean indicating whether to include intercept.
+ *
+ * ## Notes
+ *
+ * - If `true`, an element equal to one is implicitly added to each provided feature vector. If `false`, the model assumes that feature vectors are already centered.
+ */
+ fitIntercept: boolean;
+}
+
+/**
+* Interface describing function options.
+*/
+interface Options {
+ /**
+ * Number of digits to display after decimal points. Default: 4.
+ */
+ digits?: number;
+}
+
+/**
+* Serializes an SGD trainer parameters object as a formatted string.
+*
+* ## Notes
+*
+* - Example output:
+*
+* ```text
+*
+* Stochastic Gradient Descent
+*
+* penalty: l2
+* learning rate: constant
+* loss function: hinge
+* lambda: 2.5000
+* eta0: 0.0100
+* fit intercept: true
+* intercept: 0.0000
+* max iterations: 1000
+*
+* ```
+*
+* @param params - SGD trainer parameters object
+* @param options - options object
+* @param options.digits - number of digits to display after decimal points
+* @returns serialized parameters
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var params = {
+* 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+* 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+* 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+* 'intercept': 0.0,
+* 'maxIter': 1000,
+* 'penalty': 'l2',
+* 'learningRate': 'constant',
+* 'lossFunction': 'hinge',
+* 'fitIntercept': true,
+* 'method': 'Stochastic Gradient Descent'
+* };
+*
+* var str = params2str( params );
+* // returns
+*/
+declare function params2str( params: Params, options?: Options ): string;
+
+
+// EXPORTS //
+
+export = params2str;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/types/test.ts
new file mode 100644
index 000000000000..086bde2d6866
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/docs/types/test.ts
@@ -0,0 +1,110 @@
+/*
+* @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 params2str = require( './index' );
+
+
+// TESTS //
+
+// The function returns a string...
+{
+ const params = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 1000,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true,
+ 'method': 'Stochastic Gradient Descent'
+ };
+ params2str( params ); // $ExpectType string
+ params2str( params, {} ); // $ExpectType string
+}
+
+// The compiler throws an error if provided first argument which is not a parameters object...
+{
+ params2str( '10' ); // $ExpectError
+ params2str( 10 ); // $ExpectError
+ params2str( true ); // $ExpectError
+ params2str( false ); // $ExpectError
+ params2str( null ); // $ExpectError
+ params2str( undefined ); // $ExpectError
+ params2str( [] ); // $ExpectError
+ params2str( {} ); // $ExpectError
+ params2str( ( x: number ): number => x ); // $ExpectError
+
+ params2str( '10', {} ); // $ExpectError
+ params2str( 10, {} ); // $ExpectError
+ params2str( true, {} ); // $ExpectError
+ params2str( false, {} ); // $ExpectError
+ params2str( null, {} ); // $ExpectError
+ params2str( undefined, {} ); // $ExpectError
+ params2str( [], {} ); // $ExpectError
+ params2str( {}, {} ); // $ExpectError
+ params2str( ( x: number ): number => x, {} ); // $ExpectError
+}
+
+// The compiler throws an error if provided a second argument which is not an object...
+{
+ const params = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 1000,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true,
+ 'method': 'Stochastic Gradient Descent'
+ };
+
+ params2str( params, '10' ); // $ExpectError
+ params2str( params, 10 ); // $ExpectError
+ params2str( params, true ); // $ExpectError
+ params2str( params, false ); // $ExpectError
+ params2str( params, null ); // $ExpectError
+ params2str( params, [] ); // $ExpectError
+ params2str( params, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if provided a `digits` option which is not a number...
+{
+ const params = {
+ 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+ 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+ 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+ 'intercept': 0.0,
+ 'maxIter': 1000,
+ 'penalty': 'l2',
+ 'learningRate': 'constant',
+ 'lossFunction': 'hinge',
+ 'fitIntercept': true,
+ 'method': 'Stochastic Gradient Descent'
+ };
+
+ params2str( params, { 'digits': '10' } ); // $ExpectError
+ params2str( params, { 'digits': true } ); // $ExpectError
+ params2str( params, { 'digits': false } ); // $ExpectError
+ params2str( params, { 'digits': null } ); // $ExpectError
+ params2str( params, { 'digits': [] } ); // $ExpectError
+ params2str( params, { 'digits': {} } ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/examples/index.js
new file mode 100644
index 000000000000..3074c0840bb4
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/examples/index.js
@@ -0,0 +1,37 @@
+/**
+* @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 Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var Float64Array = require( '@stdlib/array/float64' );
+var params2str = require( './../lib' );
+
+var params = new Float64Params();
+params.penaltyParams = new Float64Array( [ 2.5, 0.0 ] );
+params.learningRateParams = new Float64Array( [ 0.01, 0.0 ] );
+params.lossFunctionParams = new Float64Array( [ 0.0 ] );
+params.intercept = 0.0;
+params.maxIter = 500;
+params.penalty = 'l2';
+params.learningRate = 'constant';
+params.lossFunction = 'hinge';
+params.fitIntercept = true;
+
+var s = params2str( params );
+console.log( s );
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/lib/index.js
new file mode 100644
index 000000000000..c7bda3cf4657
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/lib/index.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';
+
+/**
+* Serialize an SGD trainer parameters object as a formatted string.
+*
+* @module @stdlib/ml/base/sgd/params/to-string
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var params2str = require( '@stdlib/ml/base/sgd/params/to-string' );
+*
+* var params = {
+* 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+* 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+* 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+* 'intercept': 0.0,
+* 'maxIter': 1000,
+* 'penalty': 'l2',
+* 'learningRate': 'constant',
+* 'lossFunction': 'hinge',
+* 'fitIntercept': true,
+* 'method': 'Stochastic Gradient Descent'
+* };
+*
+* var str = params2str( params );
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/lib/main.js
new file mode 100644
index 000000000000..772b22e7708d
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/lib/main.js
@@ -0,0 +1,141 @@
+/**
+* @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 isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
+var isObject = require( '@stdlib/assert/is-plain-object' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var format = require( '@stdlib/string/format' );
+
+
+// MAIN //
+
+/**
+* Serializes an SGD trainer parameters object as a formatted string.
+*
+* ## Notes
+*
+* - Example output:
+*
+* ```text
+*
+* Stochastic Gradient Descent
+*
+* penalty: l2
+* learning rate: constant
+* loss function: hinge
+* lambda: 2.5000
+* eta0: 0.0100
+* fit intercept: true
+* intercept: 0.0000
+* max iterations: 1000
+*
+* ```
+*
+* @param {Object} params - SGD trainer parameters object
+* @param {Options} [opts] - options object
+* @param {PositiveInteger} [opts.digits=4] - number of digits to display after decimal points
+* @throws {TypeError} options argument must be an object
+* @throws {TypeError} must provide valid options
+* @returns {string} serialized parameters
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var params = {
+* 'penaltyParams': new Float64Array( [ 2.5, 0.0 ] ),
+* 'learningRateParams': new Float64Array( [ 0.01, 0.0 ] ),
+* 'lossFunctionParams': new Float64Array( [ 0.0 ] ),
+* 'intercept': 0.0,
+* 'maxIter': 1000,
+* 'penalty': 'l2',
+* 'learningRate': 'constant',
+* 'lossFunction': 'hinge',
+* 'fitIntercept': true,
+* 'method': 'Stochastic Gradient Descent'
+* };
+*
+* var str = toString( params );
+* // returns
+*/
+function toString( params, opts ) { // eslint-disable-line stdlib/no-redeclare
+ var fitIntercept;
+ var dgts;
+ var out;
+
+ dgts = 4;
+ if ( arguments.length > 1 ) {
+ if ( !isObject( opts ) ) {
+ throw new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', opts ) );
+ }
+ if ( hasOwnProp( opts, 'digits' ) ) {
+ if ( !isPositiveInteger( opts.digits ) ) {
+ throw new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', opts.digits ) );
+ }
+ dgts = opts.digits;
+ }
+ }
+
+ fitIntercept = 'false';
+ if ( params.fitIntercept === true ) {
+ fitIntercept = 'true';
+ }
+
+ out = [
+ '',
+ params.method,
+ '',
+ format( ' penalty: %s', params.penalty ),
+ format( ' learning rate: %s', params.learningRate ),
+ format( ' loss function: %s', params.lossFunction )
+ ];
+ if ( params.penalty !== 'none' ) {
+ out.push( format( ' lambda: %0.'+dgts+'f', params.penaltyParams[ 0 ] ) );
+ if ( params.penalty === 'elasticnet' ) {
+ out.push( format( ' l1 ratio: %0.'+dgts+'f', params.penaltyParams[ 1 ] ) );
+ }
+ }
+ if ( params.learningRate === 'constant' ) {
+ out.push( format( ' eta0: %0.'+dgts+'f', params.learningRateParams[ 0 ] ) );
+ } else if ( params.learningRate === 'invscaling' ) {
+ out.push( format( ' eta0: %0.'+dgts+'f', params.learningRateParams[ 0 ] ) );
+ out.push( format( ' powerT: %0.'+dgts+'f', params.learningRateParams[ 1 ] ) );
+ } else if ( params.learningRate === 'pegasos' && params.penalty === 'none' ) {
+ out.push( format( ' lambda: %0.'+dgts+'f', params.learningRateParams[ 0 ] ) );
+ }
+ if ( params.lossFunction === 'epsilon-insensitive' || params.lossFunction === 'squared-epsilon-insensitive' ) {
+ out.push( format( ' epsilon: %0.'+dgts+'f', params.lossFunctionParams[ 0 ] ) );
+ } else if ( params.lossFunction === 'huber' ) {
+ out.push( format( ' huber threshold: %0.'+dgts+'f', params.lossFunctionParams[ 0 ] ) );
+ }
+ out.push( format( ' fit intercept: %s', fitIntercept ) );
+ if ( params.fitIntercept === true ) {
+ out.push( format( ' intercept: %0.'+dgts+'f', params.intercept ) );
+ }
+ out.push( format( ' max iterations: %d', params.maxIter ) );
+ out.push( '' );
+ return out.join( '\n' );
+}
+
+
+// EXPORTS //
+
+module.exports = toString;
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/package.json b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/package.json
new file mode 100644
index 000000000000..4ff859aa6e08
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/package.json
@@ -0,0 +1,65 @@
+{
+ "name": "@stdlib/ml/base/sgd/params/to-string",
+ "version": "0.0.0",
+ "description": "Serialize an SGD trainer parameters object as a formatted 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",
+ "sgd",
+ "stochastic gradient descent",
+ "params",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "string"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/test/test.js
new file mode 100644
index 000000000000..cab2b23980e8
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/sgd/params/to-string/test/test.js
@@ -0,0 +1,581 @@
+/**
+* @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 isString = require( '@stdlib/assert/is-string' ).isPrimitive;
+var Float64Array = require( '@stdlib/array/float64' );
+var Float64Params = require( '@stdlib/ml/base/sgd/params/float64' );
+var resolveLREnum = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' );
+var resolveLossFunctionEnum = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' );
+var resolvePenaltyEnum = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' );
+var params2str = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof params2str, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a second argument which is not an object', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = new Float64Params();
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params2str( params, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `digits` option which is not a positive integer', function test( t ) {
+ var params;
+ var values;
+ var i;
+
+ params = new Float64Params();
+
+ values = [
+ '5',
+ -5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ params2str( params, {
+ 'digits': value
+ });
+ };
+ }
+});
+
+tape( 'the function serializes a parameters object to a string (l1,l2 penalty)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: constant',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' eta0: 0.0100',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (elasticnet penalty)', function test( t ) {
+ var expected;
+ var l1Ratio;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ l1Ratio = 0.6;
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, l1Ratio ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'elasticnet' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: elasticnet',
+ ' learning rate: constant',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' l1 ratio: 0.6000',
+ ' eta0: 0.0100',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (no penalty)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'none' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: none',
+ ' learning rate: constant',
+ ' loss function: hinge',
+ ' eta0: 0.0100',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (basic learning rate)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+
+ lambda = 2.5;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ 0.0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'basic' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: basic',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (constant learning rate)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: constant',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' eta0: 0.0100',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (invscaling learning rate)', function test( t ) {
+ var expected;
+ var powerT;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ powerT = 2.0;
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, powerT ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'invscaling' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: invscaling',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' eta0: 0.0100',
+ ' powerT: 2.0000',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (pegasos learning rate)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+
+ lambda = 2.5;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ lambda, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'pegasos' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: pegasos',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (epsilon insensitive, squared epsilon insensitive loss function)', function test( t ) {
+ var expected;
+ var epsilon;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ epsilon = 0.2;
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ epsilon ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'squared-epsilon-insensitive' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: constant',
+ ' loss function: squared-epsilon-insensitive',
+ ' lambda: 2.5000',
+ ' eta0: 0.0100',
+ ' epsilon: 0.2000',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (huber loss function)', function test( t ) {
+ var threshold;
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ threshold = 0.2;
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ threshold ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'huber' );
+ value.fitIntercept = true;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: constant',
+ ' loss function: huber',
+ ' lambda: 2.5000',
+ ' eta0: 0.0100',
+ ' huber threshold: 0.2000',
+ ' fit intercept: true',
+ ' intercept: 0.0000',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function serializes a parameters object to a string (no intercept)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = false;
+
+ actual = params2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: constant',
+ ' loss function: hinge',
+ ' lambda: 2.5000',
+ ' eta0: 0.0100',
+ ' fit intercept: false',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the number of displayed digits (digits=2)', function test( t ) {
+ var expected;
+ var lambda;
+ var actual;
+ var value;
+ var eta0;
+
+ lambda = 2.5;
+ eta0 = 0.01;
+
+ value = new Float64Params();
+ value.penaltyParams = new Float64Array( [ lambda, 0.0 ] );
+ value.learningRateParams = new Float64Array( [ eta0, 0.0 ] );
+ value.lossFunctionParams = new Float64Array( [ 0.0 ] );
+ value.intercept = 0.0;
+ value.maxIter = 1000;
+ value.penalty = resolvePenaltyEnum( 'l2' );
+ value.learningRate = resolveLREnum( 'constant' );
+ value.lossFunction = resolveLossFunctionEnum( 'hinge' );
+ value.fitIntercept = true;
+
+ actual = params2str( value, {
+ 'digits': 2
+ });
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'Stochastic Gradient Descent',
+ '',
+ ' penalty: l2',
+ ' learning rate: constant',
+ ' loss function: hinge',
+ ' lambda: 2.50',
+ ' eta0: 0.01',
+ ' fit intercept: true',
+ ' intercept: 0.00',
+ ' max iterations: 1000',
+ ''
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});