diff --git a/lib/node_modules/@stdlib/ml/incr/binary-classification/README.md b/lib/node_modules/@stdlib/ml/incr/binary-classification/README.md index a61ee837f712..623d94e47b27 100644 --- a/lib/node_modules/@stdlib/ml/incr/binary-classification/README.md +++ b/lib/node_modules/@stdlib/ml/incr/binary-classification/README.md @@ -58,9 +58,9 @@ The function accepts the following `options`: - `hinge`: hinge loss function. Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data. - `log`: logistic loss function. Corresponds to Logistic Regression. - - `modifiedHuber`: Huber loss function [variant][@zhang:2004a] for classification. + - `modified-huber`: Huber loss function [variant][@zhang:2004a] for classification. - `perceptron`: hinge loss function without a margin. Corresponds to the original perceptron by Rosenblatt (1957). - - `squaredHinge`: squared hinge loss function SVM (L2-SVM). + - `squared-hinge`: squared hinge loss function SVM (L2-SVM). Default: `'log'`. @@ -140,7 +140,7 @@ var label = acc.predict( array( [ 0.5, 2.0 ] ) ); Provided an [`ndarray`][@stdlib/ndarray/ctor] having shape `(..., N)`, where `N` is the number of features, the returned [`ndarray`][@stdlib/ndarray/ctor] has shape `(...)` (i.e., the number of dimensions is reduced by one) and data type `float64`. For example, if provided a one-dimensional [`ndarray`][@stdlib/ndarray/ctor], the method returns a zero-dimensional [`ndarray`][@stdlib/ndarray/ctor] whose only element is the predicted response value. -By default, the method returns the predict label (`type='label'`). In order to return a prediction probability of a `+1` response value given either the logistic (`log`) or modified Huber (`modifiedHuber`) loss functions, set the second argument to `'probability'`. +By default, the method returns the predict label (`type='label'`). In order to return a prediction probability of a `+1` response value given either the logistic (`log`) or modified Huber (`modified-huber`) loss functions, set the second argument to `'probability'`. ```javascript var array = require( '@stdlib/ndarray/array' ); diff --git a/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/repl.txt b/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/repl.txt index 6759d75a9bf6..57e7c63c3a2f 100644 --- a/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/repl.txt @@ -68,12 +68,12 @@ - log: logistic loss function. Corresponds to Logistic Regression. - - modifiedHuber: Huber loss function variant for classification. + - modified-huber: Huber loss function variant for classification. - perceptron: hinge loss function without a margin. Corresponds to the original Perceptron by Rosenblatt. - - squaredHinge: squared hinge loss function SVM (L2-SVM). + - squared-hinge: squared hinge loss function SVM (L2-SVM). Default: 'log'. @@ -88,7 +88,7 @@ following: 'label', 'probability', or 'linear'. Default: 'label'. Note that the probability prediction type is only compatible with 'log' - and 'modifiedHuber' loss functions. + and 'modified-huber' loss functions. Examples -------- diff --git a/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/types/index.d.ts index e991eff27285..4083718c83af 100644 --- a/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ml/incr/binary-classification/docs/types/index.d.ts @@ -55,11 +55,11 @@ interface Options { * * - `hinge`: hinge loss function. Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data. * - `log`: logistic loss function. Corresponds to Logistic Regression. - * - `modifiedHuber`: Huber loss function variant for classification. + * - `modified-huber`: Huber loss function variant for classification. * - `perceptron`: hinge loss function without a margin. Corresponds to the original Perceptron by Rosenblatt. - * - `squaredHinge`: squared hinge loss function SVM (L2-SVM). + * - `squared-hinge`: squared hinge loss function SVM (L2-SVM). */ - loss?: 'hinge' | 'log' | 'modifiedHuber' | 'perceptron' | 'squaredHinge'; + loss?: 'hinge' | 'log' | 'modified-huber' | 'perceptron' | 'squared-hinge'; /** * Boolean indicating whether to include an intercept (default: `true`). diff --git a/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/loss_functions.json b/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/loss_functions.json index dc5aebab6b5c..d33f3d828e30 100644 --- a/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/loss_functions.json +++ b/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/loss_functions.json @@ -1,7 +1,7 @@ [ "hinge", "log", - "modifiedHuber", + "modified-huber", "perceptron", - "squaredHinge" -] + "squared-hinge" +] \ No newline at end of file diff --git a/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/main.js b/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/main.js index b72ebbaeeb63..faf435acc4bc 100644 --- a/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/main.js +++ b/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/main.js @@ -47,7 +47,7 @@ var validate = require( './validate.js' ); * @param {Options} [options] - options object * @param {PositiveNumber} [options.lambda=1.0e-3] - regularization parameter * @param {ArrayLikeObject} [options.learningRate=['basic']] - learning rate function and associated parameters (one of `basic`, `constant`, or `pegasos`) -* @param {string} [options.loss='log'] - loss function (one of `hinge`, `log`, `modifiedHuber`, `perceptron`, or `squaredHinge`) +* @param {string} [options.loss='log'] - loss function (one of `hinge`, `log`, `modified-huber`, `perceptron`, or `squared-hinge`) * @param {boolean} [options.intercept=true] - boolean indicating whether to include an intercept * @throws {TypeError} first argument must be a positive integer * @throws {TypeError} options argument must be an object @@ -190,8 +190,8 @@ function incrBinaryClassification( N, options ) { t = 'label'; if ( arguments.length > 1 ) { if ( type === 'probability' ) { - if ( opts.loss !== 'log' && opts.loss !== 'modifiedHuber' ) { - throw new Error( format( 'invalid argument. Second argument is incompatible with model loss function. Probability predictions are only supported when the loss function is one of the following: "%s". Model loss function: `%s`.', [ 'log', 'modifiedHuber' ].join( '", "' ), opts.loss ) ); + if ( opts.loss !== 'log' && opts.loss !== 'modified-huber' ) { + throw new Error( format( 'invalid argument. Second argument is incompatible with model loss function. Probability predictions are only supported when the loss function is one of the following: "%s". Model loss function: `%s`.', [ 'log', 'modified-huber' ].join( '", "' ), opts.loss ) ); } } else if ( type !== 'label' && type !== 'linear' ) { throw new TypeError( format( 'invalid argument. Second argument must be a string value equal to either "label", "probability", or "linear". Value: `%s`.', type ) ); diff --git a/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/model.js b/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/model.js index 69f543905fd3..6e7448b3e551 100644 --- a/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/model.js +++ b/lib/node_modules/@stdlib/ml/incr/binary-classification/lib/model.js @@ -53,9 +53,9 @@ var LEARNING_RATE_METHODS = { var LOSS_METHODS = { 'hinge': '_hingeLoss', 'log': '_logLoss', - 'modifiedHuber': '_modifiedHuberLoss', + 'modified-huber': '_modifiedHuberLoss', 'perceptron': '_perceptronLoss', - 'squaredHinge': '_squaredHingeLoss' + 'squared-hinge': '_squaredHingeLoss' }; diff --git a/lib/node_modules/@stdlib/ml/incr/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/incr/docs/types/index.d.ts index feb77555565b..a4400d2386d4 100644 --- a/lib/node_modules/@stdlib/ml/incr/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ml/incr/docs/types/index.d.ts @@ -161,7 +161,7 @@ interface Namespace { * @param options.eta0 - constant learning rate (default: 0.02) * @param options.lambda - regularization parameter (default: 1e-3) * @param options.learningRate - string denoting the learning rate to use. Can be `constant`, `pegasos`, or `basic` (default: 'basic') - * @param options.loss - string denoting the loss function to use. Can be `squaredError`, `epsilonInsensitive`, or `huber` (default: 'squaredError') + * @param options.loss - string denoting the loss function to use. Can be `squared-error`, `epsilon-insensitive`, or `huber` (default: 'squared-error') * @param options.intercept - boolean indicating whether to include an intercept (default: true) * @throws must provide valid options * @returns regression model diff --git a/lib/node_modules/@stdlib/ml/incr/sgd-regression/README.md b/lib/node_modules/@stdlib/ml/incr/sgd-regression/README.md index cb8768435673..0c1c1dc9da04 100644 --- a/lib/node_modules/@stdlib/ml/incr/sgd-regression/README.md +++ b/lib/node_modules/@stdlib/ml/incr/sgd-regression/README.md @@ -56,7 +56,7 @@ for ( i = 0; i < 100000; i++ ) { The function accepts the following `options`: - **learningRate**: `string` denoting the learning rate to use. Can be `constant`, `pegasos` or `basic`. Default: `basic`. -- **loss**: `string` denoting the loss function to use. Can be `squaredError`, `epsilonInsensitive` or `huber`. Default: `squaredError`. +- **loss**: `string` denoting the loss function to use. Can be `squared-error`, `epsilon-insensitive` or `huber`. Default: `squared-error`. - **epsilon**: insensitivity parameter. Default: `0.1`. - **lambda**: regularization parameter. Default: `1e-3`. - **eta0**: constant learning rate. Default: `0.02`. @@ -66,7 +66,7 @@ The function accepts the following `options`: ```javascript var accumulator = incrSGDRegression({ - 'loss': 'squaredError', + 'loss': 'squared-error', 'lambda': 1e-4 }); ``` @@ -81,9 +81,9 @@ The `learningRate` decides how fast or slow the weights will be updated towards The used loss function is specified via the `loss` option. The available options are: -- **epsilonInsensitive**: Penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise. +- **epsilon-insensitive**: Penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise. - **huber**: Squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise. Should be used in order to decrease the influence of outliers on the model fit. -- **squaredError**: Squared error loss, i.e. the squared difference of the observed and fitted values. +- **squared-error**: Squared error loss, i.e. the squared difference of the observed and fitted values. The `lambda` parameter determines the amount of shrinkage inflicted on the model coefficients: @@ -232,7 +232,7 @@ rnorm = normal.factory( 0.0, 1.0 ); // Create model: accumulator = incrSGDRegression({ 'lambda': 1e-7, - 'loss': 'squaredError', + 'loss': 'squared-error', 'intercept': true }); diff --git a/lib/node_modules/@stdlib/ml/incr/sgd-regression/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/incr/sgd-regression/docs/types/index.d.ts index 9498397090bf..a14c2d3bf35f 100644 --- a/lib/node_modules/@stdlib/ml/incr/sgd-regression/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ml/incr/sgd-regression/docs/types/index.d.ts @@ -47,9 +47,9 @@ interface Options { learningRate?: 'constant' | 'pegasos' | 'basic'; /** - * String denoting the loss function to use. Can be `squaredError`, `epsilonInsensitive`, or `huber` (default: 'squaredError'). + * String denoting the loss function to use. Can be `squared-error`, `epsilon-insensitive`, or `huber` (default: 'squared-error'). */ - loss?: 'squaredError' | 'epsilonInsensitive' | 'huber'; + loss?: 'squared-error' | 'epsilon-insensitive' | 'huber'; /** * Boolean indicating whether to include an intercept (default: true). @@ -113,7 +113,7 @@ interface Model { * @param options.eta0 - constant learning rate (default: 0.02) * @param options.lambda - regularization parameter (default: 1e-3) * @param options.learningRate - string denoting the learning rate to use. Can be `constant`, `pegasos`, or `basic` (default: 'basic') -* @param options.loss - string denoting the loss function to use. Can be `squaredError`, `epsilonInsensitive`, or `huber` (default: 'squaredError') +* @param options.loss - string denoting the loss function to use. Can be `squared-error`, `epsilon-insensitive`, or `huber` (default: 'squared-error') * @param options.intercept - boolean indicating whether to include an intercept (default: true) * @throws must provide valid options * @returns regression model diff --git a/lib/node_modules/@stdlib/ml/incr/sgd-regression/examples/index.js b/lib/node_modules/@stdlib/ml/incr/sgd-regression/examples/index.js index 2fda2a2d1b80..108fff94bb03 100644 --- a/lib/node_modules/@stdlib/ml/incr/sgd-regression/examples/index.js +++ b/lib/node_modules/@stdlib/ml/incr/sgd-regression/examples/index.js @@ -34,7 +34,7 @@ rnorm = normal.factory( 0.0, 1.0 ); // Create model: accumulator = incrSGDRegression({ 'lambda': 1e-7, - 'loss': 'squaredError', + 'loss': 'squared-error', 'intercept': true }); diff --git a/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/defaults.json b/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/defaults.json index ab0238d867f7..289c8a8cee91 100644 --- a/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/defaults.json +++ b/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/defaults.json @@ -4,5 +4,5 @@ "intercept": true, "lambda": 1e-3, "learningRate": "basic", - "loss": "squaredError" + "loss": "squared-error" } diff --git a/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/main.js b/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/main.js index 6dd6d278e591..a662ea68ba5a 100644 --- a/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/main.js +++ b/lib/node_modules/@stdlib/ml/incr/sgd-regression/lib/main.js @@ -53,7 +53,7 @@ var validate = require( './validate.js' ); * @param {PositiveNumber} [options.eta0=0.02] - constant learning rate * @param {NonNegativeNumber} [options.lambda=1e-3] - regularization parameter * @param {string} [options.learningRate='basic'] - string denoting the learning rate to use. Can be `constant`, `pegasos`, or `basic` -* @param {string} [options.loss='squaredError'] - string denoting the loss function to use. Can be `squaredError`, `epsilonInsensitive`, or `huber` +* @param {string} [options.loss='squared-error'] - string denoting the loss function to use. Can be `squared-error`, `epsilon-insensitive`, or `huber` * @param {boolean} [options.intercept=true] - boolean indicating whether to include an intercept * @throws {TypeError} options argument must be an object * @throws {TypeError} must provide valid options @@ -96,17 +96,17 @@ function incrSGDRegression( options ) { // Set loss function: switch ( opts.loss ) { - case 'epsilonInsensitive': + case 'epsilon-insensitive': _lossfun = epsilonInsensitiveLoss; break; case 'huber': _lossfun = huberLoss; break; - case 'squaredError': + case 'squared-error': _lossfun = squaredErrorLoss; break; default: - throw Error( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'loss', [ 'epsilonInsensitive', 'huber', 'squaredError' ].join( '", "' ), opts.loss ) ); + throw Error( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'loss', [ 'epsilon-insensitive', 'huber', 'squared-error' ].join( '", "' ), opts.loss ) ); } // Set learning rate: diff --git a/lib/node_modules/@stdlib/ml/incr/sgd-regression/test/test.main.js b/lib/node_modules/@stdlib/ml/incr/sgd-regression/test/test.main.js index b5d053a52fba..cc43102415cd 100644 --- a/lib/node_modules/@stdlib/ml/incr/sgd-regression/test/test.main.js +++ b/lib/node_modules/@stdlib/ml/incr/sgd-regression/test/test.main.js @@ -67,9 +67,9 @@ tape( 'the `loss` option of the function specifies the used loss function', func var i; values = [ - 'epsilonInsensitive', + 'epsilon-insensitive', 'huber', - 'squaredError' + 'squared-error' ]; len = values.length;