From 9332f5b59ac125f3c332e3da361b2cff3e25d577 Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Sun, 26 Jul 2026 18:51:02 +0530 Subject: [PATCH 1/2] feat: add `none` value for `penalties` enum --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/ml/base/sgd-classification/penalties/README.md | 4 +++- .../ml/base/sgd-classification/penalties/docs/repl.txt | 1 + .../base/sgd-classification/penalties/docs/types/index.d.ts | 2 +- .../include/stdlib/ml/base/sgd-classification/penalties.h | 5 ++++- .../ml/base/sgd-classification/penalties/lib/data.json | 3 ++- .../ml/base/sgd-classification/penalties/lib/enum.js | 5 ++++- .../ml/base/sgd-classification/penalties/lib/index.js | 2 +- .../ml/base/sgd-classification/penalties/lib/main.js | 2 +- .../ml/base/sgd-classification/penalties/test/test.js | 6 ++++-- .../penalty-enum2str/benchmark/benchmark.js | 3 ++- .../base/sgd-classification/penalty-enum2str/test/test.js | 3 ++- .../penalty-str2enum/benchmark/benchmark.js | 3 ++- .../base/sgd-classification/penalty-str2enum/test/test.js | 3 ++- 13 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md index 1a5ff6f38301..3dd5ea7247e9 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md @@ -46,7 +46,7 @@ Returns a list of SGD classification penalties. ```javascript var out = penalties(); -// e.g., returns [ 'elasticnet', 'l1', 'l2' ] +// e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] ``` The output array contains the following penalties: @@ -54,6 +54,7 @@ The output array contains the following penalties: - `elasticnet`: regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods. - `l1`: L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients. - `l2`: L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients. +- `none`: No regularization. @@ -128,6 +129,7 @@ An enumeration of SGD classification penalties with the following fields: - **STDLIB_ML_SGD_CLASSIFICATION_ELASTICNET**: regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods. - **STDLIB_ML_SGD_CLASSIFICATION_L1**: L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients. - **STDLIB_ML_SGD_CLASSIFICATION_L2**: L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients. +- **STDLIB_ML_SGD_CLASSIFICATION_NONE**: No regularization. ```c #include "stdlib/ml/base/sgd-classification/penalties.h" diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt index e10bf6c27f1f..765ca44a4ebd 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt @@ -11,6 +11,7 @@ - l2: L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients. + - none: No regularization. Returns ------- diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/index.d.ts index 91661323d389..475e72c0abc9 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/index.d.ts @@ -25,7 +25,7 @@ * * @example * var list = penalties(); -* // e.g., returns [ 'elasticnet', 'l1', 'l2' ] +* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] */ declare function penalties(): Array; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/include/stdlib/ml/base/sgd-classification/penalties.h b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/include/stdlib/ml/base/sgd-classification/penalties.h index bcc858d31951..69ffa486e1ad 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/include/stdlib/ml/base/sgd-classification/penalties.h +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/include/stdlib/ml/base/sgd-classification/penalties.h @@ -30,7 +30,10 @@ enum STDLIB_ML_SGD_CLASSIFICATION_PENALTY { STDLIB_ML_SGD_CLASSIFICATION_L1, // L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients: - STDLIB_ML_SGD_CLASSIFICATION_L2 + STDLIB_ML_SGD_CLASSIFICATION_L2, + + // No regularization: + STDLIB_ML_SGD_CLASSIFICATION_NONE }; #endif // !STDLIB_ML_BASE_SGD_CLASSIFICATION_PENALTIES_H diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/data.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/data.json index fc80f4120168..71d176852af9 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/data.json +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/data.json @@ -1,5 +1,6 @@ [ "elasticnet", "l1", - "l2" + "l2", + "none" ] diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js index 09b73316ab5c..4d95c9105670 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js @@ -44,7 +44,10 @@ function enumerated() { 'l1': 1, // L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients: - 'l2': 2 + 'l2': 2, + + // No regularization + 'none': 3 }; } diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/index.js index df720b00907b..0ae898525139 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/index.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/index.js @@ -27,7 +27,7 @@ * var penalties = require( '@stdlib/ml/base/sgd-classification/penalties' ); * * var list = penalties(); -* // e.g., returns [ 'elasticnet', 'l1', 'l2' ] +* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js index 8792f4913113..bd8994668f0a 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js @@ -32,7 +32,7 @@ var DATA = require( './data.json' ); * * @example * var list = penalties(); -* // e.g., returns [ 'elasticnet', 'l1', 'l2' ] +* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] */ function penalties() { return DATA.slice(); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/test/test.js index bbec477342e0..c700236e26d2 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/test/test.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/test/test.js @@ -41,7 +41,8 @@ tape( 'the function returns a list of SGD classification penalties', function te expected = [ 'elasticnet', 'l1', - 'l2' + 'l2', + 'none' ]; actual = penalties(); @@ -64,7 +65,8 @@ tape( 'attached to the main function is an `enum` method to return an object map o = [ 'elasticnet', 'l1', - 'l2' + 'l2', + 'none' ]; for ( i = 0; i < o.length; i++ ) { t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/benchmark/benchmark.js index f08e8a3b56b2..bd0af6b5522c 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/benchmark/benchmark.js @@ -37,7 +37,8 @@ bench( pkg, function benchmark( b ) { values = [ str2enum( 'elasticnet' ), str2enum( 'l1' ), - str2enum( 'l2' ) + str2enum( 'l2' ), + str2enum( 'none' ) ]; b.tic(); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/test/test.js index 001fcf9ab194..f4f58701d115 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/test/test.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/test/test.js @@ -30,7 +30,8 @@ var enum2str = require( './../lib' ); var VALUES = [ 'elasticnet', 'l1', - 'l2' + 'l2', + 'none' ]; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/benchmark/benchmark.js index c694e1e065e1..d85a6826abf0 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/benchmark/benchmark.js @@ -36,7 +36,8 @@ bench( pkg, function benchmark( b ) { values = [ 'elasticnet', 'l1', - 'l2' + 'l2', + 'none' ]; b.tic(); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/test/test.js index e01f19f2b8c7..b956bb0273b1 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/test/test.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/test/test.js @@ -30,7 +30,8 @@ var str2enum = require( './../lib' ); var VALUES = [ 'elasticnet', 'l1', - 'l2' + 'l2', + 'none' ]; From b6ccc093fe32963287e2a923f714457a1f5af914 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 26 Jul 2026 16:20:43 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/ml/base/sgd-classification/penalties/README.md | 4 ++-- .../ml/base/sgd-classification/penalties/docs/repl.txt | 2 +- .../@stdlib/ml/base/sgd-classification/penalties/lib/enum.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md index 3dd5ea7247e9..5d64911473f5 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md @@ -54,7 +54,7 @@ The output array contains the following penalties: - `elasticnet`: regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods. - `l1`: L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients. - `l2`: L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients. -- `none`: No regularization. +- `none`: no regularization. @@ -129,7 +129,7 @@ An enumeration of SGD classification penalties with the following fields: - **STDLIB_ML_SGD_CLASSIFICATION_ELASTICNET**: regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods. - **STDLIB_ML_SGD_CLASSIFICATION_L1**: L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients. - **STDLIB_ML_SGD_CLASSIFICATION_L2**: L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients. -- **STDLIB_ML_SGD_CLASSIFICATION_NONE**: No regularization. +- **STDLIB_ML_SGD_CLASSIFICATION_NONE**: no regularization. ```c #include "stdlib/ml/base/sgd-classification/penalties.h" diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt index 765ca44a4ebd..6bd0cc9def11 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt @@ -11,7 +11,7 @@ - l2: L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients. - - none: No regularization. + - none: no regularization. Returns ------- diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js index 4d95c9105670..834628e0894a 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js +++ b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js @@ -46,7 +46,7 @@ function enumerated() { // L2 regularization (also called ridge regression) encourages smaller, more evenly distributed weights by adding a penalty based on the square of the coefficients: 'l2': 2, - // No regularization + // No regularization: 'none': 3 }; }