From 40cc782866111edb6dd3a56e0e42f08a0a4e7395 Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Tue, 28 Jul 2026 12:56:28 +0530 Subject: [PATCH 1/3] remove: delete `ml/base/sgd-classification/` --- 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: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../learning-rate-enum2str/README.md | 121 ----------- .../benchmark/benchmark.js | 57 ----- .../learning-rate-enum2str/docs/repl.txt | 23 -- .../docs/types/index.d.ts | 41 ---- .../learning-rate-enum2str/docs/types/test.ts | 39 ---- .../learning-rate-enum2str/examples/index.js | 30 --- .../learning-rate-enum2str/lib/index.js | 44 ---- .../learning-rate-enum2str/lib/main.js | 60 ------ .../learning-rate-enum2str/package.json | 65 ------ .../learning-rate-enum2str/test/test.js | 67 ------ .../learning-rate-resolve-enum/README.md | 124 ----------- .../benchmark/benchmark.js | 85 -------- .../learning-rate-resolve-enum/docs/repl.txt | 29 --- .../docs/types/index.d.ts | 40 ---- .../docs/types/test.ts | 28 --- .../examples/index.js | 29 --- .../learning-rate-resolve-enum/lib/index.js | 40 ---- .../learning-rate-resolve-enum/lib/main.js | 57 ----- .../learning-rate-resolve-enum/package.json | 65 ------ .../learning-rate-resolve-enum/test/test.js | 76 ------- .../learning-rate-resolve-str/README.md | 121 ----------- .../benchmark/benchmark.js | 85 -------- .../learning-rate-resolve-str/docs/repl.txt | 25 --- .../docs/types/index.d.ts | 38 ---- .../docs/types/test.ts | 28 --- .../examples/index.js | 30 --- .../learning-rate-resolve-str/lib/index.js | 41 ---- .../learning-rate-resolve-str/lib/main.js | 55 ----- .../learning-rate-resolve-str/package.json | 65 ------ .../learning-rate-resolve-str/test/test.js | 76 ------- .../learning-rate-str2enum/README.md | 119 ----------- .../benchmark/benchmark.js | 56 ----- .../learning-rate-str2enum/docs/repl.txt | 27 --- .../docs/types/index.d.ts | 40 ---- .../learning-rate-str2enum/docs/types/test.ts | 39 ---- .../learning-rate-str2enum/examples/index.js | 29 --- .../learning-rate-str2enum/lib/index.js | 40 ---- .../learning-rate-str2enum/lib/main.js | 56 ----- .../learning-rate-str2enum/package.json | 65 ------ .../learning-rate-str2enum/test/test.js | 68 ------ .../learning-rates/README.md | 190 ----------------- .../learning-rates/benchmark/benchmark.js | 48 ----- .../learning-rates/docs/repl.txt | 30 --- .../learning-rates/docs/types/index.d.ts | 35 --- .../learning-rates/docs/types/test.ts | 32 --- .../learning-rates/examples/index.js | 36 ---- .../base/sgd-classification/learning_rates.h | 39 ---- .../learning-rates/lib/data.json | 6 - .../learning-rates/lib/enum.js | 57 ----- .../learning-rates/lib/index.js | 47 ---- .../learning-rates/lib/main.js | 44 ---- .../learning-rates/manifest.json | 36 ---- .../learning-rates/package.json | 67 ------ .../learning-rates/test/test.js | 77 ------- .../loss-function-enum2str/README.md | 121 ----------- .../benchmark/benchmark.js | 62 ------ .../loss-function-enum2str/docs/repl.txt | 23 -- .../docs/types/index.d.ts | 41 ---- .../loss-function-enum2str/docs/types/test.ts | 39 ---- .../loss-function-enum2str/examples/index.js | 30 --- .../loss-function-enum2str/lib/index.js | 44 ---- .../loss-function-enum2str/lib/main.js | 60 ------ .../loss-function-enum2str/package.json | 65 ------ .../loss-function-enum2str/test/test.js | 72 ------- .../loss-function-resolve-enum/README.md | 124 ----------- .../benchmark/benchmark.js | 95 --------- .../loss-function-resolve-enum/docs/repl.txt | 29 --- .../docs/types/index.d.ts | 40 ---- .../docs/types/test.ts | 28 --- .../examples/index.js | 29 --- .../loss-function-resolve-enum/lib/index.js | 40 ---- .../loss-function-resolve-enum/lib/main.js | 57 ----- .../loss-function-resolve-enum/package.json | 65 ------ .../loss-function-resolve-enum/test/test.js | 81 ------- .../loss-function-resolve-str/README.md | 121 ----------- .../benchmark/benchmark.js | 95 --------- .../loss-function-resolve-str/docs/repl.txt | 25 --- .../docs/types/index.d.ts | 38 ---- .../docs/types/test.ts | 28 --- .../examples/index.js | 30 --- .../loss-function-resolve-str/lib/index.js | 41 ---- .../loss-function-resolve-str/lib/main.js | 55 ----- .../loss-function-resolve-str/package.json | 65 ------ .../loss-function-resolve-str/test/test.js | 81 ------- .../loss-function-str2enum/README.md | 119 ----------- .../benchmark/benchmark.js | 61 ------ .../loss-function-str2enum/docs/repl.txt | 27 --- .../docs/types/index.d.ts | 40 ---- .../loss-function-str2enum/docs/types/test.ts | 39 ---- .../loss-function-str2enum/examples/index.js | 29 --- .../loss-function-str2enum/lib/index.js | 40 ---- .../loss-function-str2enum/lib/main.js | 56 ----- .../loss-function-str2enum/package.json | 65 ------ .../loss-function-str2enum/test/test.js | 73 ------- .../loss-functions/README.md | 200 ------------------ .../loss-functions/benchmark/benchmark.js | 48 ----- .../loss-functions/docs/repl.txt | 35 --- .../loss-functions/docs/types/index.d.ts | 35 --- .../loss-functions/docs/types/test.ts | 32 --- .../loss-functions/examples/index.js | 36 ---- .../base/sgd-classification/loss_functions.h | 54 ----- .../loss-functions/lib/data.json | 11 - .../loss-functions/lib/enum.js | 72 ------- .../loss-functions/lib/index.js | 47 ---- .../loss-functions/lib/main.js | 44 ---- .../loss-functions/manifest.json | 36 ---- .../loss-functions/package.json | 66 ------ .../loss-functions/test/test.js | 87 -------- .../sgd-classification/penalties/README.md | 190 ----------------- .../penalties/benchmark/benchmark.js | 48 ----- .../penalties/docs/repl.txt | 28 --- .../penalties/docs/types/index.d.ts | 35 --- .../penalties/docs/types/test.ts | 32 --- .../penalties/examples/index.js | 36 ---- .../ml/base/sgd-classification/penalties.h | 39 ---- .../penalties/lib/data.json | 6 - .../sgd-classification/penalties/lib/enum.js | 57 ----- .../sgd-classification/penalties/lib/index.js | 47 ---- .../sgd-classification/penalties/lib/main.js | 44 ---- .../penalties/manifest.json | 36 ---- .../sgd-classification/penalties/package.json | 67 ------ .../sgd-classification/penalties/test/test.js | 77 ------- .../penalty-enum2str/README.md | 121 ----------- .../penalty-enum2str/benchmark/benchmark.js | 57 ----- .../penalty-enum2str/docs/repl.txt | 25 --- .../penalty-enum2str/docs/types/index.d.ts | 41 ---- .../penalty-enum2str/docs/types/test.ts | 39 ---- .../penalty-enum2str/examples/index.js | 30 --- .../penalty-enum2str/lib/index.js | 44 ---- .../penalty-enum2str/lib/main.js | 60 ------ .../penalty-enum2str/package.json | 65 ------ .../penalty-enum2str/test/test.js | 67 ------ .../penalty-resolve-enum/README.md | 124 ----------- .../benchmark/benchmark.js | 83 -------- .../penalty-resolve-enum/docs/repl.txt | 31 --- .../docs/types/index.d.ts | 40 ---- .../penalty-resolve-enum/docs/types/test.ts | 28 --- .../penalty-resolve-enum/examples/index.js | 29 --- .../penalty-resolve-enum/lib/index.js | 40 ---- .../penalty-resolve-enum/lib/main.js | 57 ----- .../penalty-resolve-enum/package.json | 65 ------ .../penalty-resolve-enum/test/test.js | 75 ------- .../penalty-resolve-str/README.md | 121 ----------- .../benchmark/benchmark.js | 83 -------- .../penalty-resolve-str/docs/repl.txt | 26 --- .../penalty-resolve-str/docs/types/index.d.ts | 38 ---- .../penalty-resolve-str/docs/types/test.ts | 28 --- .../penalty-resolve-str/examples/index.js | 30 --- .../penalty-resolve-str/lib/index.js | 41 ---- .../penalty-resolve-str/lib/main.js | 55 ----- .../penalty-resolve-str/package.json | 65 ------ .../penalty-resolve-str/test/test.js | 75 ------- .../penalty-str2enum/README.md | 119 ----------- .../penalty-str2enum/benchmark/benchmark.js | 56 ----- .../penalty-str2enum/docs/repl.txt | 27 --- .../penalty-str2enum/docs/types/index.d.ts | 40 ---- .../penalty-str2enum/docs/types/test.ts | 39 ---- .../penalty-str2enum/examples/index.js | 29 --- .../penalty-str2enum/lib/index.js | 40 ---- .../penalty-str2enum/lib/main.js | 56 ----- .../penalty-str2enum/package.json | 65 ------ .../penalty-str2enum/test/test.js | 68 ------ 162 files changed, 9007 deletions(-) delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/include/stdlib/ml/base/sgd-classification/learning_rates.h delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/data.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/enum.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/manifest.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/include/stdlib/ml/base/sgd-classification/loss_functions.h delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/data.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/enum.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/manifest.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/include/stdlib/ml/base/sgd-classification/penalties.h delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/data.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/manifest.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/test/test.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/README.md delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/examples/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/index.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/main.js delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/package.json delete mode 100644 lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/test/test.js diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/README.md deleted file mode 100644 index 422657a437b1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# enum2str - -> Return the SGD classification learning rate scheduler string associated with an SGD classification learning rate scheduler enumeration constant. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var enum2str = require( '@stdlib/ml/base/sgd-classification/learning-rate-enum2str' ); -``` - -#### enum2str( value ) - -Returns the SGD classification learning rate scheduler string associated with an SGD classification learning rate scheduler enumeration constant. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); - -var v = str2enum( 'basic' ); -// returns - -var s = enum2str( v ); -// returns 'basic' -``` - -If unable to resolve an SGD classification learning rate scheduler string, the function returns `null`. - -```javascript -var v = enum2str( -999999999 ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var enum2str = require( '@stdlib/ml/base/sgd-classification/learning-rate-enum2str' ); - -var str = enum2str( str2enum( 'basic' ) ); -// returns 'basic' - -str = enum2str( str2enum( 'constant' ) ); -// returns 'constant' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/benchmark/benchmark.js deleted file mode 100644 index 30f004c536b6..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/benchmark/benchmark.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var pkg = require( './../package.json' ).name; -var enum2str = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'basic' ), - str2enum( 'constant' ), - str2enum( 'invscaling' ), - str2enum( 'pegasos' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = enum2str( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/repl.txt deleted file mode 100644 index 0a2ce6da6f66..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( value ) - Returns the SGD classification learning rate scheduler string associated - with an SGD classification learning rate scheduler enumeration constant. - - Parameters - ---------- - value: integer - Learning rate scheduler enumeration constant. - - Returns - ------- - out: string|null - Learning rate scheduler string. - - Examples - -------- - > var out = {{alias}}( {{alias:@stdlib/ml/base/sgd-classification/learning-rate-str2enum}}( 'basic' ) ) - 'basic' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/index.d.ts deleted file mode 100644 index 19f7d954ec3e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the SGD classification learning rate scheduler string associated with an SGD classification learning rate scheduler enumeration constant. -* -* @param value - enumeration constant -* @returns learning rate scheduler string -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* -* var v = str2enum( 'basic' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'basic' -*/ -declare function enum2str( value: number ): string | null; - - -// EXPORTS // - -export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/test.ts deleted file mode 100644 index fe80992105ef..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import enum2str = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - enum2str( 0 ); // $ExpectType string | null -} - -// The compiler throws an error if not provided a number... -{ - enum2str( '10' ); // $ExpectError - enum2str( true ); // $ExpectError - enum2str( false ); // $ExpectError - enum2str( null ); // $ExpectError - enum2str( undefined ); // $ExpectError - enum2str( [] ); // $ExpectError - enum2str( {} ); // $ExpectError - enum2str( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/examples/index.js deleted file mode 100644 index 98eb0a7ca9a9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var enum2str = require( './../lib' ); - -var str = enum2str( str2enum( 'constant' ) ); -console.log( str ); -// => 'constant' - -str = enum2str( str2enum( 'basic' ) ); -console.log( str ); -// => 'basic' diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/index.js deleted file mode 100644 index 27cd6a3de69d..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the SGD classification learning rate scheduler string associated with an SGD classification learning rate scheduler enumeration constant. -* -* @module @stdlib/ml/base/sgd-classification/learning-rate-enum2str -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* var enum2str = require( '@stdlib/ml/base/sgd-classification/learning-rate-enum2str' ); -* -* var v = str2enum( 'basic' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'basic' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/main.js deleted file mode 100644 index 95c173ae26e2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/lib/main.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var objectInverse = require( '@stdlib/object/inverse' ); -var enumeration = require( '@stdlib/ml/base/sgd-classification/learning-rates' ).enum; - - -// VARIABLES // - -var hash = objectInverse( enumeration(), { - 'duplicates': false -}); - - -// MAIN // - -/** -* Returns the SGD classification learning rate scheduler string associated with an SGD classification learning rate scheduler enumeration constant. -* -* @param {integer} value - learning rate scheduler enumeration constant -* @returns {(string|null)} learning rate scheduler string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* -* var v = str2enum( 'basic' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'basic' -*/ -function enum2str( value ) { - var v = hash[ value ]; - return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/package.json deleted file mode 100644 index b72245fafc31..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/learning-rate-enum2str", - "version": "0.0.0", - "description": "Return the SGD classification learning rate scheduler string associated with an SGD classification learning rate scheduler enumeration constant.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "learning rate", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/test/test.js deleted file mode 100644 index 656a695abf22..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-enum2str/test/test.js +++ /dev/null @@ -1,67 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var enum2str = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an enumeration constant', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - -9999999, - -999999999, - -99999999999 - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/README.md deleted file mode 100644 index e11fa2bfb2e4..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/README.md +++ /dev/null @@ -1,124 +0,0 @@ - - -# resolve - -> Return the enumeration constant associated with a supported SGD classification learning rate scheduler value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum' ); -``` - -#### resolve( value ) - -Returns the enumeration constant associated with a supported SGD classification learning rate scheduler value. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); - -var v = resolve( 'basic' ); -// returns - -v = resolve( str2enum( 'constant' ) ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum' ); - -var v = resolve( 'basic' ); -// returns - -v = resolve( 'constant' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/benchmark/benchmark.js deleted file mode 100644 index 6051662a9725..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/benchmark/benchmark.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'basic' ), - str2enum( 'constant' ), - str2enum( 'invscaling' ), - str2enum( 'pegasos' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/repl.txt deleted file mode 100644 index 16995312e2fb..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( value ) - Returns the enumeration constant associated with a supported SGD - classification learning rate scheduler value. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `BASIC == 0`). Instead, the function should be used in an - opaque manner. - - Parameters - ---------- - value: any - Learning rate scheduler value. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'basic' ) - - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd-classification/learning-rate-str2enum}}( 'basic' ) ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/index.d.ts deleted file mode 100644 index 71049f343e2f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with a supported SGD classification learning rate scheduler value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. -* -* @param value - learning rate scheduler value -* @returns enumeration constant -* -* @example -* var v = resolve( 'basic' ); -* // returns -*/ -declare function resolve( value: any ): number | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/test.ts deleted file mode 100644 index 125d9f7a122e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - resolve( 0 ); // $ExpectType number | null - resolve( 'basic' ); // $ExpectType number | null -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/examples/index.js deleted file mode 100644 index 8e913704a76b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var resolve = require( './../lib' ); - -var v = resolve( 'basic' ); -console.log( v ); -// => - -v = resolve( 'constant' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/index.js deleted file mode 100644 index 9d24b164a7ea..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with a supported SGD classification learning rate scheduler value. -* -* @module @stdlib/ml/base/sgd-classification/learning-rate-resolve-enum -* -* @example -* var resolve = require( '@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum' ); -* -* var v = resolve( 'basic' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/main.js deleted file mode 100644 index 59113eefccae..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/lib/main.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/sgd-classification/learning-rate-enum2str' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); - - -// MAIN // - -/** -* Returns the enumeration constant associated with a supported SGD classification learning rate scheduler value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. -* -* @param {*} value - learning rate scheduler value -* @returns {(integer|null)} enumeration constant or null -* -* @example -* var v = resolve( 'basic' ); -* // returns -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'number' ) { - return ( enum2str( value ) ) ? value : null; - } - if ( t === 'string' ) { - return str2enum( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/package.json deleted file mode 100644 index 785517143065..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with a supported SGD classification learning rate scheduler value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "learning rate", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/test/test.js deleted file mode 100644 index a96b6fc9386e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-enum/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with an SGD classification learning rate scheduler value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); - t.strictEqual( resolve( v ), v, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/README.md deleted file mode 100644 index 14bdd51cce79..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# resolve - -> Return the learning rate scheduler string associated with a supported SGD classification learning rate scheduler value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/learning-rate-resolve-str' ); -``` - -#### resolve( value ) - -Returns the learning rate scheduler string associated with a supported SGD classification learning rate scheduler value. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); - -var v = resolve( 'constant' ); -// returns 'constant' - -v = resolve( str2enum( 'constant' ) ); -// returns 'constant' -``` - -If unable to resolve an SGD classification learning rate scheduler string, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var resolve = require( '@stdlib/ml/base/sgd-classification/learning-rate-resolve-str' ); - -var v = resolve( str2enum( 'constant' ) ); -// returns 'constant' - -v = resolve( str2enum( 'basic' ) ); -// returns 'basic' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/benchmark/benchmark.js deleted file mode 100644 index 54f10fd58dec..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/benchmark/benchmark.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'basic' ), - str2enum( 'constant' ), - str2enum( 'invscaling' ), - str2enum( 'pegasos' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/repl.txt deleted file mode 100644 index bb668b6cc3f3..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/repl.txt +++ /dev/null @@ -1,25 +0,0 @@ - -{{alias}}( value ) - Returns the learning rate scheduler string associated with a supported SGD - classification learning rate scheduler value. - - Parameters - ---------- - value: any - Learning rate scheduler value. - - Returns - ------- - out: string|null - Learning rate scheduler string. - - Examples - -------- - > var out = {{alias}}( 'constant' ) - 'constant' - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd-classification/learning-rate-str2enum}}( 'constant' ) ) - 'constant' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/index.d.ts deleted file mode 100644 index 01289d897440..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the learning rate scheduler string associated with a supported SGD classification learning rate scheduler value. -* -* @param value - learning rate scheduler value -* @returns learning rate scheduler string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* -* var v = resolve( str2enum( 'constant' ) ); -* // returns 'constant' -*/ -declare function resolve( value: any ): string | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/test.ts deleted file mode 100644 index d122510e714b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - resolve( 0 ); // $ExpectType string | null - resolve( 'constant' ); // $ExpectType string | null -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/examples/index.js deleted file mode 100644 index 5fc4ab909923..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var resolve = require( './../lib' ); - -var v = resolve( str2enum( 'constant' ) ); -console.log( v ); -// => 'constant' - -v = resolve( str2enum( 'basic' ) ); -console.log( v ); -// => 'basic' diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/index.js deleted file mode 100644 index 1058ee0ac645..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the learning rate scheduler string associated with a supported SGD classification learning rate scheduler value. -* -* @module @stdlib/ml/base/sgd-classification/learning-rate-resolve-str -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* var resolve = require( '@stdlib/ml/base/sgd-classification/learning-rate-resolve-str' ); -* -* var v = resolve( str2enum( 'constant' ) ); -* // returns 'constant' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/main.js deleted file mode 100644 index 01d31e646e6b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/lib/main.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/sgd-classification/learning-rate-enum2str' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); - - -// MAIN // - -/** -* Returns the learning rate scheduler string associated with a supported SGD classification learning rate scheduler value. -* -* @param {*} value - learning rate scheduler value -* @returns {(string|null)} learning rate scheduler string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* -* var v = resolve( str2enum( 'constant' ) ); -* // returns 'constant' -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'string' ) { - return ( str2enum( value ) === null ) ? null : value; - } - if ( t === 'number' ) { - return enum2str( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/package.json deleted file mode 100644 index 03177bebed75..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/learning-rate-resolve-str", - "version": "0.0.0", - "description": "Return the learning rate scheduler string associated with a supported SGD classification learning rate scheduler value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "learning rate", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/test/test.js deleted file mode 100644 index abf3d8bd55e6..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-resolve-str/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an SGD classification learning rate scheduler value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); - t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/README.md deleted file mode 100644 index 908ef11eda4a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/README.md +++ /dev/null @@ -1,119 +0,0 @@ - - -# str2enum - -> Return the enumeration constant associated with an SGD classification learning rate scheduler string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -``` - -#### str2enum( learningRate ) - -Returns the enumeration constant associated with an SGD classification learning rate scheduler string. - -```javascript -var v = str2enum( 'constant' ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = str2enum( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); - -var v = str2enum( 'constant' ); -// returns - -v = str2enum( 'basic' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/benchmark/benchmark.js deleted file mode 100644 index 96cb8ab2ee54..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var str2enum = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str2enum( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/repl.txt deleted file mode 100644 index 12159a31e8c2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( learningRate ) - Returns the enumeration constant associated with an SGD classification - learning rate scheduler string. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `BASIC == 0`). Instead, the function should be used in an - opaque manner. - - Parameters - ---------- - learningRate: string - Learning rate scheduler. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'constant' ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/index.d.ts deleted file mode 100644 index 4069d5140271..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with an SGD classification learning rate scheduler string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. -* -* @param learningRate - learning rate scheduler string -* @returns enumeration constant -* -* @example -* var v = str2enum( 'constant' ); -* // returns -*/ -declare function str2enum( learningRate: string ): number | null; - - -// EXPORTS // - -export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/test.ts deleted file mode 100644 index 7d45e990746e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import str2enum = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - str2enum( 'constant' ); // $ExpectType number | null -} - -// The compiler throws an error if not provided a string... -{ - str2enum( 10 ); // $ExpectError - str2enum( true ); // $ExpectError - str2enum( false ); // $ExpectError - str2enum( null ); // $ExpectError - str2enum( undefined ); // $ExpectError - str2enum( [] ); // $ExpectError - str2enum( {} ); // $ExpectError - str2enum( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/examples/index.js deleted file mode 100644 index 69f951ceb6bf..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( './../lib' ); - -var v = str2enum( 'constant' ); -console.log( v ); -// => - -v = str2enum( 'basic' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/index.js deleted file mode 100644 index 6534b9aeae3e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with an SGD classification learning rate scheduler string. -* -* @module @stdlib/ml/base/sgd-classification/learning-rate-str2enum -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/learning-rate-str2enum' ); -* -* var v = str2enum( 'constant' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/main.js deleted file mode 100644 index 25885115397e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/lib/main.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var enumeration = require( '@stdlib/ml/base/sgd-classification/learning-rates' ).enum; - - -// VARIABLES // - -var ENUM = enumeration(); - - -// MAIN // - -/** -* Returns the enumeration constant associated with an SGD classification learning rate scheduler string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. -* -* @param {string} learningRate - learning rate scheduler string -* @returns {(integer|null)} integer value or null -* -* @example -* var v = str2enum( 'constant' ); -* // returns -*/ -function str2enum( learningRate ) { - var v = ENUM[ learningRate ]; - return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/package.json deleted file mode 100644 index 1de1c627f550..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/learning-rate-str2enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with an SGD classification learning rate scheduler 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 classification", - "learning rate", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/test/test.js deleted file mode 100644 index a8c6e430bf32..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rate-str2enum/test/test.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var enum2str = require( '@stdlib/ml/base/sgd-classification/learning-rate-enum2str' ); -var str2enum = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'constant', - 'basic', - 'invscaling', - 'pegasos' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with a string', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/README.md deleted file mode 100644 index b010fea72323..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/README.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# Learning rates - -> SGD classification learning rate schedulers. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var learningRates = require( '@stdlib/ml/base/sgd-classification/learning-rates' ); -``` - -#### learningRates() - -Returns a list of SGD classification learning rate schedulers. - -```javascript -var out = learningRates(); -// e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] -``` - -The output array contains the following learning rate schedulers: - -- `basic`: basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration. -- `constant`: constant learning rate function. -- `invscaling`: inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases. -- `pegasos`: Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter. - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var learningRates = require( '@stdlib/ml/base/sgd-classification/learning-rates' ); - -var isLearningRate = contains( learningRates() ); - -var bool = isLearningRate( 'constant' ); -// returns true - -bool = isLearningRate( 'pegasos' ); -// returns true - -bool = isLearningRate( 'beep' ); -// returns false -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/ml/base/sgd-classification/learning_rates.h" -``` - -#### STDLIB_ML_SGD_CLASSIFICATION_LEARNING_RATE - -An enumeration of SGD classification learning rate schedulers with the following fields: - -- **STDLIB_ML_SGD_CLASSIFICATION_BASIC**: basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration. -- **STDLIB_ML_SGD_CLASSIFICATION_CONSTANT**: constant learning rate function. -- **STDLIB_ML_SGD_CLASSIFICATION_INVSCALING**: inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases. -- **STDLIB_ML_SGD_CLASSIFICATION_PEGASOS**: Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter. - -```c -#include "stdlib/ml/base/sgd-classification/learning_rates.h" - -const enum STDLIB_ML_SGD_CLASSIFICATION_LEARNING_RATE v = STDLIB_ML_SGD_CLASSIFICATION_BASIC; -``` - -
- - - - - -
- -### Notes - -- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. - -
- - - - - -
- -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/benchmark/benchmark.js deleted file mode 100644 index 95c330ebd9fb..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/benchmark/benchmark.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var pkg = require( './../package.json' ).name; -var learningRates = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = learningRates(); - if ( out.length < 2 ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/repl.txt deleted file mode 100644 index 6128e38d404a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/repl.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{{alias}}() - Returns a list of SGD classification learning rate schedulers. - - The output array contains the following learning rate schedulers: - - - basic: basic learning rate function according to the formula `10/(10+t)` - where `t` is the current iteration. - - constant: constant learning rate function. - - invscaling: inverse scaling learning rate function according to the - formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and - `power_t` is the exponent controlling how quickly the learning rate - decreases. - - pegasos: Pegasos learning rate function according to the formula - `1/(lambda*t)` where `t` is the current iteration and `lambda` is the - regularization parameter. - - Returns - ------- - out: Array - List of learning rate schedulers. - - Examples - -------- - > var out = {{alias}}() - [...] - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/index.d.ts deleted file mode 100644 index dcffa578ea70..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns a list of SGD classification learning rate schedulers. -* -* @returns list of learning rate schedulers -* -* @example -* var list = learningRates(); -* // e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] -*/ -declare function learningRates(): Array; - - -// EXPORTS // - -export = learningRates; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/test.ts deleted file mode 100644 index c8605c6f84de..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/docs/types/test.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import learningRates = require( './index' ); - - -// TESTS // - -// The function returns an array of strings... -{ - learningRates(); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided any arguments... -{ - learningRates( 9 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/examples/index.js deleted file mode 100644 index c7427e0fe2fd..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var learningRates = require( './../lib' ); - -var isLearningRate = contains( learningRates() ); - -var bool = isLearningRate( 'basic' ); -console.log( bool ); -// => true - -bool = isLearningRate( 'constant' ); -console.log( bool ); -// => true - -bool = isLearningRate( 'beep' ); -console.log( bool ); -// => false diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/include/stdlib/ml/base/sgd-classification/learning_rates.h b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/include/stdlib/ml/base/sgd-classification/learning_rates.h deleted file mode 100644 index 4c6f37b1bc21..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/include/stdlib/ml/base/sgd-classification/learning_rates.h +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_ML_BASE_SGD_CLASSIFICATION_LEARNING_RATES_H -#define STDLIB_ML_BASE_SGD_CLASSIFICATION_LEARNING_RATES_H - -/** -* Enumeration of SGD classification learning rate schedulers. -*/ -enum STDLIB_ML_SGD_CLASSIFICATION_LEARNING_RATE { - // Basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration: - STDLIB_ML_SGD_CLASSIFICATION_BASIC = 0, - - // Constant learning rate function: - STDLIB_ML_SGD_CLASSIFICATION_CONSTANT, - - // Inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases: - STDLIB_ML_SGD_CLASSIFICATION_INVSCALING, - - // Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter: - STDLIB_ML_SGD_CLASSIFICATION_PEGASOS -}; - -#endif // !STDLIB_ML_BASE_SGD_CLASSIFICATION_LEARNING_RATES_H diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/data.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/data.json deleted file mode 100644 index 9f4424ed10e9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/data.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "basic", - "constant", - "invscaling", - "pegasos" -] diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/enum.js deleted file mode 100644 index 27c8b2643a09..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/enum.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns an object mapping supported learning rate schedulers to integer values for purposes of C inter-operation. -* -* ## Notes -* -* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the object should be used in an opaque manner. -* - The main purpose of this function is JavaScript and C inter-operation. -* -* @returns {Object} object mapping supported learning rate schedulers to integer values -* -* @example -* var table = enumerated(); -* // returns -*/ -function enumerated() { - // NOTE: the following should match the C `learning rates.h` enumeration!!!! - return { - // Basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration: - 'basic': 0, - - // Constant learning rate function: - 'constant': 1, - - // Inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases: - 'invscaling': 2, - - // Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter: - 'pegasos': 3 - }; -} - - -// EXPORTS // - -module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/index.js deleted file mode 100644 index 9af59ae848b9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return a list of SGD classification learning rate schedulers. -* -* @module @stdlib/ml/base/sgd-classification/learning-rates -* -* @example -* var learningRates = require( '@stdlib/ml/base/sgd-classification/learning-rates' ); -* -* var list = learningRates(); -* // e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var enumeration = require( './enum.js' ); - - -// MAIN // - -setReadOnly( main, 'enum', enumeration ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/main.js deleted file mode 100644 index fc7d1e0cee31..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/lib/main.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var DATA = require( './data.json' ); - - -// MAIN // - -/** -* Returns a list of SGD classification learning rate schedulers. -* -* @returns {Array} list of learning rate schedulers -* -* @example -* var list = learningRates(); -* // e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] -*/ -function learningRates() { - return DATA.slice(); -} - - -// EXPORTS // - -module.exports = learningRates; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/manifest.json deleted file mode 100644 index 844d692f6439..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/manifest.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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-classification/learning-rates/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/package.json deleted file mode 100644 index 80efce55d631..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/learning-rates", - "version": "0.0.0", - "description": "SGD classification learning rate schedulers.", - "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 classification", - "learning rates", - "learning rate schedulers", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/test/test.js deleted file mode 100644 index 76e6cb305328..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/learning-rates/test/test.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var learningRates = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof learningRates, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a list of SGD classification learning rate schedulers', function test( t ) { - var expected; - var actual; - - expected = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' - ]; - actual = learningRates(); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main function is an `enum` method to return an object mapping learning rate schedulers to integer values for C inter-operation', function test( t ) { - var obj; - var o; - var i; - - t.strictEqual( hasOwnProp( learningRates, 'enum' ), true, 'has property' ); - t.strictEqual( typeof learningRates.enum, 'function', 'has method' ); - - obj = learningRates.enum(); - t.strictEqual( typeof obj, 'object', 'returns expected value' ); - - // List of values which should be supported... - o = [ - 'basic', - 'constant', - 'invscaling', - 'pegasos' - ]; - for ( i = 0; i < o.length; i++ ) { - t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); - t.strictEqual( isNonNegativeInteger( obj[ o[ i ] ] ), true, 'returns expected value' ); - } - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/README.md deleted file mode 100644 index 55d309dfc269..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# enum2str - -> Return the SGD classification loss function string associated with an SGD classification loss function enumeration constant. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var enum2str = require( '@stdlib/ml/base/sgd-classification/loss-function-enum2str' ); -``` - -#### enum2str( value ) - -Returns the SGD classification loss function string associated with an SGD classification loss function enumeration constant. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); - -var v = str2enum( 'epsilon-insensitive' ); -// returns - -var s = enum2str( v ); -// returns 'epsilon-insensitive' -``` - -If unable to resolve an SGD classification loss function string, the function returns `null`. - -```javascript -var v = enum2str( -999999999 ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var enum2str = require( '@stdlib/ml/base/sgd-classification/loss-function-enum2str' ); - -var str = enum2str( str2enum( 'epsilon-insensitive' ) ); -// returns 'epsilon-insensitive' - -str = enum2str( str2enum( 'hinge' ) ); -// returns 'hinge' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/benchmark/benchmark.js deleted file mode 100644 index a0a8ff730a79..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/benchmark/benchmark.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var pkg = require( './../package.json' ).name; -var enum2str = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'epsilon-insensitive' ), - str2enum( 'hinge' ), - str2enum( 'huber' ), - str2enum( 'log' ), - str2enum( 'modified-huber' ), - str2enum( 'perceptron' ), - str2enum( 'squared-epsilon-insensitive' ), - str2enum( 'squared-error' ), - str2enum( 'squared-hinge' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = enum2str( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/repl.txt deleted file mode 100644 index 5910c47d09bc..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( value ) - Returns the SGD classification loss function string associated with an SGD - classification loss function enumeration constant. - - Parameters - ---------- - value: integer - Loss function enumeration constant. - - Returns - ------- - out: string|null - Loss function string. - - Examples - -------- - > var out = {{alias}}( {{alias:@stdlib/ml/base/sgd-classification/loss-function-str2enum}}( 'epsilon-insensitive' ) ) - 'epsilon-insensitive' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/index.d.ts deleted file mode 100644 index f63694a7bfd2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the SGD classification loss function string associated with an SGD classification loss function enumeration constant. -* -* @param value - enumeration constant -* @returns loss function string -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* -* var v = str2enum( 'epsilon-insensitive' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'epsilon-insensitive' -*/ -declare function enum2str( value: number ): string | null; - - -// EXPORTS // - -export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/test.ts deleted file mode 100644 index fe80992105ef..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import enum2str = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - enum2str( 0 ); // $ExpectType string | null -} - -// The compiler throws an error if not provided a number... -{ - enum2str( '10' ); // $ExpectError - enum2str( true ); // $ExpectError - enum2str( false ); // $ExpectError - enum2str( null ); // $ExpectError - enum2str( undefined ); // $ExpectError - enum2str( [] ); // $ExpectError - enum2str( {} ); // $ExpectError - enum2str( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/examples/index.js deleted file mode 100644 index 1a4fd46eb551..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var enum2str = require( './../lib' ); - -var str = enum2str( str2enum( 'hinge' ) ); -console.log( str ); -// => 'hinge' - -str = enum2str( str2enum( 'epsilon-insensitive' ) ); -console.log( str ); -// => 'epsilon-insensitive' diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/index.js deleted file mode 100644 index 743279309015..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the SGD classification loss function string associated with an SGD classification loss function enumeration constant. -* -* @module @stdlib/ml/base/sgd-classification/loss-function-enum2str -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* var enum2str = require( '@stdlib/ml/base/sgd-classification/loss-function-enum2str' ); -* -* var v = str2enum( 'epsilon-insensitive' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'epsilon-insensitive' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/main.js deleted file mode 100644 index 6b0e3744a68d..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/lib/main.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var objectInverse = require( '@stdlib/object/inverse' ); -var enumeration = require( '@stdlib/ml/base/sgd-classification/loss-functions' ).enum; - - -// VARIABLES // - -var hash = objectInverse( enumeration(), { - 'duplicates': false -}); - - -// MAIN // - -/** -* Returns the SGD classification loss function string associated with an SGD classification loss function enumeration constant. -* -* @param {integer} value - loss function enumeration constant -* @returns {(string|null)} loss function string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* -* var v = str2enum( 'epsilon-insensitive' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'epsilon-insensitive' -*/ -function enum2str( value ) { - var v = hash[ value ]; - return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/package.json deleted file mode 100644 index d08959ad4ade..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/loss-function-enum2str", - "version": "0.0.0", - "description": "Return the SGD classification loss function string associated with an SGD classification loss function enumeration constant.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "loss function", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/test/test.js deleted file mode 100644 index 3b79de34d98f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-enum2str/test/test.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var enum2str = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an enumeration constant', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - -9999999, - -999999999, - -99999999999 - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/README.md deleted file mode 100644 index d26bd3e15a33..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/README.md +++ /dev/null @@ -1,124 +0,0 @@ - - -# resolve - -> Return the enumeration constant associated with a supported SGD classification loss function value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/loss-function-resolve-enum' ); -``` - -#### resolve( value ) - -Returns the enumeration constant associated with a supported SGD classification loss function value. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); - -var v = resolve( 'epsilon-insensitive' ); -// returns - -v = resolve( str2enum( 'hinge' ) ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/loss-function-resolve-enum' ); - -var v = resolve( 'epsilon-insensitive' ); -// returns - -v = resolve( 'hinge' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/benchmark/benchmark.js deleted file mode 100644 index 577fc20c9315..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/benchmark/benchmark.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'epsilon-insensitive' ), - str2enum( 'hinge' ), - str2enum( 'huber' ), - str2enum( 'log' ), - str2enum( 'modified-huber' ), - str2enum( 'perceptron' ), - str2enum( 'squared-epsilon-insensitive' ), - str2enum( 'squared-error' ), - str2enum( 'squared-hinge' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/repl.txt deleted file mode 100644 index f7254f153648..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( value ) - Returns the enumeration constant associated with a supported SGD - classification loss function value. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be - used in an opaque manner. - - Parameters - ---------- - value: any - Loss function value. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'epsilon-insensitive' ) - - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd-classification/loss-function-str2enum}}( 'epsilon-insensitive' ) ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/index.d.ts deleted file mode 100644 index 66c8c54ac895..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with a supported SGD classification loss function value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. -* -* @param value - loss function value -* @returns enumeration constant -* -* @example -* var v = resolve( 'epsilon-insensitive' ); -* // returns -*/ -declare function resolve( value: any ): number | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/test.ts deleted file mode 100644 index eab6893aab19..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - resolve( 0 ); // $ExpectType number | null - resolve( 'epsilon-insensitive' ); // $ExpectType number | null -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/examples/index.js deleted file mode 100644 index 0d237af217d2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var resolve = require( './../lib' ); - -var v = resolve( 'epsilon-insensitive' ); -console.log( v ); -// => - -v = resolve( 'hinge' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/index.js deleted file mode 100644 index 2ce77b01dd2c..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with a supported SGD classification loss function value. -* -* @module @stdlib/ml/base/sgd-classification/loss-function-resolve-enum -* -* @example -* var resolve = require( '@stdlib/ml/base/sgd-classification/loss-function-resolve-enum' ); -* -* var v = resolve( 'epsilon-insensitive' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/main.js deleted file mode 100644 index 8dbe87a62e52..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/lib/main.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/sgd-classification/loss-function-enum2str' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); - - -// MAIN // - -/** -* Returns the enumeration constant associated with a supported SGD classification loss function value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. -* -* @param {*} value - loss function value -* @returns {(integer|null)} enumeration constant or null -* -* @example -* var v = resolve( 'epsilon-insensitive' ); -* // returns -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'number' ) { - return ( enum2str( value ) ) ? value : null; - } - if ( t === 'string' ) { - return str2enum( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/package.json deleted file mode 100644 index b0d757dd7042..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/loss-function-resolve-enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with a supported SGD classification loss function value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "loss function", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/test/test.js deleted file mode 100644 index 2464bd251eb4..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-enum/test/test.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with an SGD classification loss function value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); - t.strictEqual( resolve( v ), v, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/README.md deleted file mode 100644 index 64cee653c72a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# resolve - -> Return the loss function string associated with a supported SGD classification loss function value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/loss-function-resolve-str' ); -``` - -#### resolve( value ) - -Returns the loss function string associated with a supported SGD classification loss function value. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); - -var v = resolve( 'hinge' ); -// returns 'hinge' - -v = resolve( str2enum( 'hinge' ) ); -// returns 'hinge' -``` - -If unable to resolve an SGD classification loss function string, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var resolve = require( '@stdlib/ml/base/sgd-classification/loss-function-resolve-str' ); - -var v = resolve( str2enum( 'hinge' ) ); -// returns 'hinge' - -v = resolve( str2enum( 'epsilon-insensitive' ) ); -// returns 'epsilon-insensitive' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/benchmark/benchmark.js deleted file mode 100644 index 9d362c26154c..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/benchmark/benchmark.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'epsilon-insensitive' ), - str2enum( 'hinge' ), - str2enum( 'huber' ), - str2enum( 'log' ), - str2enum( 'modified-huber' ), - str2enum( 'perceptron' ), - str2enum( 'squared-epsilon-insensitive' ), - str2enum( 'squared-error' ), - str2enum( 'squared-hinge' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/repl.txt deleted file mode 100644 index 53d6145da9e2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/repl.txt +++ /dev/null @@ -1,25 +0,0 @@ - -{{alias}}( value ) - Returns the loss function string associated with a supported SGD - classification loss function value. - - Parameters - ---------- - value: any - Loss function value. - - Returns - ------- - out: string|null - Loss function string. - - Examples - -------- - > var out = {{alias}}( 'hinge' ) - 'hinge' - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd-classification/loss-function-str2enum}}( 'hinge' ) ) - 'hinge' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/index.d.ts deleted file mode 100644 index 1ed717add44f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the loss function string associated with a supported SGD classification loss function value. -* -* @param value - loss function value -* @returns loss function string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* -* var v = resolve( str2enum( 'hinge' ) ); -* // returns 'hinge' -*/ -declare function resolve( value: any ): string | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/test.ts deleted file mode 100644 index 524dc352b685..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - resolve( 0 ); // $ExpectType string | null - resolve( 'hinge' ); // $ExpectType string | null -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/examples/index.js deleted file mode 100644 index e2933a7a9983..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var resolve = require( './../lib' ); - -var v = resolve( str2enum( 'hinge' ) ); -console.log( v ); -// => 'hinge' - -v = resolve( str2enum( 'epsilon-insensitive' ) ); -console.log( v ); -// => 'epsilon-insensitive' diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/index.js deleted file mode 100644 index 4e04b6ed33d1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the loss function string associated with a supported SGD classification loss function value. -* -* @module @stdlib/ml/base/sgd-classification/loss-function-resolve-str -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* var resolve = require( '@stdlib/ml/base/sgd-classification/loss-function-resolve-str' ); -* -* var v = resolve( str2enum( 'hinge' ) ); -* // returns 'hinge' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/main.js deleted file mode 100644 index 917c429c4e7f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/lib/main.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/sgd-classification/loss-function-enum2str' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); - - -// MAIN // - -/** -* Returns the loss function string associated with a supported SGD classification loss function value. -* -* @param {*} value - loss function value -* @returns {(string|null)} loss function string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* -* var v = resolve( str2enum( 'hinge' ) ); -* // returns 'hinge' -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'string' ) { - return ( str2enum( value ) === null ) ? null : value; - } - if ( t === 'number' ) { - return enum2str( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/package.json deleted file mode 100644 index 12c938f4785a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/loss-function-resolve-str", - "version": "0.0.0", - "description": "Return the loss function string associated with a supported SGD classification loss function value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "loss function", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/test/test.js deleted file mode 100644 index b25fa6f377ba..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-resolve-str/test/test.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an SGD classification loss function value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); - t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/README.md deleted file mode 100644 index 3d32a52b2ca9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/README.md +++ /dev/null @@ -1,119 +0,0 @@ - - -# str2enum - -> Return the enumeration constant associated with an SGD classification loss function string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -``` - -#### str2enum( lossFunction ) - -Returns the enumeration constant associated with an SGD classification loss function string. - -```javascript -var v = str2enum( 'hinge' ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = str2enum( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); - -var v = str2enum( 'hinge' ); -// returns - -v = str2enum( 'epsilon-insensitive' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/benchmark/benchmark.js deleted file mode 100644 index 250a871eefda..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/benchmark/benchmark.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var str2enum = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str2enum( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/repl.txt deleted file mode 100644 index c0d45e78af0d..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( lossFunction ) - Returns the enumeration constant associated with an SGD classification loss - function string. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be - used in an opaque manner. - - Parameters - ---------- - lossFunction: string - Loss function. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'hinge' ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/index.d.ts deleted file mode 100644 index 8f107a89ac95..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with an SGD classification loss function string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. -* -* @param lossFunction - loss function string -* @returns enumeration constant -* -* @example -* var v = str2enum( 'hinge' ); -* // returns -*/ -declare function str2enum( lossFunction: string ): number | null; - - -// EXPORTS // - -export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/test.ts deleted file mode 100644 index 250ae7ed37c1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import str2enum = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - str2enum( 'hinge' ); // $ExpectType number | null -} - -// The compiler throws an error if not provided a string... -{ - str2enum( 10 ); // $ExpectError - str2enum( true ); // $ExpectError - str2enum( false ); // $ExpectError - str2enum( null ); // $ExpectError - str2enum( undefined ); // $ExpectError - str2enum( [] ); // $ExpectError - str2enum( {} ); // $ExpectError - str2enum( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/examples/index.js deleted file mode 100644 index 8c89d599d7d0..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( './../lib' ); - -var v = str2enum( 'hinge' ); -console.log( v ); -// => - -v = str2enum( 'epsilon-insensitive' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/index.js deleted file mode 100644 index 9d69cc925206..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with an SGD classification loss function string. -* -* @module @stdlib/ml/base/sgd-classification/loss-function-str2enum -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/loss-function-str2enum' ); -* -* var v = str2enum( 'hinge' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/main.js deleted file mode 100644 index 258725703538..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/lib/main.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var enumeration = require( '@stdlib/ml/base/sgd-classification/loss-functions' ).enum; - - -// VARIABLES // - -var ENUM = enumeration(); - - -// MAIN // - -/** -* Returns the enumeration constant associated with an SGD classification loss function string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. -* -* @param {string} lossFunction - loss function string -* @returns {(integer|null)} integer value or null -* -* @example -* var v = str2enum( 'hinge' ); -* // returns -*/ -function str2enum( lossFunction ) { - var v = ENUM[ lossFunction ]; - return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/package.json deleted file mode 100644 index 4065a1160e9e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/loss-function-str2enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with an SGD classification loss function 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 classification", - "loss function", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/test/test.js deleted file mode 100644 index 13f990390f30..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-function-str2enum/test/test.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var enum2str = require( '@stdlib/ml/base/sgd-classification/loss-function-enum2str' ); -var str2enum = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with a string', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/README.md deleted file mode 100644 index 010419e81e15..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/README.md +++ /dev/null @@ -1,200 +0,0 @@ - - -# Loss functions - -> SGD classification loss functions. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var lossFunctions = require( '@stdlib/ml/base/sgd-classification/loss-functions' ); -``` - -#### lossFunctions() - -Returns a list of SGD classification loss functions. - -```javascript -var out = lossFunctions(); -// e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] -``` - -The output array contains the following loss functions: - -- `epsilon-insensitive`: penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise. -- `hinge`: hinge loss function. Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data. -- `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. -- `log`: logistic loss function. Corresponds to Logistic Regression. -- `modified-huber`: Huber loss function variant for classification. -- `perceptron`: hinge loss function without a margin. Corresponds to the original perceptron by Rosenblatt (1957). -- `squared-epsilon-insensitive`: squared epsilon insensitive loss function. -- `squared-error`: squared error loss (i.e., the squared difference of the observed and fitted values). -- `squared-hinge`: squared hinge loss function SVM (L2-SVM). - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var lossFunction = require( '@stdlib/ml/base/sgd-classification/loss-functions' ); - -var isLossFunction = contains( lossFunction() ); - -var bool = isLossFunction( 'hinge' ); -// returns true - -bool = isLossFunction( 'log' ); -// returns true - -bool = isLossFunction( 'beep' ); -// returns false -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/ml/base/sgd-classification/loss_functions.h" -``` - -#### STDLIB_ML_SGD_CLASSIFICATION_LOSS_FUNCTION - -An enumeration of SGD classification loss functions with the following fields: - -- **STDLIB_ML_SGD_CLASSIFICATION_EPSILON_INSENSITIVE**: penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise. -- **STDLIB_ML_SGD_CLASSIFICATION_HINGE**: corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data. -- **STDLIB_ML_SGD_CLASSIFICATION_HUBER**: squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise. -- **STDLIB_ML_SGD_CLASSIFICATION_LOG**: corresponds to Logistic Regression. -- **STDLIB_ML_SGD_CLASSIFICATION_MODIFIED_HUBER**: Huber loss function variant for classification. -- **STDLIB_ML_SGD_CLASSIFICATION_PERCEPTRON**: corresponds to the original perceptron by Rosenblatt (1957). -- **STDLIB_ML_SGD_CLASSIFICATION_SQUARED_EPSILON_INSENSITIVE**: squared epsilon insensitive loss function. -- **STDLIB_ML_SGD_CLASSIFICATION_SQUARED_ERROR**: squared difference of the observed and fitted values. -- **STDLIB_ML_SGD_CLASSIFICATION_SQUARED_HINGE**: squared hinge loss function SVM (L2-SVM). - -```c -#include "stdlib/ml/base/sgd-classification/loss_functions.h" - -const enum STDLIB_ML_SGD_CLASSIFICATION_LOSS_FUNCTION v = STDLIB_ML_SGD_CLASSIFICATION_HINGE; -``` - -
- - - - - -
- -### Notes - -- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. - -
- - - - - -
- -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/benchmark/benchmark.js deleted file mode 100644 index fc9b818bd1cd..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/benchmark/benchmark.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var pkg = require( './../package.json' ).name; -var lossFunctions = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = lossFunctions(); - if ( out.length < 2 ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/repl.txt deleted file mode 100644 index 3ee9a26c327a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}() - Returns a list of SGD classification loss functions. - - The output array contains the following loss functions: - - - epsilon-insensitive: penalty is the absolute value of the error whenever - the absolute error exceeds epsilon and zero otherwise. - - hinge: hinge loss function. Corresponds to a soft-margin linear Support - Vector Machine (SVM), which can handle non-linearly separable data. - - 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. - - log: logistic loss function. Corresponds to Logistic Regression. - - modified-huber: Huber loss function variant for classification. - - perceptron: hinge loss function without a margin. Corresponds to the - original perceptron by Rosenblatt (1957). - - squared-epsilon-insensitive: squared epsilon insensitive loss function. - - squared-error: squared error loss (i.e., the squared difference of the - observed and fitted values). - - squared-hinge: squared hinge loss function SVM (L2-SVM). - - Returns - ------- - out: Array - List of loss functions. - - Examples - -------- - > var out = {{alias}}() - [...] - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/index.d.ts deleted file mode 100644 index ffe179e81b20..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns a list of SGD classification loss functions. -* -* @returns list of loss functions -* -* @example -* var list = lossFunctions(); -* // e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] -*/ -declare function lossFunctions(): Array; - - -// EXPORTS // - -export = lossFunctions; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/test.ts deleted file mode 100644 index 6c51642dacaa..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/docs/types/test.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import lossFunctions = require( './index' ); - - -// TESTS // - -// The function returns an array of strings... -{ - lossFunctions(); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided any arguments... -{ - lossFunctions( 9 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/examples/index.js deleted file mode 100644 index 1fa9e2f61bbf..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var lossFunctions = require( './../lib' ); - -var isLossFunction = contains( lossFunctions() ); - -var bool = isLossFunction( 'hinge' ); -console.log( bool ); -// => true - -bool = isLossFunction( 'log' ); -console.log( bool ); -// => true - -bool = isLossFunction( 'beep' ); -console.log( bool ); -// => false diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/include/stdlib/ml/base/sgd-classification/loss_functions.h b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/include/stdlib/ml/base/sgd-classification/loss_functions.h deleted file mode 100644 index fe1820bcc94f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/include/stdlib/ml/base/sgd-classification/loss_functions.h +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_ML_BASE_SGD_CLASSIFICATION_LOSS_FUNCTIONS_H -#define STDLIB_ML_BASE_SGD_CLASSIFICATION_LOSS_FUNCTIONS_H - -/** -* Enumeration of SGD classification loss functions. -*/ -enum STDLIB_ML_SGD_CLASSIFICATION_LOSS_FUNCTION { - // Penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise: - STDLIB_ML_SGD_CLASSIFICATION_EPSILON_INSENSITIVE = 0, - - // Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data: - STDLIB_ML_SGD_CLASSIFICATION_HINGE, - - // Squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise: - STDLIB_ML_SGD_CLASSIFICATION_HUBER, - - // Corresponds to Logistic Regression: - STDLIB_ML_SGD_CLASSIFICATION_LOG, - - // Huber loss function variant for classification: - STDLIB_ML_SGD_CLASSIFICATION_MODIFIED_HUBER, - - // Corresponds to the original perceptron by Rosenblatt (1957): - STDLIB_ML_SGD_CLASSIFICATION_PERCEPTRON, - - // Squared epsilon insensitive loss function: - STDLIB_ML_SGD_CLASSIFICATION_SQUARED_EPSILON_INSENSITIVE, - - // Squared difference of the observed and fitted values: - STDLIB_ML_SGD_CLASSIFICATION_SQUARED_ERROR, - - // Squared hinge loss function SVM (L2-SVM): - STDLIB_ML_SGD_CLASSIFICATION_SQUARED_HINGE -}; - -#endif // !STDLIB_ML_BASE_SGD_CLASSIFICATION_LOSS_FUNCTIONS_H diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/data.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/data.json deleted file mode 100644 index 7398567751ce..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/data.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - "epsilon-insensitive", - "hinge", - "huber", - "log", - "modified-huber", - "perceptron", - "squared-epsilon-insensitive", - "squared-error", - "squared-hinge" -] diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/enum.js deleted file mode 100644 index c1171c01f482..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/enum.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns an object mapping supported loss functions to integer values for purposes of C inter-operation. -* -* ## Notes -* -* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `HINGE == 0`). Instead, the object should be used in an opaque manner. -* - The main purpose of this function is JavaScript and C inter-operation. -* -* @returns {Object} object mapping supported loss functions to integer values -* -* @example -* var table = enumerated(); -* // returns -*/ -function enumerated() { - // NOTE: the following should match the C `loss_functions.h` enumeration!!!! - return { - // Penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise: - 'epsilon-insensitive': 0, - - // Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data: - 'hinge': 1, - - // Squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise: - 'huber': 2, - - // Corresponds to Logistic Regression: - 'log': 3, - - // Huber loss function variant for classification: - 'modified-huber': 4, - - // Corresponds to the original perceptron by Rosenblatt (1957): - 'perceptron': 5, - - // Squared epsilon insensitive loss function: - 'squared-epsilon-insensitive': 6, - - // Squared difference of the observed and fitted values: - 'squared-error': 7, - - // Squared hinge loss function SVM (L2-SVM): - 'squared-hinge': 8 - }; -} - - -// EXPORTS // - -module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/index.js deleted file mode 100644 index 01f578cb39f1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return a list of SGD classification loss functions. -* -* @module @stdlib/ml/base/sgd-classification/loss-functions -* -* @example -* var lossFunctions = require( '@stdlib/ml/base/sgd-classification/loss-functions' ); -* -* var list = lossFunctions(); -* // e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var enumeration = require( './enum.js' ); - - -// MAIN // - -setReadOnly( main, 'enum', enumeration ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/main.js deleted file mode 100644 index 8b5f84f33291..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/lib/main.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var DATA = require( './data.json' ); - - -// MAIN // - -/** -* Returns a list of SGD classification loss functions. -* -* @returns {Array} list of loss functions -* -* @example -* var list = lossFunctions(); -* // e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] -*/ -function lossFunctions() { - return DATA.slice(); -} - - -// EXPORTS // - -module.exports = lossFunctions; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/manifest.json deleted file mode 100644 index 844d692f6439..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/manifest.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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-classification/loss-functions/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/package.json deleted file mode 100644 index 8fb42101d6a1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/loss-functions", - "version": "0.0.0", - "description": "SGD classification loss functions.", - "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 classification", - "loss functions", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/test/test.js deleted file mode 100644 index e8572666efbc..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/loss-functions/test/test.js +++ /dev/null @@ -1,87 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var lossFunctions = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof lossFunctions, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a list of SGD classification loss functions', function test( t ) { - var expected; - var actual; - - expected = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' - ]; - actual = lossFunctions(); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main function is an `enum` method to return an object mapping loss functions to integer values for C inter-operation', function test( t ) { - var obj; - var o; - var i; - - t.strictEqual( hasOwnProp( lossFunctions, 'enum' ), true, 'has property' ); - t.strictEqual( typeof lossFunctions.enum, 'function', 'has method' ); - - obj = lossFunctions.enum(); - t.strictEqual( typeof obj, 'object', 'returns expected value' ); - - // List of values which should be supported... - o = [ - 'epsilon-insensitive', - 'hinge', - 'huber', - 'log', - 'modified-huber', - 'perceptron', - 'squared-epsilon-insensitive', - 'squared-error', - 'squared-hinge' - ]; - for ( i = 0; i < o.length; i++ ) { - t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); - t.strictEqual( isNonNegativeInteger( obj[ o[ i ] ] ), true, 'returns expected value' ); - } - - t.end(); -}); 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 deleted file mode 100644 index 5d64911473f5..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/README.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# Penalties - -> SGD classification penalties. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var penalties = require( '@stdlib/ml/base/sgd-classification/penalties' ); -``` - -#### penalties() - -Returns a list of SGD classification penalties. - -```javascript -var out = penalties(); -// e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] -``` - -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. - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var penalties = require( '@stdlib/ml/base/sgd-classification/penalties' ); - -var isPenalty = contains( penalties() ); - -var bool = isPenalty( 'l1' ); -// returns true - -bool = isPenalty( 'l2' ); -// returns true - -bool = isPenalty( 'beep' ); -// returns false -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/ml/base/sgd-classification/penalties.h" -``` - -#### STDLIB_ML_SGD_CLASSIFICATION_PENALTY - -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" - -const enum STDLIB_ML_SGD_CLASSIFICATION_PENALTY v = STDLIB_ML_SGD_CLASSIFICATION_ELASTICNET; -``` - -
- - - - - -
- -### Notes - -- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. - -
- - - - - -
- -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/benchmark/benchmark.js deleted file mode 100644 index a279d0987452..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/benchmark/benchmark.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var pkg = require( './../package.json' ).name; -var penalties = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = penalties(); - if ( out.length < 2 ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt deleted file mode 100644 index 6bd0cc9def11..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}() - Returns a list of SGD classification penalties. - - 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. - - Returns - ------- - out: Array - List of penalties. - - Examples - -------- - > var out = {{alias}}() - [...] - - See Also - -------- - 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 deleted file mode 100644 index 475e72c0abc9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns a list of SGD classification penalties. -* -* @returns list of penalties -* -* @example -* var list = penalties(); -* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] -*/ -declare function penalties(): Array; - - -// EXPORTS // - -export = penalties; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/test.ts deleted file mode 100644 index c536e7fc758d..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/docs/types/test.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import penalties = require( './index' ); - - -// TESTS // - -// The function returns an array of strings... -{ - penalties(); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided any arguments... -{ - penalties( 9 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/examples/index.js deleted file mode 100644 index 5d65a24f81e0..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var penalties = require( './../lib' ); - -var isPenalty = contains( penalties() ); - -var bool = isPenalty( 'elasticnet' ); -console.log( bool ); -// => true - -bool = isPenalty( 'l1' ); -console.log( bool ); -// => true - -bool = isPenalty( 'beep' ); -console.log( bool ); -// => false 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 deleted file mode 100644 index 69ffa486e1ad..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/include/stdlib/ml/base/sgd-classification/penalties.h +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_ML_BASE_SGD_CLASSIFICATION_PENALTIES_H -#define STDLIB_ML_BASE_SGD_CLASSIFICATION_PENALTIES_H - -/** -* Enumeration of SGD classification penalties. -*/ -enum STDLIB_ML_SGD_CLASSIFICATION_PENALTY { - // Regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods: - STDLIB_ML_SGD_CLASSIFICATION_ELASTICNET = 0, - - // L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients: - 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, - - // 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 deleted file mode 100644 index 71d176852af9..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/data.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "elasticnet", - "l1", - "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 deleted file mode 100644 index 834628e0894a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/enum.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns an object mapping supported penalties to integer values for purposes of C inter-operation. -* -* ## Notes -* -* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the object should be used in an opaque manner. -* - The main purpose of this function is JavaScript and C inter-operation. -* -* @returns {Object} object mapping supported penalties to integer values -* -* @example -* var table = enumerated(); -* // returns -*/ -function enumerated() { - // NOTE: the following should match the C `penalties.h` enumeration!!!! - return { - // Regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods: - 'elasticnet': 0, - - // L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients: - '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, - - // No regularization: - 'none': 3 - }; -} - - -// EXPORTS // - -module.exports = enumerated; 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 deleted file mode 100644 index 0ae898525139..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return a list of SGD classification penalties. -* -* @module @stdlib/ml/base/sgd-classification/penalties -* -* @example -* var penalties = require( '@stdlib/ml/base/sgd-classification/penalties' ); -* -* var list = penalties(); -* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var enumeration = require( './enum.js' ); - - -// MAIN // - -setReadOnly( main, 'enum', enumeration ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js deleted file mode 100644 index bd8994668f0a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/lib/main.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var DATA = require( './data.json' ); - - -// MAIN // - -/** -* Returns a list of SGD classification penalties. -* -* @returns {Array} list of penalties -* -* @example -* var list = penalties(); -* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] -*/ -function penalties() { - return DATA.slice(); -} - - -// EXPORTS // - -module.exports = penalties; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/manifest.json deleted file mode 100644 index 844d692f6439..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/manifest.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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-classification/penalties/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/package.json deleted file mode 100644 index 057f5c45e57b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/penalties", - "version": "0.0.0", - "description": "SGD classification penalties.", - "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", - "classification", - "penalties", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} 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 deleted file mode 100644 index c700236e26d2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalties/test/test.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var penalties = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof penalties, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a list of SGD classification penalties', function test( t ) { - var expected; - var actual; - - expected = [ - 'elasticnet', - 'l1', - 'l2', - 'none' - ]; - actual = penalties(); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the main function is an `enum` method to return an object mapping penalties to integer values for C inter-operation', function test( t ) { - var obj; - var o; - var i; - - t.strictEqual( hasOwnProp( penalties, 'enum' ), true, 'has property' ); - t.strictEqual( typeof penalties.enum, 'function', 'has method' ); - - obj = penalties.enum(); - t.strictEqual( typeof obj, 'object', 'returns expected value' ); - - // List of values which should be supported... - o = [ - 'elasticnet', - 'l1', - 'l2', - 'none' - ]; - for ( i = 0; i < o.length; i++ ) { - t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); - t.strictEqual( isNonNegativeInteger( obj[ o[ i ] ] ), true, 'returns expected value' ); - } - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/README.md deleted file mode 100644 index 732205aea8fe..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# enum2str - -> Return the SGD classification penalty string associated with an SGD classification penalty enumeration constant. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var enum2str = require( '@stdlib/ml/base/sgd-classification/penalty-enum2str' ); -``` - -#### enum2str( value ) - -Returns the SGD classification penalty string associated with an SGD classification penalty enumeration constant. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); - -var v = str2enum( 'elasticnet' ); -// returns - -var s = enum2str( v ); -// returns 'elasticnet' -``` - -If unable to resolve an SGD classification penalty string, the function returns `null`. - -```javascript -var v = enum2str( -999999999 ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var enum2str = require( '@stdlib/ml/base/sgd-classification/penalty-enum2str' ); - -var str = enum2str( str2enum( 'elasticnet' ) ); -// returns 'elasticnet' - -str = enum2str( str2enum( 'l1' ) ); -// returns 'l1' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - 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 deleted file mode 100644 index bd0af6b5522c..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/benchmark/benchmark.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var pkg = require( './../package.json' ).name; -var enum2str = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'elasticnet' ), - str2enum( 'l1' ), - str2enum( 'l2' ), - str2enum( 'none' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = enum2str( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/repl.txt deleted file mode 100644 index c9be84e099f4..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/repl.txt +++ /dev/null @@ -1,25 +0,0 @@ - -{{alias}}( value ) - Returns the SGD classification penalty string associated with an SGD - classification penalty enumeration constant. - - Parameters - ---------- - value: integer - Penalty enumeration constant. - - Returns - ------- - out: string|null - Penalty string. - - Examples - -------- - > var v = 'elasticnet'; - > v = {{alias:@stdlib/ml/base/sgd-classification/penalty-str2enum}}( v ); - > var out = {{alias}}( v ) - 'elasticnet' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/index.d.ts deleted file mode 100644 index 4c5628ed485e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the SGD classification penalty string associated with an SGD classification penalty enumeration constant. -* -* @param value - enumeration constant -* @returns penalty string -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* -* var v = str2enum( 'elasticnet' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'elasticnet' -*/ -declare function enum2str( value: number ): string | null; - - -// EXPORTS // - -export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/test.ts deleted file mode 100644 index fe80992105ef..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import enum2str = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - enum2str( 0 ); // $ExpectType string | null -} - -// The compiler throws an error if not provided a number... -{ - enum2str( '10' ); // $ExpectError - enum2str( true ); // $ExpectError - enum2str( false ); // $ExpectError - enum2str( null ); // $ExpectError - enum2str( undefined ); // $ExpectError - enum2str( [] ); // $ExpectError - enum2str( {} ); // $ExpectError - enum2str( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/examples/index.js deleted file mode 100644 index 3ad88420b4b8..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var enum2str = require( './../lib' ); - -var str = enum2str( str2enum( 'l1' ) ); -console.log( str ); -// => 'l1' - -str = enum2str( str2enum( 'elasticnet' ) ); -console.log( str ); -// => 'elasticnet' diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/index.js deleted file mode 100644 index e4dd8dcf89ca..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the SGD classification penalty string associated with an SGD classification penalty enumeration constant. -* -* @module @stdlib/ml/base/sgd-classification/penalty-enum2str -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* var enum2str = require( '@stdlib/ml/base/sgd-classification/penalty-enum2str' ); -* -* var v = str2enum( 'elasticnet' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'elasticnet' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/main.js deleted file mode 100644 index 5f6f90d3b281..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/lib/main.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var objectInverse = require( '@stdlib/object/inverse' ); -var enumeration = require( '@stdlib/ml/base/sgd-classification/penalties' ).enum; - - -// VARIABLES // - -var hash = objectInverse( enumeration(), { - 'duplicates': false -}); - - -// MAIN // - -/** -* Returns the SGD classification penalty string associated with an SGD classification penalty enumeration constant. -* -* @param {integer} value - penalty enumeration constant -* @returns {(string|null)} penalty string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* -* var v = str2enum( 'elasticnet' ); -* // returns -* -* var s = enum2str( v ); -* // returns 'elasticnet' -*/ -function enum2str( value ) { - var v = hash[ value ]; - return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/package.json deleted file mode 100644 index d4afa4c09971..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/penalty-enum2str", - "version": "0.0.0", - "description": "Return the SGD classification penalty string associated with an SGD classification penalty enumeration constant.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "penalty", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} 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 deleted file mode 100644 index f4f58701d115..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-enum2str/test/test.js +++ /dev/null @@ -1,67 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var enum2str = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'elasticnet', - 'l1', - 'l2', - 'none' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an enumeration constant', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - -9999999, - -999999999, - -99999999999 - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/README.md deleted file mode 100644 index 81a46389812b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/README.md +++ /dev/null @@ -1,124 +0,0 @@ - - -# resolve - -> Return the enumeration constant associated with a supported SGD classification penalty value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/penalty-resolve-enum' ); -``` - -#### resolve( value ) - -Returns the enumeration constant associated with a supported SGD classification penalty value. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); - -var v = resolve( 'elasticnet' ); -// returns - -v = resolve( str2enum( 'l1' ) ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/penalty-resolve-enum' ); - -var v = resolve( 'elasticnet' ); -// returns - -v = resolve( 'l1' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/benchmark/benchmark.js deleted file mode 100644 index 92df29536ea2..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/benchmark/benchmark.js +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'elasticnet', - 'l1', - 'l2' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'elasticnet' ), - str2enum( 'l1' ), - str2enum( 'l2' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/repl.txt deleted file mode 100644 index 99209f05ff13..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( value ) - Returns the enumeration constant associated with a supported SGD - classification penalty value. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an - opaque manner. - - Parameters - ---------- - value: any - Penalty value. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var s = 'elasticnet'; - > var v = {{alias}}( s ) - - > v = {{alias:@stdlib/ml/base/sgd-classification/penalty-str2enum}}( s ); - > {{alias}}( v ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/index.d.ts deleted file mode 100644 index 62a12f8eda7b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with a supported SGD classification penalty value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. -* -* @param value - penalty value -* @returns enumeration constant -* -* @example -* var v = resolve( 'elasticnet' ); -* // returns -*/ -declare function resolve( value: any ): number | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/test.ts deleted file mode 100644 index b585b2f1305d..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - resolve( 0 ); // $ExpectType number | null - resolve( 'elasticnet' ); // $ExpectType number | null -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/examples/index.js deleted file mode 100644 index 4d3c6047ef88..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var resolve = require( './../lib' ); - -var v = resolve( 'elasticnet' ); -console.log( v ); -// => - -v = resolve( 'l1' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/index.js deleted file mode 100644 index 6d227011f984..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with a supported SGD classification penalty value. -* -* @module @stdlib/ml/base/sgd-classification/penalty-resolve-enum -* -* @example -* var resolve = require( '@stdlib/ml/base/sgd-classification/penalty-resolve-enum' ); -* -* var v = resolve( 'elasticnet' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/main.js deleted file mode 100644 index b888d6f80f80..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/lib/main.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/sgd-classification/penalty-enum2str' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); - - -// MAIN // - -/** -* Returns the enumeration constant associated with a supported SGD classification penalty value. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. -* -* @param {*} value - penalty value -* @returns {(integer|null)} enumeration constant or null -* -* @example -* var v = resolve( 'elasticnet' ); -* // returns -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'number' ) { - return ( enum2str( value ) ) ? value : null; - } - if ( t === 'string' ) { - return str2enum( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/package.json deleted file mode 100644 index 1a6db6dd1923..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/penalty-resolve-enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with a supported SGD classification penalty value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "penalty", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/test/test.js deleted file mode 100644 index 358738fdcb8f..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-enum/test/test.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'elasticnet', - 'l1', - 'l2' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with an SGD classification penalty value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); - t.strictEqual( resolve( v ), v, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/README.md deleted file mode 100644 index 014ebca09230..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/README.md +++ /dev/null @@ -1,121 +0,0 @@ - - -# resolve - -> Return the penalty string associated with a supported SGD classification penalty value. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var resolve = require( '@stdlib/ml/base/sgd-classification/penalty-resolve-str' ); -``` - -#### resolve( value ) - -Returns the penalty string associated with a supported SGD classification penalty value. - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); - -var v = resolve( 'l1' ); -// returns 'l1' - -v = resolve( str2enum( 'l1' ) ); -// returns 'l1' -``` - -If unable to resolve an SGD classification penalty string, the function returns `null`. - -```javascript -var v = resolve( 'beep' ); -// returns null -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var resolve = require( '@stdlib/ml/base/sgd-classification/penalty-resolve-str' ); - -var v = resolve( str2enum( 'l1' ) ); -// returns 'l1' - -v = resolve( str2enum( 'elasticnet' ) ); -// returns 'elasticnet' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/benchmark/benchmark.js deleted file mode 100644 index ee30432b76eb..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/benchmark/benchmark.js +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var resolve = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'elasticnet', - 'l1', - 'l2' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::integer', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - str2enum( 'elasticnet' ), - str2enum( 'l1' ), - str2enum( 'l2' ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = resolve( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/repl.txt deleted file mode 100644 index 2436af8ed551..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/repl.txt +++ /dev/null @@ -1,26 +0,0 @@ - -{{alias}}( value ) - Returns the penalty string associated with a supported SGD classification - penalty value. - - Parameters - ---------- - value: any - Penalty value. - - Returns - ------- - out: string|null - Penalty string. - - Examples - -------- - > var v = {{alias}}( 'l1' ) - 'l1' - > v = {{alias:@stdlib/ml/base/sgd-classification/penalty-str2enum}}( 'l1' ); - > out = {{alias}}( v ) - 'l1' - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/index.d.ts deleted file mode 100644 index a15d131a49c5..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the penalty string associated with a supported SGD classification penalty value. -* -* @param value - penalty value -* @returns penalty string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* -* var v = resolve( str2enum( 'l1' ) ); -* // returns 'l1' -*/ -declare function resolve( value: any ): string | null; - - -// EXPORTS // - -export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/test.ts deleted file mode 100644 index 0c5f41116684..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/docs/types/test.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import resolve = require( './index' ); - - -// TESTS // - -// The function returns a string or null... -{ - resolve( 0 ); // $ExpectType string | null - resolve( 'l1' ); // $ExpectType string | null -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/examples/index.js deleted file mode 100644 index 125e14970b33..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var resolve = require( './../lib' ); - -var v = resolve( str2enum( 'l1' ) ); -console.log( v ); -// => 'l1' - -v = resolve( str2enum( 'elasticnet' ) ); -console.log( v ); -// => 'elasticnet' diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/index.js deleted file mode 100644 index cddb5dd36ff6..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the penalty string associated with a supported SGD classification penalty value. -* -* @module @stdlib/ml/base/sgd-classification/penalty-resolve-str -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* var resolve = require( '@stdlib/ml/base/sgd-classification/penalty-resolve-str' ); -* -* var v = resolve( str2enum( 'l1' ) ); -* // returns 'l1' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/main.js deleted file mode 100644 index 5e8d00c5b266..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/lib/main.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var enum2str = require( '@stdlib/ml/base/sgd-classification/penalty-enum2str' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); - - -// MAIN // - -/** -* Returns the penalty string associated with a supported SGD classification penalty value. -* -* @param {*} value - penalty value -* @returns {(string|null)} penalty string or null -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* -* var v = resolve( str2enum( 'l1' ) ); -* // returns 'l1' -*/ -function resolve( value ) { - var t = ( typeof value ); - if ( t === 'string' ) { - return ( str2enum( value ) === null ) ? null : value; - } - if ( t === 'number' ) { - return enum2str( value ); - } - return null; -} - - -// EXPORTS // - -module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/package.json deleted file mode 100644 index e5d78fe7663b..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/penalty-resolve-str", - "version": "0.0.0", - "description": "Return the penalty string associated with a supported SGD classification penalty value.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "ml", - "machine", - "learning", - "sgd classification", - "penalty", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/test/test.js deleted file mode 100644 index 42e271557217..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-resolve-str/test/test.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -var resolve = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'elasticnet', - 'l1', - 'l2' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof resolve, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the string associated with an SGD classification penalty value', function test( t ) { - var v; - var i; - for ( i = 0; i < VALUES.length; i++ ) { - v = str2enum( VALUES[ i ] ); - t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); - t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve a string', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - -99999999, - -9999999999, - -9999999999999, - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/README.md deleted file mode 100644 index c8bcf76adf8e..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/README.md +++ /dev/null @@ -1,119 +0,0 @@ - - -# str2enum - -> Return the enumeration constant associated with an SGD classification penalty string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -``` - -#### str2enum( penalty ) - -Returns the enumeration constant associated with an SGD classification penalty string. - -```javascript -var v = str2enum( 'l1' ); -// returns -``` - -If unable to resolve an enumeration constant, the function returns `null`. - -```javascript -var v = str2enum( 'beep' ); -// returns null -``` - -
- - - - - -
- -## Notes - -- Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. - -
- - - - - -
- -## Examples - - - -```javascript -var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); - -var v = str2enum( 'l1' ); -// returns - -v = str2enum( 'elasticnet' ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - 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 deleted file mode 100644 index d85a6826abf0..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var str2enum = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'elasticnet', - 'l1', - 'l2', - 'none' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str2enum( values[ i%values.length ] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/repl.txt deleted file mode 100644 index 709357ff73b5..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( penalty ) - Returns the enumeration constant associated with an SGD classification - penalty string. - - Downstream consumers of this function should *not* rely on specific integer - values (e.g., `ELASTICNET == 0`). Instead, the function should be used in - an opaque manner. - - Parameters - ---------- - penalty: string - Penalty. - - Returns - ------- - out: integer|null - Enumeration constant. - - Examples - -------- - > var out = {{alias}}( 'l1' ) - - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/index.d.ts deleted file mode 100644 index 5f843b089962..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the enumeration constant associated with an SGD classification penalty string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. -* -* @param penalty - penalty string -* @returns enumeration constant -* -* @example -* var v = str2enum( 'l1' ); -* // returns -*/ -declare function str2enum( penalty: string ): number | null; - - -// EXPORTS // - -export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/test.ts deleted file mode 100644 index 29e7ee6f3a1a..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/docs/types/test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import str2enum = require( './index' ); - - -// TESTS // - -// The function returns a number or null... -{ - str2enum( 'l1' ); // $ExpectType number | null -} - -// The compiler throws an error if not provided a string... -{ - str2enum( 10 ); // $ExpectError - str2enum( true ); // $ExpectError - str2enum( false ); // $ExpectError - str2enum( null ); // $ExpectError - str2enum( undefined ); // $ExpectError - str2enum( [] ); // $ExpectError - str2enum( {} ); // $ExpectError - str2enum( ( x: number ): number => x ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/examples/index.js deleted file mode 100644 index faaa6bb8a440..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/examples/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var str2enum = require( './../lib' ); - -var v = str2enum( 'l1' ); -console.log( v ); -// => - -v = str2enum( 'elasticnet' ); -console.log( v ); -// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/index.js deleted file mode 100644 index d1656208a86c..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the enumeration constant associated with an SGD classification penalty string. -* -* @module @stdlib/ml/base/sgd-classification/penalty-str2enum -* -* @example -* var str2enum = require( '@stdlib/ml/base/sgd-classification/penalty-str2enum' ); -* -* var v = str2enum( 'l1' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/main.js deleted file mode 100644 index 14f1fc580697..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/lib/main.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var enumeration = require( '@stdlib/ml/base/sgd-classification/penalties' ).enum; - - -// VARIABLES // - -var ENUM = enumeration(); - - -// MAIN // - -/** -* Returns the enumeration constant associated with an SGD classification penalty string. -* -* ## Notes -* -* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. -* -* @param {string} penalty - penalty string -* @returns {(integer|null)} integer value or null -* -* @example -* var v = str2enum( 'l1' ); -* // returns -*/ -function str2enum( penalty ) { - var v = ENUM[ penalty ]; - return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain -} - - -// EXPORTS // - -module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/package.json deleted file mode 100644 index 52cbdcf85632..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/ml/base/sgd-classification/penalty-str2enum", - "version": "0.0.0", - "description": "Return the enumeration constant associated with an SGD classification penalty 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 classification", - "penalty", - "utilities", - "utility", - "utils", - "util", - "enum" - ], - "__stdlib__": {} -} 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 deleted file mode 100644 index b956bb0273b1..000000000000 --- a/lib/node_modules/@stdlib/ml/base/sgd-classification/penalty-str2enum/test/test.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var enum2str = require( '@stdlib/ml/base/sgd-classification/penalty-enum2str' ); -var str2enum = require( './../lib' ); - - -// VARIABLES // - -var VALUES = [ - 'elasticnet', - 'l1', - 'l2', - 'none' -]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns the enumeration constant associated with a string', function test( t ) { - var i; - for ( i = 0; i < VALUES.length; i++ ) { - t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); - } - t.end(); -}); From 7ba7f2300c31793e1652df52ace371df3d11757b Mon Sep 17 00:00:00 2001 From: nakul-krishnakumar Date: Tue, 28 Jul 2026 13:24:37 +0530 Subject: [PATCH 2/3] feat: add `ml/base/sgd` --- 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: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../base/sgd/learning-rate-enum2str/README.md | 121 +++++++++++ .../benchmark/benchmark.js | 57 +++++ .../sgd/learning-rate-enum2str/docs/repl.txt | 24 +++ .../docs/types/index.d.ts | 41 ++++ .../learning-rate-enum2str/docs/types/test.ts | 39 ++++ .../learning-rate-enum2str/examples/index.js | 30 +++ .../sgd/learning-rate-enum2str/lib/index.js | 44 ++++ .../sgd/learning-rate-enum2str/lib/main.js | 60 ++++++ .../sgd/learning-rate-enum2str/package.json | 65 ++++++ .../sgd/learning-rate-enum2str/test/test.js | 67 ++++++ .../sgd/learning-rate-resolve-enum/README.md | 124 +++++++++++ .../benchmark/benchmark.js | 85 ++++++++ .../learning-rate-resolve-enum/docs/repl.txt | 30 +++ .../docs/types/index.d.ts | 40 ++++ .../docs/types/test.ts | 28 +++ .../examples/index.js | 29 +++ .../learning-rate-resolve-enum/lib/index.js | 40 ++++ .../learning-rate-resolve-enum/lib/main.js | 57 +++++ .../learning-rate-resolve-enum/package.json | 65 ++++++ .../learning-rate-resolve-enum/test/test.js | 76 +++++++ .../sgd/learning-rate-resolve-str/README.md | 121 +++++++++++ .../benchmark/benchmark.js | 85 ++++++++ .../learning-rate-resolve-str/docs/repl.txt | 26 +++ .../docs/types/index.d.ts | 38 ++++ .../docs/types/test.ts | 28 +++ .../examples/index.js | 30 +++ .../learning-rate-resolve-str/lib/index.js | 41 ++++ .../sgd/learning-rate-resolve-str/lib/main.js | 55 +++++ .../learning-rate-resolve-str/package.json | 65 ++++++ .../learning-rate-resolve-str/test/test.js | 76 +++++++ .../base/sgd/learning-rate-str2enum/README.md | 119 +++++++++++ .../benchmark/benchmark.js | 56 +++++ .../sgd/learning-rate-str2enum/docs/repl.txt | 27 +++ .../docs/types/index.d.ts | 40 ++++ .../learning-rate-str2enum/docs/types/test.ts | 39 ++++ .../learning-rate-str2enum/examples/index.js | 29 +++ .../sgd/learning-rate-str2enum/lib/index.js | 40 ++++ .../sgd/learning-rate-str2enum/lib/main.js | 56 +++++ .../sgd/learning-rate-str2enum/package.json | 65 ++++++ .../sgd/learning-rate-str2enum/test/test.js | 68 ++++++ .../ml/base/sgd/learning-rates/README.md | 190 +++++++++++++++++ .../sgd/learning-rates/benchmark/benchmark.js | 48 +++++ .../ml/base/sgd/learning-rates/docs/repl.txt | 30 +++ .../sgd/learning-rates/docs/types/index.d.ts | 35 +++ .../sgd/learning-rates/docs/types/test.ts | 32 +++ .../base/sgd/learning-rates/examples/index.js | 36 ++++ .../stdlib/ml/base/sgd/learning_rates.h | 39 ++++ .../ml/base/sgd/learning-rates/lib/data.json | 6 + .../ml/base/sgd/learning-rates/lib/enum.js | 57 +++++ .../ml/base/sgd/learning-rates/lib/index.js | 47 ++++ .../ml/base/sgd/learning-rates/lib/main.js | 44 ++++ .../ml/base/sgd/learning-rates/manifest.json | 36 ++++ .../ml/base/sgd/learning-rates/package.json | 67 ++++++ .../ml/base/sgd/learning-rates/test/test.js | 77 +++++++ .../base/sgd/loss-function-enum2str/README.md | 121 +++++++++++ .../benchmark/benchmark.js | 62 ++++++ .../sgd/loss-function-enum2str/docs/repl.txt | 25 +++ .../docs/types/index.d.ts | 41 ++++ .../loss-function-enum2str/docs/types/test.ts | 39 ++++ .../loss-function-enum2str/examples/index.js | 30 +++ .../sgd/loss-function-enum2str/lib/index.js | 44 ++++ .../sgd/loss-function-enum2str/lib/main.js | 60 ++++++ .../sgd/loss-function-enum2str/package.json | 65 ++++++ .../sgd/loss-function-enum2str/test/test.js | 72 +++++++ .../sgd/loss-function-resolve-enum/README.md | 124 +++++++++++ .../benchmark/benchmark.js | 95 +++++++++ .../loss-function-resolve-enum/docs/repl.txt | 31 +++ .../docs/types/index.d.ts | 40 ++++ .../docs/types/test.ts | 28 +++ .../examples/index.js | 29 +++ .../loss-function-resolve-enum/lib/index.js | 40 ++++ .../loss-function-resolve-enum/lib/main.js | 57 +++++ .../loss-function-resolve-enum/package.json | 65 ++++++ .../loss-function-resolve-enum/test/test.js | 81 +++++++ .../sgd/loss-function-resolve-str/README.md | 121 +++++++++++ .../benchmark/benchmark.js | 95 +++++++++ .../loss-function-resolve-str/docs/repl.txt | 26 +++ .../docs/types/index.d.ts | 38 ++++ .../docs/types/test.ts | 28 +++ .../examples/index.js | 30 +++ .../loss-function-resolve-str/lib/index.js | 41 ++++ .../sgd/loss-function-resolve-str/lib/main.js | 55 +++++ .../loss-function-resolve-str/package.json | 65 ++++++ .../loss-function-resolve-str/test/test.js | 81 +++++++ .../base/sgd/loss-function-str2enum/README.md | 119 +++++++++++ .../benchmark/benchmark.js | 61 ++++++ .../sgd/loss-function-str2enum/docs/repl.txt | 27 +++ .../docs/types/index.d.ts | 40 ++++ .../loss-function-str2enum/docs/types/test.ts | 39 ++++ .../loss-function-str2enum/examples/index.js | 29 +++ .../sgd/loss-function-str2enum/lib/index.js | 40 ++++ .../sgd/loss-function-str2enum/lib/main.js | 56 +++++ .../sgd/loss-function-str2enum/package.json | 65 ++++++ .../sgd/loss-function-str2enum/test/test.js | 73 +++++++ .../ml/base/sgd/loss-functions/README.md | 200 ++++++++++++++++++ .../sgd/loss-functions/benchmark/benchmark.js | 48 +++++ .../ml/base/sgd/loss-functions/docs/repl.txt | 35 +++ .../sgd/loss-functions/docs/types/index.d.ts | 35 +++ .../sgd/loss-functions/docs/types/test.ts | 32 +++ .../base/sgd/loss-functions/examples/index.js | 36 ++++ .../stdlib/ml/base/sgd/loss_functions.h | 54 +++++ .../ml/base/sgd/loss-functions/lib/data.json | 11 + .../ml/base/sgd/loss-functions/lib/enum.js | 72 +++++++ .../ml/base/sgd/loss-functions/lib/index.js | 47 ++++ .../ml/base/sgd/loss-functions/lib/main.js | 44 ++++ .../ml/base/sgd/loss-functions/manifest.json | 36 ++++ .../ml/base/sgd/loss-functions/package.json | 66 ++++++ .../ml/base/sgd/loss-functions/test/test.js | 87 ++++++++ .../@stdlib/ml/base/sgd/penalties/README.md | 190 +++++++++++++++++ .../base/sgd/penalties/benchmark/benchmark.js | 48 +++++ .../ml/base/sgd/penalties/docs/repl.txt | 28 +++ .../base/sgd/penalties/docs/types/index.d.ts | 35 +++ .../ml/base/sgd/penalties/docs/types/test.ts | 32 +++ .../ml/base/sgd/penalties/examples/index.js | 36 ++++ .../include/stdlib/ml/base/sgd/penalties.h | 39 ++++ .../ml/base/sgd/penalties/lib/data.json | 6 + .../@stdlib/ml/base/sgd/penalties/lib/enum.js | 57 +++++ .../ml/base/sgd/penalties/lib/index.js | 47 ++++ .../@stdlib/ml/base/sgd/penalties/lib/main.js | 44 ++++ .../ml/base/sgd/penalties/manifest.json | 36 ++++ .../ml/base/sgd/penalties/package.json | 66 ++++++ .../ml/base/sgd/penalties/test/test.js | 77 +++++++ .../ml/base/sgd/penalty-enum2str/README.md | 121 +++++++++++ .../penalty-enum2str/benchmark/benchmark.js | 57 +++++ .../base/sgd/penalty-enum2str/docs/repl.txt | 25 +++ .../penalty-enum2str/docs/types/index.d.ts | 41 ++++ .../sgd/penalty-enum2str/docs/types/test.ts | 39 ++++ .../sgd/penalty-enum2str/examples/index.js | 30 +++ .../ml/base/sgd/penalty-enum2str/lib/index.js | 44 ++++ .../ml/base/sgd/penalty-enum2str/lib/main.js | 60 ++++++ .../ml/base/sgd/penalty-enum2str/package.json | 65 ++++++ .../ml/base/sgd/penalty-enum2str/test/test.js | 67 ++++++ .../base/sgd/penalty-resolve-enum/README.md | 124 +++++++++++ .../benchmark/benchmark.js | 83 ++++++++ .../sgd/penalty-resolve-enum/docs/repl.txt | 31 +++ .../docs/types/index.d.ts | 40 ++++ .../penalty-resolve-enum/docs/types/test.ts | 28 +++ .../penalty-resolve-enum/examples/index.js | 29 +++ .../sgd/penalty-resolve-enum/lib/index.js | 40 ++++ .../base/sgd/penalty-resolve-enum/lib/main.js | 57 +++++ .../sgd/penalty-resolve-enum/package.json | 65 ++++++ .../sgd/penalty-resolve-enum/test/test.js | 75 +++++++ .../ml/base/sgd/penalty-resolve-str/README.md | 121 +++++++++++ .../benchmark/benchmark.js | 83 ++++++++ .../sgd/penalty-resolve-str/docs/repl.txt | 25 +++ .../penalty-resolve-str/docs/types/index.d.ts | 38 ++++ .../penalty-resolve-str/docs/types/test.ts | 28 +++ .../sgd/penalty-resolve-str/examples/index.js | 30 +++ .../base/sgd/penalty-resolve-str/lib/index.js | 41 ++++ .../base/sgd/penalty-resolve-str/lib/main.js | 55 +++++ .../base/sgd/penalty-resolve-str/package.json | 65 ++++++ .../base/sgd/penalty-resolve-str/test/test.js | 75 +++++++ .../ml/base/sgd/penalty-str2enum/README.md | 119 +++++++++++ .../penalty-str2enum/benchmark/benchmark.js | 56 +++++ .../base/sgd/penalty-str2enum/docs/repl.txt | 26 +++ .../penalty-str2enum/docs/types/index.d.ts | 40 ++++ .../sgd/penalty-str2enum/docs/types/test.ts | 39 ++++ .../sgd/penalty-str2enum/examples/index.js | 29 +++ .../ml/base/sgd/penalty-str2enum/lib/index.js | 40 ++++ .../ml/base/sgd/penalty-str2enum/lib/main.js | 56 +++++ .../ml/base/sgd/penalty-str2enum/package.json | 65 ++++++ .../ml/base/sgd/penalty-str2enum/test/test.js | 68 ++++++ 162 files changed, 9012 insertions(+) create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/include/stdlib/ml/base/sgd/learning_rates.h create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/data.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/enum.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/manifest.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/learning-rates/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/include/stdlib/ml/base/sgd/loss_functions.h create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/data.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/enum.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/manifest.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/loss-functions/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/include/stdlib/ml/base/sgd/penalties.h create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/data.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/enum.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/manifest.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalties/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/test/test.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/README.md create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/examples/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/index.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/main.js create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/package.json create mode 100644 lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/test/test.js diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/README.md new file mode 100644 index 000000000000..b6f74898e755 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/README.md @@ -0,0 +1,121 @@ + + +# enum2str + +> Return the SGD learning rate scheduler string associated with an SGD learning rate scheduler enumeration constant. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var enum2str = require( '@stdlib/ml/base/sgd/learning-rate-enum2str' ); +``` + +#### enum2str( value ) + +Returns the SGD learning rate scheduler string associated with an SGD learning rate scheduler enumeration constant. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); + +var v = str2enum( 'basic' ); +// returns + +var s = enum2str( v ); +// returns 'basic' +``` + +If unable to resolve an SGD learning rate scheduler string, the function returns `null`. + +```javascript +var v = enum2str( -999999999 ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var enum2str = require( '@stdlib/ml/base/sgd/learning-rate-enum2str' ); + +var str = enum2str( str2enum( 'basic' ) ); +// returns 'basic' + +str = enum2str( str2enum( 'constant' ) ); +// returns 'constant' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/benchmark/benchmark.js new file mode 100644 index 000000000000..1c63048733dd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/benchmark/benchmark.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var pkg = require( './../package.json' ).name; +var enum2str = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'basic' ), + str2enum( 'constant' ), + str2enum( 'invscaling' ), + str2enum( 'pegasos' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = enum2str( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt new file mode 100644 index 000000000000..98a6ccf480fe --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt @@ -0,0 +1,24 @@ + +{{alias}}( value ) + Returns the SGD learning rate scheduler string associated with an SGD + learning rate scheduler enumeration constant. + + Parameters + ---------- + value: integer + Learning rate scheduler enumeration constant. + + Returns + ------- + out: string|null + Learning rate scheduler string. + + Examples + -------- + > var out = {{alias}}( + ... {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( 'basic' ) ) + 'basic' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/index.d.ts new file mode 100644 index 000000000000..e99ce434db9c --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/index.d.ts @@ -0,0 +1,41 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the SGD learning rate scheduler string associated with an SGD learning rate scheduler enumeration constant. +* +* @param value - enumeration constant +* @returns learning rate scheduler string +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* +* var v = str2enum( 'basic' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'basic' +*/ +declare function enum2str( value: number ): string | null; + + +// EXPORTS // + +export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/test.ts new file mode 100644 index 000000000000..fe80992105ef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import enum2str = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + enum2str( 0 ); // $ExpectType string | null +} + +// The compiler throws an error if not provided a number... +{ + enum2str( '10' ); // $ExpectError + enum2str( true ); // $ExpectError + enum2str( false ); // $ExpectError + enum2str( null ); // $ExpectError + enum2str( undefined ); // $ExpectError + enum2str( [] ); // $ExpectError + enum2str( {} ); // $ExpectError + enum2str( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/examples/index.js new file mode 100644 index 000000000000..a17c3d2dc6be --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var enum2str = require( './../lib' ); + +var str = enum2str( str2enum( 'constant' ) ); +console.log( str ); +// => 'constant' + +str = enum2str( str2enum( 'basic' ) ); +console.log( str ); +// => 'basic' diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/index.js new file mode 100644 index 000000000000..88ba2a87d639 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the SGD learning rate scheduler string associated with an SGD learning rate scheduler enumeration constant. +* +* @module @stdlib/ml/base/sgd/learning-rate-enum2str +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* var enum2str = require( '@stdlib/ml/base/sgd/learning-rate-enum2str' ); +* +* var v = str2enum( 'basic' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'basic' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/main.js new file mode 100644 index 000000000000..effba8d112aa --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var objectInverse = require( '@stdlib/object/inverse' ); +var enumeration = require( '@stdlib/ml/base/sgd/learning-rates' ).enum; + + +// VARIABLES // + +var hash = objectInverse( enumeration(), { + 'duplicates': false +}); + + +// MAIN // + +/** +* Returns the SGD learning rate scheduler string associated with an SGD learning rate scheduler enumeration constant. +* +* @param {integer} value - learning rate scheduler enumeration constant +* @returns {(string|null)} learning rate scheduler string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* +* var v = str2enum( 'basic' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'basic' +*/ +function enum2str( value ) { + var v = hash[ value ]; + return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/package.json new file mode 100644 index 000000000000..c64fee565da7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/learning-rate-enum2str", + "version": "0.0.0", + "description": "Return the SGD learning rate scheduler string associated with an SGD learning rate scheduler enumeration constant.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "learning rate", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/test/test.js new file mode 100644 index 000000000000..d50c7697fca2 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/test/test.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var enum2str = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an enumeration constant', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + -9999999, + -999999999, + -99999999999 + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/README.md new file mode 100644 index 000000000000..bdd71cc9162a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/README.md @@ -0,0 +1,124 @@ + + +# resolve + +> Return the enumeration constant associated with a supported SGD learning rate scheduler value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' ); +``` + +#### resolve( value ) + +Returns the enumeration constant associated with a supported SGD learning rate scheduler value. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); + +var v = resolve( 'basic' ); +// returns + +v = resolve( str2enum( 'constant' ) ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' ); + +var v = resolve( 'basic' ); +// returns + +v = resolve( 'constant' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/benchmark/benchmark.js new file mode 100644 index 000000000000..05210e56faaa --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/benchmark/benchmark.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'basic' ), + str2enum( 'constant' ), + str2enum( 'invscaling' ), + str2enum( 'pegasos' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt new file mode 100644 index 000000000000..7dedfd9dca49 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt @@ -0,0 +1,30 @@ + +{{alias}}( value ) + Returns the enumeration constant associated with a supported SGD learning + rate scheduler value. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `BASIC == 0`). Instead, the function should be used in an + opaque manner. + + Parameters + ---------- + value: any + Learning rate scheduler value. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'basic' ) + + > out = {{alias}}( {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( + ... 'basic' ) ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/index.d.ts new file mode 100644 index 000000000000..8bafb336ff41 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with a supported SGD learning rate scheduler value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. +* +* @param value - learning rate scheduler value +* @returns enumeration constant +* +* @example +* var v = resolve( 'basic' ); +* // returns +*/ +declare function resolve( value: any ): number | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/test.ts new file mode 100644 index 000000000000..125d9f7a122e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + resolve( 0 ); // $ExpectType number | null + resolve( 'basic' ); // $ExpectType number | null +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/examples/index.js new file mode 100644 index 000000000000..8e913704a76b --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var resolve = require( './../lib' ); + +var v = resolve( 'basic' ); +console.log( v ); +// => + +v = resolve( 'constant' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/index.js new file mode 100644 index 000000000000..9e4d45439b79 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with a supported SGD learning rate scheduler value. +* +* @module @stdlib/ml/base/sgd/learning-rate-resolve-enum +* +* @example +* var resolve = require( '@stdlib/ml/base/sgd/learning-rate-resolve-enum' ); +* +* var v = resolve( 'basic' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/main.js new file mode 100644 index 000000000000..464238a9764f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/sgd/learning-rate-enum2str' ); +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); + + +// MAIN // + +/** +* Returns the enumeration constant associated with a supported SGD learning rate scheduler value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. +* +* @param {*} value - learning rate scheduler value +* @returns {(integer|null)} enumeration constant or null +* +* @example +* var v = resolve( 'basic' ); +* // returns +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'number' ) { + return ( enum2str( value ) ) ? value : null; + } + if ( t === 'string' ) { + return str2enum( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/package.json new file mode 100644 index 000000000000..09b6da9eb307 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/learning-rate-resolve-enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with a supported SGD learning rate scheduler value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "learning rate", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/test/test.js new file mode 100644 index 000000000000..ed8293a6f45d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/test/test.js @@ -0,0 +1,76 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with an SGD learning rate scheduler value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); + t.strictEqual( resolve( v ), v, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/README.md new file mode 100644 index 000000000000..e8b505e56edd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/README.md @@ -0,0 +1,121 @@ + + +# resolve + +> Return the learning rate scheduler string associated with a supported SGD learning rate scheduler value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/learning-rate-resolve-str' ); +``` + +#### resolve( value ) + +Returns the learning rate scheduler string associated with a supported SGD learning rate scheduler value. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); + +var v = resolve( 'constant' ); +// returns 'constant' + +v = resolve( str2enum( 'constant' ) ); +// returns 'constant' +``` + +If unable to resolve an SGD learning rate scheduler string, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var resolve = require( '@stdlib/ml/base/sgd/learning-rate-resolve-str' ); + +var v = resolve( str2enum( 'constant' ) ); +// returns 'constant' + +v = resolve( str2enum( 'basic' ) ); +// returns 'basic' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/benchmark/benchmark.js new file mode 100644 index 000000000000..eca6ba815644 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/benchmark/benchmark.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'basic' ), + str2enum( 'constant' ), + str2enum( 'invscaling' ), + str2enum( 'pegasos' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt new file mode 100644 index 000000000000..6350c05bc737 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Returns the learning rate scheduler string associated with a supported SGD + learning rate scheduler value. + + Parameters + ---------- + value: any + Learning rate scheduler value. + + Returns + ------- + out: string|null + Learning rate scheduler string. + + Examples + -------- + > var out = {{alias}}( 'constant' ) + 'constant' + > out = {{alias}}( {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( + ... 'constant' ) ) + 'constant' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/index.d.ts new file mode 100644 index 000000000000..81525ae5ecde --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/index.d.ts @@ -0,0 +1,38 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the learning rate scheduler string associated with a supported SGD learning rate scheduler value. +* +* @param value - learning rate scheduler value +* @returns learning rate scheduler string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* +* var v = resolve( str2enum( 'constant' ) ); +* // returns 'constant' +*/ +declare function resolve( value: any ): string | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/test.ts new file mode 100644 index 000000000000..d122510e714b --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + resolve( 0 ); // $ExpectType string | null + resolve( 'constant' ); // $ExpectType string | null +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/examples/index.js new file mode 100644 index 000000000000..601cb4491a9b --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var resolve = require( './../lib' ); + +var v = resolve( str2enum( 'constant' ) ); +console.log( v ); +// => 'constant' + +v = resolve( str2enum( 'basic' ) ); +console.log( v ); +// => 'basic' diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/index.js new file mode 100644 index 000000000000..1b4684b6e64b --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the learning rate scheduler string associated with a supported SGD learning rate scheduler value. +* +* @module @stdlib/ml/base/sgd/learning-rate-resolve-str +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* var resolve = require( '@stdlib/ml/base/sgd/learning-rate-resolve-str' ); +* +* var v = resolve( str2enum( 'constant' ) ); +* // returns 'constant' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/main.js new file mode 100644 index 000000000000..192cc1dcc919 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/sgd/learning-rate-enum2str' ); +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); + + +// MAIN // + +/** +* Returns the learning rate scheduler string associated with a supported SGD learning rate scheduler value. +* +* @param {*} value - learning rate scheduler value +* @returns {(string|null)} learning rate scheduler string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* +* var v = resolve( str2enum( 'constant' ) ); +* // returns 'constant' +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'string' ) { + return ( str2enum( value ) === null ) ? null : value; + } + if ( t === 'number' ) { + return enum2str( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/package.json new file mode 100644 index 000000000000..38296d46fbe6 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/learning-rate-resolve-str", + "version": "0.0.0", + "description": "Return the learning rate scheduler string associated with a supported SGD learning rate scheduler value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "learning rate", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/test/test.js new file mode 100644 index 000000000000..bd51babfa1e7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/test/test.js @@ -0,0 +1,76 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an SGD learning rate scheduler value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); + t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/README.md new file mode 100644 index 000000000000..6f33395cac86 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/README.md @@ -0,0 +1,119 @@ + + +# str2enum + +> Return the enumeration constant associated with an SGD learning rate scheduler string. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +``` + +#### str2enum( learningRate ) + +Returns the enumeration constant associated with an SGD learning rate scheduler string. + +```javascript +var v = str2enum( 'constant' ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = str2enum( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); + +var v = str2enum( 'constant' ); +// returns + +v = str2enum( 'basic' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/benchmark/benchmark.js new file mode 100644 index 000000000000..96cb8ab2ee54 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/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 isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var str2enum = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = str2enum( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/repl.txt new file mode 100644 index 000000000000..61a447cfe799 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/repl.txt @@ -0,0 +1,27 @@ + +{{alias}}( learningRate ) + Returns the enumeration constant associated with an SGD learning rate + scheduler string. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `BASIC == 0`). Instead, the function should be used in an + opaque manner. + + Parameters + ---------- + learningRate: string + Learning rate scheduler. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'constant' ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/index.d.ts new file mode 100644 index 000000000000..8c59cd76146a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with an SGD learning rate scheduler string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. +* +* @param learningRate - learning rate scheduler string +* @returns enumeration constant +* +* @example +* var v = str2enum( 'constant' ); +* // returns +*/ +declare function str2enum( learningRate: string ): number | null; + + +// EXPORTS // + +export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/test.ts new file mode 100644 index 000000000000..7d45e990746e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import str2enum = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + str2enum( 'constant' ); // $ExpectType number | null +} + +// The compiler throws an error if not provided a string... +{ + str2enum( 10 ); // $ExpectError + str2enum( true ); // $ExpectError + str2enum( false ); // $ExpectError + str2enum( null ); // $ExpectError + str2enum( undefined ); // $ExpectError + str2enum( [] ); // $ExpectError + str2enum( {} ); // $ExpectError + str2enum( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/examples/index.js new file mode 100644 index 000000000000..69f951ceb6bf --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( './../lib' ); + +var v = str2enum( 'constant' ); +console.log( v ); +// => + +v = str2enum( 'basic' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/index.js new file mode 100644 index 000000000000..435be6f2cd2d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with an SGD learning rate scheduler string. +* +* @module @stdlib/ml/base/sgd/learning-rate-str2enum +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/learning-rate-str2enum' ); +* +* var v = str2enum( 'constant' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/main.js new file mode 100644 index 000000000000..7adfdad0896f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var enumeration = require( '@stdlib/ml/base/sgd/learning-rates' ).enum; + + +// VARIABLES // + +var ENUM = enumeration(); + + +// MAIN // + +/** +* Returns the enumeration constant associated with an SGD learning rate scheduler string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the function should be used in an opaque manner. +* +* @param {string} learningRate - learning rate scheduler string +* @returns {(integer|null)} integer value or null +* +* @example +* var v = str2enum( 'constant' ); +* // returns +*/ +function str2enum( learningRate ) { + var v = ENUM[ learningRate ]; + return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/package.json new file mode 100644 index 000000000000..3e3c195e8aeb --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/learning-rate-str2enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with an SGD learning rate scheduler 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", + "learning rate", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/test/test.js new file mode 100644 index 000000000000..c71e19ff8b66 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-str2enum/test/test.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var enum2str = require( '@stdlib/ml/base/sgd/learning-rate-enum2str' ); +var str2enum = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'constant', + 'basic', + 'invscaling', + 'pegasos' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with a string', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar' + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/README.md b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/README.md new file mode 100644 index 000000000000..906c02913af7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/README.md @@ -0,0 +1,190 @@ + + +# Learning rates + +> SGD learning rate schedulers. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var learningRates = require( '@stdlib/ml/base/sgd/learning-rates' ); +``` + +#### learningRates() + +Returns a list of SGD learning rate schedulers. + +```javascript +var out = learningRates(); +// e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] +``` + +The output array contains the following learning rate schedulers: + +- `basic`: basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration. +- `constant`: constant learning rate function. +- `invscaling`: inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases. +- `pegasos`: Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter. + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var learningRates = require( '@stdlib/ml/base/sgd/learning-rates' ); + +var isLearningRate = contains( learningRates() ); + +var bool = isLearningRate( 'constant' ); +// returns true + +bool = isLearningRate( 'pegasos' ); +// returns true + +bool = isLearningRate( 'beep' ); +// returns false +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/ml/base/sgd/learning_rates.h" +``` + +#### STDLIB_ML_SGD_LEARNING_RATE + +An enumeration of SGD learning rate schedulers with the following fields: + +- **STDLIB_ML_SGD_BASIC**: basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration. +- **STDLIB_ML_SGD_CONSTANT**: constant learning rate function. +- **STDLIB_ML_SGD_INVSCALING**: inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases. +- **STDLIB_ML_SGD_PEGASOS**: Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter. + +```c +#include "stdlib/ml/base/sgd/learning_rates.h" + +const enum STDLIB_ML_SGD_LEARNING_RATE v = STDLIB_ML_SGD_BASIC; +``` + +
+ + + + + +
+ +### Notes + +- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. + +
+ + + + + +
+ +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/benchmark/benchmark.js new file mode 100644 index 000000000000..95c330ebd9fb --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var learningRates = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = learningRates(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/repl.txt new file mode 100644 index 000000000000..40ebe7fd448b --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/repl.txt @@ -0,0 +1,30 @@ + +{{alias}}() + Returns a list of SGD learning rate schedulers. + + The output array contains the following learning rate schedulers: + + - basic: basic learning rate function according to the formula `10/(10+t)` + where `t` is the current iteration. + - constant: constant learning rate function. + - invscaling: inverse scaling learning rate function according to the + formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and + `power_t` is the exponent controlling how quickly the learning rate + decreases. + - pegasos: Pegasos learning rate function according to the formula + `1/(lambda*t)` where `t` is the current iteration and `lambda` is the + regularization parameter. + + Returns + ------- + out: Array + List of learning rate schedulers. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/index.d.ts new file mode 100644 index 000000000000..40357d3d197f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of SGD learning rate schedulers. +* +* @returns list of learning rate schedulers +* +* @example +* var list = learningRates(); +* // e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] +*/ +declare function learningRates(): Array; + + +// EXPORTS // + +export = learningRates; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/test.ts new file mode 100644 index 000000000000..c8605c6f84de --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import learningRates = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + learningRates(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + learningRates( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/examples/index.js new file mode 100644 index 000000000000..c7427e0fe2fd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var learningRates = require( './../lib' ); + +var isLearningRate = contains( learningRates() ); + +var bool = isLearningRate( 'basic' ); +console.log( bool ); +// => true + +bool = isLearningRate( 'constant' ); +console.log( bool ); +// => true + +bool = isLearningRate( 'beep' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/include/stdlib/ml/base/sgd/learning_rates.h b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/include/stdlib/ml/base/sgd/learning_rates.h new file mode 100644 index 000000000000..76eaa63aad41 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/include/stdlib/ml/base/sgd/learning_rates.h @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_ML_BASE_SGD_LEARNING_RATES_H +#define STDLIB_ML_BASE_SGD_LEARNING_RATES_H + +/** +* Enumeration of SGD learning rate schedulers. +*/ +enum STDLIB_ML_SGD_LEARNING_RATE { + // Basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration: + STDLIB_ML_SGD_BASIC = 0, + + // Constant learning rate function: + STDLIB_ML_SGD_CONSTANT, + + // Inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases: + STDLIB_ML_SGD_INVSCALING, + + // Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter: + STDLIB_ML_SGD_PEGASOS +}; + +#endif // !STDLIB_ML_BASE_SGD_LEARNING_RATES_H diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/data.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/data.json new file mode 100644 index 000000000000..9f4424ed10e9 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/data.json @@ -0,0 +1,6 @@ +[ + "basic", + "constant", + "invscaling", + "pegasos" +] diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/enum.js new file mode 100644 index 000000000000..27c8b2643a09 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/enum.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns an object mapping supported learning rate schedulers to integer values for purposes of C inter-operation. +* +* ## Notes +* +* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `BASIC == 0`). Instead, the object should be used in an opaque manner. +* - The main purpose of this function is JavaScript and C inter-operation. +* +* @returns {Object} object mapping supported learning rate schedulers to integer values +* +* @example +* var table = enumerated(); +* // returns +*/ +function enumerated() { + // NOTE: the following should match the C `learning rates.h` enumeration!!!! + return { + // Basic learning rate function according to the formula `10/(10+t)` where `t` is the current iteration: + 'basic': 0, + + // Constant learning rate function: + 'constant': 1, + + // Inverse scaling learning rate function according to the formula `eta0/pow(t, power_t)` where `eta0` is the initial learning rate and `power_t` is the exponent controlling how quickly the learning rate decreases: + 'invscaling': 2, + + // Pegasos learning rate function according to the formula `1/(lambda*t)` where `t` is the current iteration and `lambda` is the regularization parameter: + 'pegasos': 3 + }; +} + + +// EXPORTS // + +module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/index.js new file mode 100644 index 000000000000..2df50d20e3f7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of SGD learning rate schedulers. +* +* @module @stdlib/ml/base/sgd/learning-rates +* +* @example +* var learningRates = require( '@stdlib/ml/base/sgd/learning-rates' ); +* +* var list = learningRates(); +* // e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var enumeration = require( './enum.js' ); + + +// MAIN // + +setReadOnly( main, 'enum', enumeration ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/main.js new file mode 100644 index 000000000000..7ceccd893820 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of SGD learning rate schedulers. +* +* @returns {Array} list of learning rate schedulers +* +* @example +* var list = learningRates(); +* // e.g., returns [ 'basic', 'constant', 'invscaling', 'pegasos' ] +*/ +function learningRates() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = learningRates; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/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/learning-rates/package.json b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/package.json new file mode 100644 index 000000000000..bfe74db89474 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/package.json @@ -0,0 +1,67 @@ +{ + "name": "@stdlib/ml/base/sgd/learning-rates", + "version": "0.0.0", + "description": "SGD learning rate schedulers.", + "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", + "learning rates", + "learning rate schedulers", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/test/test.js new file mode 100644 index 000000000000..674f7f2a01e8 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rates/test/test.js @@ -0,0 +1,77 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var learningRates = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof learningRates, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of SGD learning rate schedulers', function test( t ) { + var expected; + var actual; + + expected = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' + ]; + actual = learningRates(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main function is an `enum` method to return an object mapping learning rate schedulers to integer values for C inter-operation', function test( t ) { + var obj; + var o; + var i; + + t.strictEqual( hasOwnProp( learningRates, 'enum' ), true, 'has property' ); + t.strictEqual( typeof learningRates.enum, 'function', 'has method' ); + + obj = learningRates.enum(); + t.strictEqual( typeof obj, 'object', 'returns expected value' ); + + // List of values which should be supported... + o = [ + 'basic', + 'constant', + 'invscaling', + 'pegasos' + ]; + for ( i = 0; i < o.length; i++ ) { + t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); + t.strictEqual( isNonNegativeInteger( obj[ o[ i ] ] ), true, 'returns expected value' ); + } + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/README.md new file mode 100644 index 000000000000..56759f577d3c --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/README.md @@ -0,0 +1,121 @@ + + +# enum2str + +> Return the SGD loss function string associated with an SGD loss function enumeration constant. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var enum2str = require( '@stdlib/ml/base/sgd/loss-function-enum2str' ); +``` + +#### enum2str( value ) + +Returns the SGD loss function string associated with an SGD loss function enumeration constant. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); + +var v = str2enum( 'epsilon-insensitive' ); +// returns + +var s = enum2str( v ); +// returns 'epsilon-insensitive' +``` + +If unable to resolve an SGD loss function string, the function returns `null`. + +```javascript +var v = enum2str( -999999999 ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var enum2str = require( '@stdlib/ml/base/sgd/loss-function-enum2str' ); + +var str = enum2str( str2enum( 'epsilon-insensitive' ) ); +// returns 'epsilon-insensitive' + +str = enum2str( str2enum( 'hinge' ) ); +// returns 'hinge' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/benchmark/benchmark.js new file mode 100644 index 000000000000..9a74f1f2a1c3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var pkg = require( './../package.json' ).name; +var enum2str = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'epsilon-insensitive' ), + str2enum( 'hinge' ), + str2enum( 'huber' ), + str2enum( 'log' ), + str2enum( 'modified-huber' ), + str2enum( 'perceptron' ), + str2enum( 'squared-epsilon-insensitive' ), + str2enum( 'squared-error' ), + str2enum( 'squared-hinge' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = enum2str( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt new file mode 100644 index 000000000000..2a18d50b834d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( value ) + Returns the SGD loss function string associated with an SGD loss function + enumeration constant. + + Parameters + ---------- + value: integer + Loss function enumeration constant. + + Returns + ------- + out: string|null + Loss function string. + + Examples + -------- + > var out = {{alias}}( + ... {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( + ... 'epsilon-insensitive' ) ) + 'epsilon-insensitive' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/index.d.ts new file mode 100644 index 000000000000..56e51bc0877e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/index.d.ts @@ -0,0 +1,41 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the SGD loss function string associated with an SGD loss function enumeration constant. +* +* @param value - enumeration constant +* @returns loss function string +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* +* var v = str2enum( 'epsilon-insensitive' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'epsilon-insensitive' +*/ +declare function enum2str( value: number ): string | null; + + +// EXPORTS // + +export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/test.ts new file mode 100644 index 000000000000..fe80992105ef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import enum2str = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + enum2str( 0 ); // $ExpectType string | null +} + +// The compiler throws an error if not provided a number... +{ + enum2str( '10' ); // $ExpectError + enum2str( true ); // $ExpectError + enum2str( false ); // $ExpectError + enum2str( null ); // $ExpectError + enum2str( undefined ); // $ExpectError + enum2str( [] ); // $ExpectError + enum2str( {} ); // $ExpectError + enum2str( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/examples/index.js new file mode 100644 index 000000000000..d2b28c76ff04 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var enum2str = require( './../lib' ); + +var str = enum2str( str2enum( 'hinge' ) ); +console.log( str ); +// => 'hinge' + +str = enum2str( str2enum( 'epsilon-insensitive' ) ); +console.log( str ); +// => 'epsilon-insensitive' diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/index.js new file mode 100644 index 000000000000..ab1982084a63 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the SGD loss function string associated with an SGD loss function enumeration constant. +* +* @module @stdlib/ml/base/sgd/loss-function-enum2str +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* var enum2str = require( '@stdlib/ml/base/sgd/loss-function-enum2str' ); +* +* var v = str2enum( 'epsilon-insensitive' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'epsilon-insensitive' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/main.js new file mode 100644 index 000000000000..70b656f17018 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var objectInverse = require( '@stdlib/object/inverse' ); +var enumeration = require( '@stdlib/ml/base/sgd/loss-functions' ).enum; + + +// VARIABLES // + +var hash = objectInverse( enumeration(), { + 'duplicates': false +}); + + +// MAIN // + +/** +* Returns the SGD loss function string associated with an SGD loss function enumeration constant. +* +* @param {integer} value - loss function enumeration constant +* @returns {(string|null)} loss function string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* +* var v = str2enum( 'epsilon-insensitive' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'epsilon-insensitive' +*/ +function enum2str( value ) { + var v = hash[ value ]; + return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/package.json new file mode 100644 index 000000000000..7801ea8df74b --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/loss-function-enum2str", + "version": "0.0.0", + "description": "Return the SGD loss function string associated with an SGD loss function enumeration constant.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "loss function", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/test/test.js new file mode 100644 index 000000000000..0d71cb09e064 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/test/test.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var enum2str = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an enumeration constant', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + -9999999, + -999999999, + -99999999999 + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/README.md new file mode 100644 index 000000000000..12b931992408 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/README.md @@ -0,0 +1,124 @@ + + +# resolve + +> Return the enumeration constant associated with a supported SGD loss function value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' ); +``` + +#### resolve( value ) + +Returns the enumeration constant associated with a supported SGD loss function value. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); + +var v = resolve( 'epsilon-insensitive' ); +// returns + +v = resolve( str2enum( 'hinge' ) ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' ); + +var v = resolve( 'epsilon-insensitive' ); +// returns + +v = resolve( 'hinge' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/benchmark/benchmark.js new file mode 100644 index 000000000000..3ff8ea81efa0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/benchmark/benchmark.js @@ -0,0 +1,95 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'epsilon-insensitive' ), + str2enum( 'hinge' ), + str2enum( 'huber' ), + str2enum( 'log' ), + str2enum( 'modified-huber' ), + str2enum( 'perceptron' ), + str2enum( 'squared-epsilon-insensitive' ), + str2enum( 'squared-error' ), + str2enum( 'squared-hinge' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt new file mode 100644 index 000000000000..8b3e588d247d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt @@ -0,0 +1,31 @@ + +{{alias}}( value ) + Returns the enumeration constant associated with a supported SGD loss + function value. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be + used in an opaque manner. + + Parameters + ---------- + value: any + Loss function value. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'epsilon-insensitive' ) + + > out = {{alias}}( + ... {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( + ... 'epsilon-insensitive' ) ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/index.d.ts new file mode 100644 index 000000000000..1531f2b58a4f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with a supported SGD loss function value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. +* +* @param value - loss function value +* @returns enumeration constant +* +* @example +* var v = resolve( 'epsilon-insensitive' ); +* // returns +*/ +declare function resolve( value: any ): number | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/test.ts new file mode 100644 index 000000000000..eab6893aab19 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + resolve( 0 ); // $ExpectType number | null + resolve( 'epsilon-insensitive' ); // $ExpectType number | null +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/examples/index.js new file mode 100644 index 000000000000..0d237af217d2 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var resolve = require( './../lib' ); + +var v = resolve( 'epsilon-insensitive' ); +console.log( v ); +// => + +v = resolve( 'hinge' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/index.js new file mode 100644 index 000000000000..7cc088f69b3d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with a supported SGD loss function value. +* +* @module @stdlib/ml/base/sgd/loss-function-resolve-enum +* +* @example +* var resolve = require( '@stdlib/ml/base/sgd/loss-function-resolve-enum' ); +* +* var v = resolve( 'epsilon-insensitive' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/main.js new file mode 100644 index 000000000000..bf941935c82c --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/sgd/loss-function-enum2str' ); +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); + + +// MAIN // + +/** +* Returns the enumeration constant associated with a supported SGD loss function value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. +* +* @param {*} value - loss function value +* @returns {(integer|null)} enumeration constant or null +* +* @example +* var v = resolve( 'epsilon-insensitive' ); +* // returns +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'number' ) { + return ( enum2str( value ) ) ? value : null; + } + if ( t === 'string' ) { + return str2enum( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/package.json new file mode 100644 index 000000000000..01d4aefc29a1 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/loss-function-resolve-enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with a supported SGD loss function value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "loss function", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/test/test.js new file mode 100644 index 000000000000..bf1034339cf7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/test/test.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with an SGD loss function value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); + t.strictEqual( resolve( v ), v, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/README.md new file mode 100644 index 000000000000..642ce9b6e183 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/README.md @@ -0,0 +1,121 @@ + + +# resolve + +> Return the loss function string associated with a supported SGD loss function value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/loss-function-resolve-str' ); +``` + +#### resolve( value ) + +Returns the loss function string associated with a supported SGD loss function value. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); + +var v = resolve( 'hinge' ); +// returns 'hinge' + +v = resolve( str2enum( 'hinge' ) ); +// returns 'hinge' +``` + +If unable to resolve an SGD loss function string, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var resolve = require( '@stdlib/ml/base/sgd/loss-function-resolve-str' ); + +var v = resolve( str2enum( 'hinge' ) ); +// returns 'hinge' + +v = resolve( str2enum( 'epsilon-insensitive' ) ); +// returns 'epsilon-insensitive' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/benchmark/benchmark.js new file mode 100644 index 000000000000..bdcd9cfa1556 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/benchmark/benchmark.js @@ -0,0 +1,95 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'epsilon-insensitive' ), + str2enum( 'hinge' ), + str2enum( 'huber' ), + str2enum( 'log' ), + str2enum( 'modified-huber' ), + str2enum( 'perceptron' ), + str2enum( 'squared-epsilon-insensitive' ), + str2enum( 'squared-error' ), + str2enum( 'squared-hinge' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt new file mode 100644 index 000000000000..d779dc625997 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Returns the loss function string associated with a supported SGD loss + function value. + + Parameters + ---------- + value: any + Loss function value. + + Returns + ------- + out: string|null + Loss function string. + + Examples + -------- + > var out = {{alias}}( 'hinge' ) + 'hinge' + > out = {{alias}}( {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( + ... 'hinge' ) ) + 'hinge' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/index.d.ts new file mode 100644 index 000000000000..0129537036b7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/index.d.ts @@ -0,0 +1,38 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the loss function string associated with a supported SGD loss function value. +* +* @param value - loss function value +* @returns loss function string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* +* var v = resolve( str2enum( 'hinge' ) ); +* // returns 'hinge' +*/ +declare function resolve( value: any ): string | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/test.ts new file mode 100644 index 000000000000..524dc352b685 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + resolve( 0 ); // $ExpectType string | null + resolve( 'hinge' ); // $ExpectType string | null +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/examples/index.js new file mode 100644 index 000000000000..3b9f6f5ff5e4 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var resolve = require( './../lib' ); + +var v = resolve( str2enum( 'hinge' ) ); +console.log( v ); +// => 'hinge' + +v = resolve( str2enum( 'epsilon-insensitive' ) ); +console.log( v ); +// => 'epsilon-insensitive' diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/index.js new file mode 100644 index 000000000000..6071713bfe72 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the loss function string associated with a supported SGD loss function value. +* +* @module @stdlib/ml/base/sgd/loss-function-resolve-str +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* var resolve = require( '@stdlib/ml/base/sgd/loss-function-resolve-str' ); +* +* var v = resolve( str2enum( 'hinge' ) ); +* // returns 'hinge' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/main.js new file mode 100644 index 000000000000..b7d7fc525128 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/sgd/loss-function-enum2str' ); +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); + + +// MAIN // + +/** +* Returns the loss function string associated with a supported SGD loss function value. +* +* @param {*} value - loss function value +* @returns {(string|null)} loss function string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* +* var v = resolve( str2enum( 'hinge' ) ); +* // returns 'hinge' +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'string' ) { + return ( str2enum( value ) === null ) ? null : value; + } + if ( t === 'number' ) { + return enum2str( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/package.json new file mode 100644 index 000000000000..e9dda477bb2d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/loss-function-resolve-str", + "version": "0.0.0", + "description": "Return the loss function string associated with a supported SGD loss function value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "loss function", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/test/test.js new file mode 100644 index 000000000000..bedc14cc8cca --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/test/test.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an SGD loss function value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); + t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/README.md new file mode 100644 index 000000000000..11264a16214f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/README.md @@ -0,0 +1,119 @@ + + +# str2enum + +> Return the enumeration constant associated with an SGD loss function string. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +``` + +#### str2enum( lossFunction ) + +Returns the enumeration constant associated with an SGD loss function string. + +```javascript +var v = str2enum( 'hinge' ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = str2enum( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); + +var v = str2enum( 'hinge' ); +// returns + +v = str2enum( 'epsilon-insensitive' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/benchmark/benchmark.js new file mode 100644 index 000000000000..250a871eefda --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/benchmark/benchmark.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var str2enum = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = str2enum( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/repl.txt new file mode 100644 index 000000000000..b97ee8c0a486 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/repl.txt @@ -0,0 +1,27 @@ + +{{alias}}( lossFunction ) + Returns the enumeration constant associated with an SGD loss function + string. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be + used in an opaque manner. + + Parameters + ---------- + lossFunction: string + Loss function. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'hinge' ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/index.d.ts new file mode 100644 index 000000000000..a51a1af832a0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with an SGD loss function string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. +* +* @param lossFunction - loss function string +* @returns enumeration constant +* +* @example +* var v = str2enum( 'hinge' ); +* // returns +*/ +declare function str2enum( lossFunction: string ): number | null; + + +// EXPORTS // + +export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/test.ts new file mode 100644 index 000000000000..250ae7ed37c1 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import str2enum = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + str2enum( 'hinge' ); // $ExpectType number | null +} + +// The compiler throws an error if not provided a string... +{ + str2enum( 10 ); // $ExpectError + str2enum( true ); // $ExpectError + str2enum( false ); // $ExpectError + str2enum( null ); // $ExpectError + str2enum( undefined ); // $ExpectError + str2enum( [] ); // $ExpectError + str2enum( {} ); // $ExpectError + str2enum( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/examples/index.js new file mode 100644 index 000000000000..8c89d599d7d0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( './../lib' ); + +var v = str2enum( 'hinge' ); +console.log( v ); +// => + +v = str2enum( 'epsilon-insensitive' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/index.js new file mode 100644 index 000000000000..1ce21e226de1 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with an SGD loss function string. +* +* @module @stdlib/ml/base/sgd/loss-function-str2enum +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/loss-function-str2enum' ); +* +* var v = str2enum( 'hinge' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/main.js new file mode 100644 index 000000000000..3c2b5ece41e3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var enumeration = require( '@stdlib/ml/base/sgd/loss-functions' ).enum; + + +// VARIABLES // + +var ENUM = enumeration(); + + +// MAIN // + +/** +* Returns the enumeration constant associated with an SGD loss function string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `EPSILON_INSENSITIVE == 0`). Instead, the function should be used in an opaque manner. +* +* @param {string} lossFunction - loss function string +* @returns {(integer|null)} integer value or null +* +* @example +* var v = str2enum( 'hinge' ); +* // returns +*/ +function str2enum( lossFunction ) { + var v = ENUM[ lossFunction ]; + return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/package.json new file mode 100644 index 000000000000..2dbbc9c8fb9f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/loss-function-str2enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with an SGD loss function 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", + "loss function", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/test/test.js new file mode 100644 index 000000000000..7d4ecdc60cc3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-str2enum/test/test.js @@ -0,0 +1,73 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var enum2str = require( '@stdlib/ml/base/sgd/loss-function-enum2str' ); +var str2enum = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with a string', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar' + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/README.md b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/README.md new file mode 100644 index 000000000000..23c8b6647aac --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/README.md @@ -0,0 +1,200 @@ + + +# Loss functions + +> SGD loss functions. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var lossFunctions = require( '@stdlib/ml/base/sgd/loss-functions' ); +``` + +#### lossFunctions() + +Returns a list of SGD loss functions. + +```javascript +var out = lossFunctions(); +// e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] +``` + +The output array contains the following loss functions: + +- `epsilon-insensitive`: penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise. +- `hinge`: hinge loss function. Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data. +- `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. +- `log`: logistic loss function. Corresponds to Logistic Regression. +- `modified-huber`: Huber loss function variant for classification. +- `perceptron`: hinge loss function without a margin. Corresponds to the original perceptron by Rosenblatt (1957). +- `squared-epsilon-insensitive`: squared epsilon insensitive loss function. +- `squared-error`: squared error loss (i.e., the squared difference of the observed and fitted values). +- `squared-hinge`: squared hinge loss function SVM (L2-SVM). + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var lossFunction = require( '@stdlib/ml/base/sgd/loss-functions' ); + +var isLossFunction = contains( lossFunction() ); + +var bool = isLossFunction( 'hinge' ); +// returns true + +bool = isLossFunction( 'log' ); +// returns true + +bool = isLossFunction( 'beep' ); +// returns false +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/ml/base/sgd/loss_functions.h" +``` + +#### STDLIB_ML_SGD_LOSS_FUNCTION + +An enumeration of SGD loss functions with the following fields: + +- **STDLIB_ML_SGD_EPSILON_INSENSITIVE**: penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise. +- **STDLIB_ML_SGD_HINGE**: corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data. +- **STDLIB_ML_SGD_HUBER**: squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise. +- **STDLIB_ML_SGD_LOG**: corresponds to Logistic Regression. +- **STDLIB_ML_SGD_MODIFIED_HUBER**: Huber loss function variant for classification. +- **STDLIB_ML_SGD_PERCEPTRON**: corresponds to the original perceptron by Rosenblatt (1957). +- **STDLIB_ML_SGD_SQUARED_EPSILON_INSENSITIVE**: squared epsilon insensitive loss function. +- **STDLIB_ML_SGD_SQUARED_ERROR**: squared difference of the observed and fitted values. +- **STDLIB_ML_SGD_SQUARED_HINGE**: squared hinge loss function SVM (L2-SVM). + +```c +#include "stdlib/ml/base/sgd/loss_functions.h" + +const enum STDLIB_ML_SGD_LOSS_FUNCTION v = STDLIB_ML_SGD_HINGE; +``` + +
+ + + + + +
+ +### Notes + +- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. + +
+ + + + + +
+ +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/benchmark/benchmark.js new file mode 100644 index 000000000000..fc9b818bd1cd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var lossFunctions = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = lossFunctions(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/repl.txt new file mode 100644 index 000000000000..6ccf305a4390 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/repl.txt @@ -0,0 +1,35 @@ + +{{alias}}() + Returns a list of SGD loss functions. + + The output array contains the following loss functions: + + - epsilon-insensitive: penalty is the absolute value of the error whenever + the absolute error exceeds epsilon and zero otherwise. + - hinge: hinge loss function. Corresponds to a soft-margin linear Support + Vector Machine (SVM), which can handle non-linearly separable data. + - 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. + - log: logistic loss function. Corresponds to Logistic Regression. + - modified-huber: Huber loss function variant for classification. + - perceptron: hinge loss function without a margin. Corresponds to the + original perceptron by Rosenblatt (1957). + - squared-epsilon-insensitive: squared epsilon insensitive loss function. + - squared-error: squared error loss (i.e., the squared difference of the + observed and fitted values). + - squared-hinge: squared hinge loss function SVM (L2-SVM). + + Returns + ------- + out: Array + List of loss functions. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/index.d.ts new file mode 100644 index 000000000000..db530dc2cd67 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of SGD loss functions. +* +* @returns list of loss functions +* +* @example +* var list = lossFunctions(); +* // e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] +*/ +declare function lossFunctions(): Array; + + +// EXPORTS // + +export = lossFunctions; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/test.ts new file mode 100644 index 000000000000..6c51642dacaa --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import lossFunctions = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + lossFunctions(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + lossFunctions( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/examples/index.js new file mode 100644 index 000000000000..1fa9e2f61bbf --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var lossFunctions = require( './../lib' ); + +var isLossFunction = contains( lossFunctions() ); + +var bool = isLossFunction( 'hinge' ); +console.log( bool ); +// => true + +bool = isLossFunction( 'log' ); +console.log( bool ); +// => true + +bool = isLossFunction( 'beep' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/include/stdlib/ml/base/sgd/loss_functions.h b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/include/stdlib/ml/base/sgd/loss_functions.h new file mode 100644 index 000000000000..6bb5d177c6e8 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/include/stdlib/ml/base/sgd/loss_functions.h @@ -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. +*/ + +#ifndef STDLIB_ML_BASE_SGD_LOSS_FUNCTIONS_H +#define STDLIB_ML_BASE_SGD_LOSS_FUNCTIONS_H + +/** +* Enumeration of SGD loss functions. +*/ +enum STDLIB_ML_SGD_LOSS_FUNCTION { + // Penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise: + STDLIB_ML_SGD_EPSILON_INSENSITIVE = 0, + + // Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data: + STDLIB_ML_SGD_HINGE, + + // Squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise: + STDLIB_ML_SGD_HUBER, + + // Corresponds to Logistic Regression: + STDLIB_ML_SGD_LOG, + + // Huber loss function variant for classification: + STDLIB_ML_SGD_MODIFIED_HUBER, + + // Corresponds to the original perceptron by Rosenblatt (1957): + STDLIB_ML_SGD_PERCEPTRON, + + // Squared epsilon insensitive loss function: + STDLIB_ML_SGD_SQUARED_EPSILON_INSENSITIVE, + + // Squared difference of the observed and fitted values: + STDLIB_ML_SGD_SQUARED_ERROR, + + // Squared hinge loss function SVM (L2-SVM): + STDLIB_ML_SGD_SQUARED_HINGE +}; + +#endif // !STDLIB_ML_BASE_SGD_LOSS_FUNCTIONS_H diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/data.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/data.json new file mode 100644 index 000000000000..7398567751ce --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/data.json @@ -0,0 +1,11 @@ +[ + "epsilon-insensitive", + "hinge", + "huber", + "log", + "modified-huber", + "perceptron", + "squared-epsilon-insensitive", + "squared-error", + "squared-hinge" +] diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/enum.js new file mode 100644 index 000000000000..c1171c01f482 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/enum.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns an object mapping supported loss functions to integer values for purposes of C inter-operation. +* +* ## Notes +* +* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `HINGE == 0`). Instead, the object should be used in an opaque manner. +* - The main purpose of this function is JavaScript and C inter-operation. +* +* @returns {Object} object mapping supported loss functions to integer values +* +* @example +* var table = enumerated(); +* // returns +*/ +function enumerated() { + // NOTE: the following should match the C `loss_functions.h` enumeration!!!! + return { + // Penalty is the absolute value of the error whenever the absolute error exceeds epsilon and zero otherwise: + 'epsilon-insensitive': 0, + + // Corresponds to a soft-margin linear Support Vector Machine (SVM), which can handle non-linearly separable data: + 'hinge': 1, + + // Squared-error loss for observations with error smaller than epsilon in magnitude, linear loss otherwise: + 'huber': 2, + + // Corresponds to Logistic Regression: + 'log': 3, + + // Huber loss function variant for classification: + 'modified-huber': 4, + + // Corresponds to the original perceptron by Rosenblatt (1957): + 'perceptron': 5, + + // Squared epsilon insensitive loss function: + 'squared-epsilon-insensitive': 6, + + // Squared difference of the observed and fitted values: + 'squared-error': 7, + + // Squared hinge loss function SVM (L2-SVM): + 'squared-hinge': 8 + }; +} + + +// EXPORTS // + +module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/index.js new file mode 100644 index 000000000000..06fd7d316709 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of SGD loss functions. +* +* @module @stdlib/ml/base/sgd/loss-functions +* +* @example +* var lossFunctions = require( '@stdlib/ml/base/sgd/loss-functions' ); +* +* var list = lossFunctions(); +* // e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var enumeration = require( './enum.js' ); + + +// MAIN // + +setReadOnly( main, 'enum', enumeration ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/main.js new file mode 100644 index 000000000000..13d8cfacc3a0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of SGD loss functions. +* +* @returns {Array} list of loss functions +* +* @example +* var list = lossFunctions(); +* // e.g., returns [ 'epsilon-insensitive', 'hinge', 'huber', 'log', 'modified-huber', 'perceptron', 'squared-epsilon-insensitive', 'squared-error', 'squared-hinge' ] +*/ +function lossFunctions() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = lossFunctions; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/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/loss-functions/package.json b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/package.json new file mode 100644 index 000000000000..0d5f56da7da8 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/ml/base/sgd/loss-functions", + "version": "0.0.0", + "description": "SGD loss functions.", + "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", + "loss functions", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/test/test.js new file mode 100644 index 000000000000..d198e0c92a70 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-functions/test/test.js @@ -0,0 +1,87 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var lossFunctions = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof lossFunctions, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of SGD loss functions', function test( t ) { + var expected; + var actual; + + expected = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' + ]; + actual = lossFunctions(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main function is an `enum` method to return an object mapping loss functions to integer values for C inter-operation', function test( t ) { + var obj; + var o; + var i; + + t.strictEqual( hasOwnProp( lossFunctions, 'enum' ), true, 'has property' ); + t.strictEqual( typeof lossFunctions.enum, 'function', 'has method' ); + + obj = lossFunctions.enum(); + t.strictEqual( typeof obj, 'object', 'returns expected value' ); + + // List of values which should be supported... + o = [ + 'epsilon-insensitive', + 'hinge', + 'huber', + 'log', + 'modified-huber', + 'perceptron', + 'squared-epsilon-insensitive', + 'squared-error', + 'squared-hinge' + ]; + for ( i = 0; i < o.length; i++ ) { + t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); + t.strictEqual( isNonNegativeInteger( obj[ o[ i ] ] ), true, 'returns expected value' ); + } + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/README.md b/lib/node_modules/@stdlib/ml/base/sgd/penalties/README.md new file mode 100644 index 000000000000..9ce1f424153d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/README.md @@ -0,0 +1,190 @@ + + +# Penalties + +> SGD penalties. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var penalties = require( '@stdlib/ml/base/sgd/penalties' ); +``` + +#### penalties() + +Returns a list of SGD penalties. + +```javascript +var out = penalties(); +// e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] +``` + +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. + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var penalties = require( '@stdlib/ml/base/sgd/penalties' ); + +var isPenalty = contains( penalties() ); + +var bool = isPenalty( 'l1' ); +// returns true + +bool = isPenalty( 'l2' ); +// returns true + +bool = isPenalty( 'beep' ); +// returns false +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/ml/base/sgd/penalties.h" +``` + +#### STDLIB_ML_SGD_PENALTY + +An enumeration of SGD penalties with the following fields: + +- **STDLIB_ML_SGD_ELASTICNET**: regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods. +- **STDLIB_ML_SGD_L1**: L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients. +- **STDLIB_ML_SGD_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_NONE**: no regularization. + +```c +#include "stdlib/ml/base/sgd/penalties.h" + +const enum STDLIB_ML_SGD_PENALTY v = STDLIB_ML_SGD_ELASTICNET; +``` + +
+ + + + + +
+ +### Notes + +- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. + +
+ + + + + +
+ +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/penalties/benchmark/benchmark.js new file mode 100644 index 000000000000..a279d0987452 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var penalties = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = penalties(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/repl.txt new file mode 100644 index 000000000000..d1956a947c8f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}() + Returns a list of SGD penalties. + + 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. + + Returns + ------- + out: Array + List of penalties. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/index.d.ts new file mode 100644 index 000000000000..0adb8b371eab --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of SGD penalties. +* +* @returns list of penalties +* +* @example +* var list = penalties(); +* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] +*/ +declare function penalties(): Array; + + +// EXPORTS // + +export = penalties; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/test.ts new file mode 100644 index 000000000000..c536e7fc758d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import penalties = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + penalties(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + penalties( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalties/examples/index.js new file mode 100644 index 000000000000..5d65a24f81e0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var penalties = require( './../lib' ); + +var isPenalty = contains( penalties() ); + +var bool = isPenalty( 'elasticnet' ); +console.log( bool ); +// => true + +bool = isPenalty( 'l1' ); +console.log( bool ); +// => true + +bool = isPenalty( 'beep' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/include/stdlib/ml/base/sgd/penalties.h b/lib/node_modules/@stdlib/ml/base/sgd/penalties/include/stdlib/ml/base/sgd/penalties.h new file mode 100644 index 000000000000..f8cba841211f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/include/stdlib/ml/base/sgd/penalties.h @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_ML_BASE_SGD_PENALTIES_H +#define STDLIB_ML_BASE_SGD_PENALTIES_H + +/** +* Enumeration of SGD penalties. +*/ +enum STDLIB_ML_SGD_PENALTY { + // Regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods: + STDLIB_ML_SGD_ELASTICNET = 0, + + // L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients: + STDLIB_ML_SGD_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_L2, + + // No regularization: + STDLIB_ML_SGD_NONE +}; + +#endif // !STDLIB_ML_BASE_SGD_PENALTIES_H diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/data.json b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/data.json new file mode 100644 index 000000000000..71d176852af9 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/data.json @@ -0,0 +1,6 @@ +[ + "elasticnet", + "l1", + "l2", + "none" +] diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/enum.js b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/enum.js new file mode 100644 index 000000000000..834628e0894a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/enum.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns an object mapping supported penalties to integer values for purposes of C inter-operation. +* +* ## Notes +* +* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the object should be used in an opaque manner. +* - The main purpose of this function is JavaScript and C inter-operation. +* +* @returns {Object} object mapping supported penalties to integer values +* +* @example +* var table = enumerated(); +* // returns +*/ +function enumerated() { + // NOTE: the following should match the C `penalties.h` enumeration!!!! + return { + // Regularization method that linearly combines the L1 and L2 penalties of the lasso and ridge methods: + 'elasticnet': 0, + + // L1 regularization (also called LASSO) leads to sparse models by adding a penalty based on the absolute value of coefficients: + '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, + + // No regularization: + 'none': 3 + }; +} + + +// EXPORTS // + +module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/index.js new file mode 100644 index 000000000000..45f803267f6d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of SGD penalties. +* +* @module @stdlib/ml/base/sgd/penalties +* +* @example +* var penalties = require( '@stdlib/ml/base/sgd/penalties' ); +* +* var list = penalties(); +* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var enumeration = require( './enum.js' ); + + +// MAIN // + +setReadOnly( main, 'enum', enumeration ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/main.js new file mode 100644 index 000000000000..6ce92eec3c15 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of SGD penalties. +* +* @returns {Array} list of penalties +* +* @example +* var list = penalties(); +* // e.g., returns [ 'elasticnet', 'l1', 'l2', 'none' ] +*/ +function penalties() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = penalties; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/manifest.json b/lib/node_modules/@stdlib/ml/base/sgd/penalties/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/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/penalties/package.json b/lib/node_modules/@stdlib/ml/base/sgd/penalties/package.json new file mode 100644 index 000000000000..d393574d3c19 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/ml/base/sgd/penalties", + "version": "0.0.0", + "description": "SGD penalties.", + "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", + "penalties", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalties/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/penalties/test/test.js new file mode 100644 index 000000000000..3607086d93f7 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalties/test/test.js @@ -0,0 +1,77 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var penalties = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof penalties, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of SGD penalties', function test( t ) { + var expected; + var actual; + + expected = [ + 'elasticnet', + 'l1', + 'l2', + 'none' + ]; + actual = penalties(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main function is an `enum` method to return an object mapping penalties to integer values for C inter-operation', function test( t ) { + var obj; + var o; + var i; + + t.strictEqual( hasOwnProp( penalties, 'enum' ), true, 'has property' ); + t.strictEqual( typeof penalties.enum, 'function', 'has method' ); + + obj = penalties.enum(); + t.strictEqual( typeof obj, 'object', 'returns expected value' ); + + // List of values which should be supported... + o = [ + 'elasticnet', + 'l1', + 'l2', + 'none' + ]; + for ( i = 0; i < o.length; i++ ) { + t.strictEqual( hasOwnProp( obj, o[ i ] ), true, 'has property `' + o[ i ] + '`' ); + t.strictEqual( isNonNegativeInteger( obj[ o[ i ] ] ), true, 'returns expected value' ); + } + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/README.md b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/README.md new file mode 100644 index 000000000000..a3118b0e8a04 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/README.md @@ -0,0 +1,121 @@ + + +# enum2str + +> Return the SGD penalty string associated with an SGD penalty enumeration constant. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var enum2str = require( '@stdlib/ml/base/sgd/penalty-enum2str' ); +``` + +#### enum2str( value ) + +Returns the SGD penalty string associated with an SGD penalty enumeration constant. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); + +var v = str2enum( 'elasticnet' ); +// returns + +var s = enum2str( v ); +// returns 'elasticnet' +``` + +If unable to resolve an SGD penalty string, the function returns `null`. + +```javascript +var v = enum2str( -999999999 ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var enum2str = require( '@stdlib/ml/base/sgd/penalty-enum2str' ); + +var str = enum2str( str2enum( 'elasticnet' ) ); +// returns 'elasticnet' + +str = enum2str( str2enum( 'l1' ) ); +// returns 'l1' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/benchmark/benchmark.js new file mode 100644 index 000000000000..797e64abd52d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/benchmark/benchmark.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var pkg = require( './../package.json' ).name; +var enum2str = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'elasticnet' ), + str2enum( 'l1' ), + str2enum( 'l2' ), + str2enum( 'none' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = enum2str( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/repl.txt new file mode 100644 index 000000000000..6df9c9be91ac --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( value ) + Returns the SGD penalty string associated with an SGD penalty enumeration + constant. + + Parameters + ---------- + value: integer + Penalty enumeration constant. + + Returns + ------- + out: string|null + Penalty string. + + Examples + -------- + > var v = 'elasticnet'; + > v = {{alias:@stdlib/ml/base/sgd/penalty-str2enum}}( v ); + > var out = {{alias}}( v ) + 'elasticnet' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/index.d.ts new file mode 100644 index 000000000000..7137a499dabd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/index.d.ts @@ -0,0 +1,41 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the SGD penalty string associated with an SGD penalty enumeration constant. +* +* @param value - enumeration constant +* @returns penalty string +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* +* var v = str2enum( 'elasticnet' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'elasticnet' +*/ +declare function enum2str( value: number ): string | null; + + +// EXPORTS // + +export = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/test.ts new file mode 100644 index 000000000000..fe80992105ef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import enum2str = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + enum2str( 0 ); // $ExpectType string | null +} + +// The compiler throws an error if not provided a number... +{ + enum2str( '10' ); // $ExpectError + enum2str( true ); // $ExpectError + enum2str( false ); // $ExpectError + enum2str( null ); // $ExpectError + enum2str( undefined ); // $ExpectError + enum2str( [] ); // $ExpectError + enum2str( {} ); // $ExpectError + enum2str( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/examples/index.js new file mode 100644 index 000000000000..b7c9a2f589d0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var enum2str = require( './../lib' ); + +var str = enum2str( str2enum( 'l1' ) ); +console.log( str ); +// => 'l1' + +str = enum2str( str2enum( 'elasticnet' ) ); +console.log( str ); +// => 'elasticnet' diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/index.js new file mode 100644 index 000000000000..7436b8f2cbef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the SGD penalty string associated with an SGD penalty enumeration constant. +* +* @module @stdlib/ml/base/sgd/penalty-enum2str +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* var enum2str = require( '@stdlib/ml/base/sgd/penalty-enum2str' ); +* +* var v = str2enum( 'elasticnet' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'elasticnet' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/main.js new file mode 100644 index 000000000000..69e12146c0a3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var objectInverse = require( '@stdlib/object/inverse' ); +var enumeration = require( '@stdlib/ml/base/sgd/penalties' ).enum; + + +// VARIABLES // + +var hash = objectInverse( enumeration(), { + 'duplicates': false +}); + + +// MAIN // + +/** +* Returns the SGD penalty string associated with an SGD penalty enumeration constant. +* +* @param {integer} value - penalty enumeration constant +* @returns {(string|null)} penalty string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* +* var v = str2enum( 'elasticnet' ); +* // returns +* +* var s = enum2str( v ); +* // returns 'elasticnet' +*/ +function enum2str( value ) { + var v = hash[ value ]; + return ( isString( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = enum2str; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/package.json b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/package.json new file mode 100644 index 000000000000..8452c7b944fe --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/penalty-enum2str", + "version": "0.0.0", + "description": "Return the SGD penalty string associated with an SGD penalty enumeration constant.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "penalty", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/test/test.js new file mode 100644 index 000000000000..cd68afd128d2 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-enum2str/test/test.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var enum2str = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'elasticnet', + 'l1', + 'l2', + 'none' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof enum2str, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an enumeration constant', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + -9999999, + -999999999, + -99999999999 + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( enum2str( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/README.md new file mode 100644 index 000000000000..bbca9e0eb871 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/README.md @@ -0,0 +1,124 @@ + + +# resolve + +> Return the enumeration constant associated with a supported SGD penalty value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' ); +``` + +#### resolve( value ) + +Returns the enumeration constant associated with a supported SGD penalty value. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); + +var v = resolve( 'elasticnet' ); +// returns + +v = resolve( str2enum( 'l1' ) ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' ); + +var v = resolve( 'elasticnet' ); +// returns + +v = resolve( 'l1' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/benchmark/benchmark.js new file mode 100644 index 000000000000..30a8def772f0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/benchmark/benchmark.js @@ -0,0 +1,83 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'elasticnet', + 'l1', + 'l2' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'elasticnet' ), + str2enum( 'l1' ), + str2enum( 'l2' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/repl.txt new file mode 100644 index 000000000000..5971f05120d1 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/repl.txt @@ -0,0 +1,31 @@ + +{{alias}}( value ) + Returns the enumeration constant associated with a supported SGD penalty + value. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an + opaque manner. + + Parameters + ---------- + value: any + Penalty value. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var s = 'elasticnet'; + > var v = {{alias}}( s ) + + > v = {{alias:@stdlib/ml/base/sgd/penalty-str2enum}}( s ); + > {{alias}}( v ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/index.d.ts new file mode 100644 index 000000000000..8393347fec1f --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with a supported SGD penalty value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. +* +* @param value - penalty value +* @returns enumeration constant +* +* @example +* var v = resolve( 'elasticnet' ); +* // returns +*/ +declare function resolve( value: any ): number | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/test.ts new file mode 100644 index 000000000000..b585b2f1305d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + resolve( 0 ); // $ExpectType number | null + resolve( 'elasticnet' ); // $ExpectType number | null +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/examples/index.js new file mode 100644 index 000000000000..4d3c6047ef88 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var resolve = require( './../lib' ); + +var v = resolve( 'elasticnet' ); +console.log( v ); +// => + +v = resolve( 'l1' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/index.js new file mode 100644 index 000000000000..7b4717971240 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with a supported SGD penalty value. +* +* @module @stdlib/ml/base/sgd/penalty-resolve-enum +* +* @example +* var resolve = require( '@stdlib/ml/base/sgd/penalty-resolve-enum' ); +* +* var v = resolve( 'elasticnet' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/main.js new file mode 100644 index 000000000000..af0ed35a8b96 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/sgd/penalty-enum2str' ); +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); + + +// MAIN // + +/** +* Returns the enumeration constant associated with a supported SGD penalty value. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. +* +* @param {*} value - penalty value +* @returns {(integer|null)} enumeration constant or null +* +* @example +* var v = resolve( 'elasticnet' ); +* // returns +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'number' ) { + return ( enum2str( value ) ) ? value : null; + } + if ( t === 'string' ) { + return str2enum( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/package.json new file mode 100644 index 000000000000..0eab0ad07ba9 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/penalty-resolve-enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with a supported SGD penalty value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "penalty", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/test/test.js new file mode 100644 index 000000000000..4656e1415cc3 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-enum/test/test.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'elasticnet', + 'l1', + 'l2' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with an SGD penalty value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), v, 'returns expected value' ); + t.strictEqual( resolve( v ), v, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/README.md b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/README.md new file mode 100644 index 000000000000..fcd3522096e4 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/README.md @@ -0,0 +1,121 @@ + + +# resolve + +> Return the penalty string associated with a supported SGD penalty value. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var resolve = require( '@stdlib/ml/base/sgd/penalty-resolve-str' ); +``` + +#### resolve( value ) + +Returns the penalty string associated with a supported SGD penalty value. + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); + +var v = resolve( 'l1' ); +// returns 'l1' + +v = resolve( str2enum( 'l1' ) ); +// returns 'l1' +``` + +If unable to resolve an SGD penalty string, the function returns `null`. + +```javascript +var v = resolve( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var resolve = require( '@stdlib/ml/base/sgd/penalty-resolve-str' ); + +var v = resolve( str2enum( 'l1' ) ); +// returns 'l1' + +v = resolve( str2enum( 'elasticnet' ) ); +// returns 'elasticnet' +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/benchmark/benchmark.js new file mode 100644 index 000000000000..76de1842a447 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/benchmark/benchmark.js @@ -0,0 +1,83 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var resolve = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::string', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'elasticnet', + 'l1', + 'l2' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::integer', pkg ), function benchmark( b ) { + var values; + var out; + var i; + + values = [ + str2enum( 'elasticnet' ), + str2enum( 'l1' ), + str2enum( 'l2' ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = resolve( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/repl.txt new file mode 100644 index 000000000000..cb426567836a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( value ) + Returns the penalty string associated with a supported SGD penalty value. + + Parameters + ---------- + value: any + Penalty value. + + Returns + ------- + out: string|null + Penalty string. + + Examples + -------- + > var v = {{alias}}( 'l1' ) + 'l1' + > v = {{alias:@stdlib/ml/base/sgd/penalty-str2enum}}( 'l1' ); + > out = {{alias}}( v ) + 'l1' + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/index.d.ts new file mode 100644 index 000000000000..c23b7f996dde --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/index.d.ts @@ -0,0 +1,38 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the penalty string associated with a supported SGD penalty value. +* +* @param value - penalty value +* @returns penalty string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* +* var v = resolve( str2enum( 'l1' ) ); +* // returns 'l1' +*/ +declare function resolve( value: any ): string | null; + + +// EXPORTS // + +export = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/test.ts new file mode 100644 index 000000000000..0c5f41116684 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/docs/types/test.ts @@ -0,0 +1,28 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import resolve = require( './index' ); + + +// TESTS // + +// The function returns a string or null... +{ + resolve( 0 ); // $ExpectType string | null + resolve( 'l1' ); // $ExpectType string | null +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/examples/index.js new file mode 100644 index 000000000000..e9f60d9d54e1 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var resolve = require( './../lib' ); + +var v = resolve( str2enum( 'l1' ) ); +console.log( v ); +// => 'l1' + +v = resolve( str2enum( 'elasticnet' ) ); +console.log( v ); +// => 'elasticnet' diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/index.js new file mode 100644 index 000000000000..30e054304f6e --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the penalty string associated with a supported SGD penalty value. +* +* @module @stdlib/ml/base/sgd/penalty-resolve-str +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* var resolve = require( '@stdlib/ml/base/sgd/penalty-resolve-str' ); +* +* var v = resolve( str2enum( 'l1' ) ); +* // returns 'l1' +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/main.js new file mode 100644 index 000000000000..6f1ae8f040ef --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var enum2str = require( '@stdlib/ml/base/sgd/penalty-enum2str' ); +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); + + +// MAIN // + +/** +* Returns the penalty string associated with a supported SGD penalty value. +* +* @param {*} value - penalty value +* @returns {(string|null)} penalty string or null +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* +* var v = resolve( str2enum( 'l1' ) ); +* // returns 'l1' +*/ +function resolve( value ) { + var t = ( typeof value ); + if ( t === 'string' ) { + return ( str2enum( value ) === null ) ? null : value; + } + if ( t === 'number' ) { + return enum2str( value ); + } + return null; +} + + +// EXPORTS // + +module.exports = resolve; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/package.json b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/package.json new file mode 100644 index 000000000000..1dfb81fc8955 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/penalty-resolve-str", + "version": "0.0.0", + "description": "Return the penalty string associated with a supported SGD penalty value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "ml", + "machine", + "learning", + "sgd", + "penalty", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/test/test.js new file mode 100644 index 000000000000..ce85b3064115 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-resolve-str/test/test.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +var resolve = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'elasticnet', + 'l1', + 'l2' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof resolve, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the string associated with an SGD penalty value', function test( t ) { + var v; + var i; + for ( i = 0; i < VALUES.length; i++ ) { + v = str2enum( VALUES[ i ] ); + t.strictEqual( resolve( VALUES[ i ] ), VALUES[ i ], 'returns expected value' ); + t.strictEqual( resolve( v ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve a string', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar', + -99999999, + -9999999999, + -9999999999999, + true, + false + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( resolve( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/README.md b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/README.md new file mode 100644 index 000000000000..0dcdb219aaeb --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/README.md @@ -0,0 +1,119 @@ + + +# str2enum + +> Return the enumeration constant associated with an SGD penalty string. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +``` + +#### str2enum( penalty ) + +Returns the enumeration constant associated with an SGD penalty string. + +```javascript +var v = str2enum( 'l1' ); +// returns +``` + +If unable to resolve an enumeration constant, the function returns `null`. + +```javascript +var v = str2enum( 'beep' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. + +
+ + + + + +
+ +## Examples + + + +```javascript +var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); + +var v = str2enum( 'l1' ); +// returns + +v = str2enum( 'elasticnet' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/benchmark/benchmark.js new file mode 100644 index 000000000000..d85a6826abf0 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/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 isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var str2enum = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'elasticnet', + 'l1', + 'l2', + 'none' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = str2enum( values[ i%values.length ] ); + if ( typeof out !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/repl.txt new file mode 100644 index 000000000000..4910b3d075f2 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( penalty ) + Returns the enumeration constant associated with an SGD penalty string. + + Downstream consumers of this function should *not* rely on specific integer + values (e.g., `ELASTICNET == 0`). Instead, the function should be used in + an opaque manner. + + Parameters + ---------- + penalty: string + Penalty. + + Returns + ------- + out: integer|null + Enumeration constant. + + Examples + -------- + > var out = {{alias}}( 'l1' ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/index.d.ts new file mode 100644 index 000000000000..7517c21d82bd --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/index.d.ts @@ -0,0 +1,40 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the enumeration constant associated with an SGD penalty string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. +* +* @param penalty - penalty string +* @returns enumeration constant +* +* @example +* var v = str2enum( 'l1' ); +* // returns +*/ +declare function str2enum( penalty: string ): number | null; + + +// EXPORTS // + +export = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/test.ts new file mode 100644 index 000000000000..29e7ee6f3a1a --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/docs/types/test.ts @@ -0,0 +1,39 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import str2enum = require( './index' ); + + +// TESTS // + +// The function returns a number or null... +{ + str2enum( 'l1' ); // $ExpectType number | null +} + +// The compiler throws an error if not provided a string... +{ + str2enum( 10 ); // $ExpectError + str2enum( true ); // $ExpectError + str2enum( false ); // $ExpectError + str2enum( null ); // $ExpectError + str2enum( undefined ); // $ExpectError + str2enum( [] ); // $ExpectError + str2enum( {} ); // $ExpectError + str2enum( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/examples/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/examples/index.js new file mode 100644 index 000000000000..faaa6bb8a440 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var str2enum = require( './../lib' ); + +var v = str2enum( 'l1' ); +console.log( v ); +// => + +v = str2enum( 'elasticnet' ); +console.log( v ); +// => diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/index.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/index.js new file mode 100644 index 000000000000..6f8e2b029813 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return the enumeration constant associated with an SGD penalty string. +* +* @module @stdlib/ml/base/sgd/penalty-str2enum +* +* @example +* var str2enum = require( '@stdlib/ml/base/sgd/penalty-str2enum' ); +* +* var v = str2enum( 'l1' ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/main.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/main.js new file mode 100644 index 000000000000..49ebdb809813 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var enumeration = require( '@stdlib/ml/base/sgd/penalties' ).enum; + + +// VARIABLES // + +var ENUM = enumeration(); + + +// MAIN // + +/** +* Returns the enumeration constant associated with an SGD penalty string. +* +* ## Notes +* +* - Downstream consumers of this function should **not** rely on specific integer values (e.g., `ELASTICNET == 0`). Instead, the function should be used in an opaque manner. +* +* @param {string} penalty - penalty string +* @returns {(integer|null)} integer value or null +* +* @example +* var v = str2enum( 'l1' ); +* // returns +*/ +function str2enum( penalty ) { + var v = ENUM[ penalty ]; + return ( isNumber( v ) ) ? v : null; // note: we include this guard to prevent walking the prototype chain +} + + +// EXPORTS // + +module.exports = str2enum; diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/package.json b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/package.json new file mode 100644 index 000000000000..cad4a2a4d8c6 --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ml/base/sgd/penalty-str2enum", + "version": "0.0.0", + "description": "Return the enumeration constant associated with an SGD penalty 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", + "penalty", + "utilities", + "utility", + "utils", + "util", + "enum" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/test/test.js b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/test/test.js new file mode 100644 index 000000000000..49fb0611f66d --- /dev/null +++ b/lib/node_modules/@stdlib/ml/base/sgd/penalty-str2enum/test/test.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var enum2str = require( '@stdlib/ml/base/sgd/penalty-enum2str' ); +var str2enum = require( './../lib' ); + + +// VARIABLES // + +var VALUES = [ + 'elasticnet', + 'l1', + 'l2', + 'none' +]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof str2enum, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns the enumeration constant associated with a string', function test( t ) { + var i; + for ( i = 0; i < VALUES.length; i++ ) { + t.strictEqual( enum2str( str2enum( VALUES[ i ] ) ), VALUES[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `null` if unable to resolve an enumeration constant', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'foo', + 'bar' + ]; + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( str2enum( values[ i ] ), null, 'returns expected value' ); + } + t.end(); +}); From 95194d8bbbcf1e38a8eec503897125dbb789a80f Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 3 Aug 2026 03:00:37 -0700 Subject: [PATCH 3/3] style: reformat examples Co-authored-by: Athan Signed-off-by: Athan --- .../ml/base/sgd/learning-rate-enum2str/docs/repl.txt | 4 ++-- .../ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt | 4 ++-- .../ml/base/sgd/learning-rate-resolve-str/docs/repl.txt | 4 ++-- .../ml/base/sgd/loss-function-enum2str/docs/repl.txt | 6 +++--- .../ml/base/sgd/loss-function-resolve-enum/docs/repl.txt | 6 +++--- .../ml/base/sgd/loss-function-resolve-str/docs/repl.txt | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt index 98a6ccf480fe..800d0d912feb 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-enum2str/docs/repl.txt @@ -15,8 +15,8 @@ Examples -------- - > var out = {{alias}}( - ... {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( 'basic' ) ) + > var v = {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( 'basic' ); + > var out = {{alias}}( v ) 'basic' See Also diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt index 7dedfd9dca49..ab0b0e379ecd 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-enum/docs/repl.txt @@ -21,8 +21,8 @@ -------- > var out = {{alias}}( 'basic' ) - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( - ... 'basic' ) ) + > var v = {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( 'basic' ); + > out = {{alias}}( v ) See Also diff --git a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt index 6350c05bc737..6b71bf6e211c 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd/learning-rate-resolve-str/docs/repl.txt @@ -17,8 +17,8 @@ -------- > var out = {{alias}}( 'constant' ) 'constant' - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( - ... 'constant' ) ) + > var v = {{alias:@stdlib/ml/base/sgd/learning-rate-str2enum}}( 'constant' ); + > out = {{alias}}( v ) 'constant' See Also diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt index 2a18d50b834d..25f4090d7d01 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-enum2str/docs/repl.txt @@ -15,9 +15,9 @@ Examples -------- - > var out = {{alias}}( - ... {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( - ... 'epsilon-insensitive' ) ) + > var str = 'epsilon-insensitive'; + > var v = {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( str ); + > var out = {{alias}}( v ) 'epsilon-insensitive' See Also diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt index 8b3e588d247d..0a44f3962615 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-enum/docs/repl.txt @@ -21,9 +21,9 @@ -------- > var out = {{alias}}( 'epsilon-insensitive' ) - > out = {{alias}}( - ... {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( - ... 'epsilon-insensitive' ) ) + > var str = 'epsilon-insensitive'; + > var v = {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( str ); + > out = {{alias}}( v ) See Also diff --git a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt index d779dc625997..94315d5d2dc7 100644 --- a/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt +++ b/lib/node_modules/@stdlib/ml/base/sgd/loss-function-resolve-str/docs/repl.txt @@ -17,8 +17,8 @@ -------- > var out = {{alias}}( 'hinge' ) 'hinge' - > out = {{alias}}( {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( - ... 'hinge' ) ) + > var v = {{alias:@stdlib/ml/base/sgd/loss-function-str2enum}}( 'hinge' ); + > out = {{alias}}( v ) 'hinge' See Also