| declare module 'ml-airpls' { | ||
| export interface AirPLSOptions { | ||
| /** | ||
| * @default 100 | ||
| */ | ||
| maxIterations?: number; | ||
| /** | ||
| * @default 100 | ||
| */ | ||
| lambda?: number; | ||
| /** | ||
| * @default 0.001 | ||
| */ | ||
| factorCriterion?: number; | ||
| /** | ||
| * array of number to weight the baseline. by default all point has the same weight. | ||
| */ | ||
| weights?: number[], | ||
| /** | ||
| * array of indexes of points that should have the maximum weight on each iteration. | ||
| * @default [] | ||
| */ | ||
| controlPoints?: number[], | ||
| /** | ||
| * array of indexes of points that should have the maximum weight on each iteration. | ||
| * @default [] | ||
| */ | ||
| baseLineZones?: Array<{from: number, to: number}>, | ||
| } | ||
| export default function airPLS( | ||
| x: number[] | Float64Array, | ||
| y: number[] | Float64Array, | ||
| options?: AirPLSOptions, | ||
| ): { | ||
| corrected: number[] | Float64Array, | ||
| baseline: number[] | Float64Array, | ||
| iteration: number, | ||
| error: number | ||
| }; | ||
| } |
| import { toBeDeepCloseTo } from 'jest-matcher-deep-close-to'; | ||
| import airPLS from '../index'; | ||
| expect.extend({ toBeDeepCloseTo }); | ||
| let y = [1, 1, 1, 1, 3, 6, 3, 1, 1, 1]; | ||
| let x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | ||
| describe('airPLS test', () => { | ||
| it('Small vector to find baseline', () => { | ||
| let result = airPLS(x, y); | ||
| expect(result.baseline).toBeDeepCloseTo([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2); | ||
| expect(result.corrected).toBeDeepCloseTo([0, 0, 0, 0, 2, 5, 2, 0, 0, 0], 2); | ||
| }); | ||
| }); |
+4
-6
@@ -5,6 +5,2 @@ 'use strict'; | ||
| function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
| var cuthillMckee__default = /*#__PURE__*/_interopDefaultLegacy(cuthillMckee); | ||
| // Based on https://github.com/scijs/cholesky-solve | ||
@@ -151,2 +147,3 @@ | ||
| } | ||
| function ldlDsolve( | ||
@@ -162,2 +159,3 @@ n /* D is n-by-n, where n >= 0 */, | ||
| } | ||
| function ldlLTsolve( | ||
@@ -297,3 +295,3 @@ n /* L is n-by-n, where n >= 0 */, | ||
| if (d === n) { | ||
| return function (b) { | ||
| return (b) => { | ||
| ldlPerm(n, bp1, b, P); | ||
@@ -360,3 +358,3 @@ ldlLsolve(n, bp1, Lp, Li, Lx); | ||
| lowerTriangularNonZeros: matrix, | ||
| permutationEncodedArray: cuthillMckee__default['default'](matrix, nbPoints), | ||
| permutationEncodedArray: cuthillMckee(matrix, nbPoints), | ||
| }; | ||
@@ -363,0 +361,0 @@ }; |
+0
-0
@@ -0,0 +0,0 @@ The MIT License (MIT) |
+15
-15
| { | ||
| "name": "ml-airpls", | ||
| "version": "1.0.0", | ||
| "version": "1.0.2", | ||
| "description": "Baseline correction using adaptive iteratively reweighted penalized least", | ||
| "main": "lib/index.js", | ||
| "types": "ml-airpls.d.ts", | ||
| "module": "src/index.js", | ||
| "files": [ | ||
| "lib", | ||
| "src" | ||
| "src", | ||
| "ml-airpls.d.ts" | ||
| ], | ||
@@ -16,5 +18,6 @@ "scripts": { | ||
| "eslint-fix": "npm run eslint -- --fix", | ||
| "test": "npm run test-coverage && npm run eslint", | ||
| "test-coverage": "jest --coverage", | ||
| "test-only": "jest" | ||
| "prettier": "prettier --check src", | ||
| "prettier-write": "prettier --write src", | ||
| "test": "npm run test-only && npm run eslint && npm run prettier", | ||
| "test-only": "jest --coverage" | ||
| }, | ||
@@ -35,13 +38,10 @@ "repository": { | ||
| "homepage": "https://github.com/mljs/airpls#readme", | ||
| "jest": { | ||
| "testEnvironment": "node" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/plugin-transform-modules-commonjs": "^7.13.8", | ||
| "eslint": "^7.22.0", | ||
| "eslint-config-cheminfo": "^5.2.3", | ||
| "jest": "^26.6.3", | ||
| "jest-matcher-deep-close-to": "^2.0.1", | ||
| "prettier": "^2.2.1", | ||
| "rollup": "^2.42.4" | ||
| "@babel/plugin-transform-modules-commonjs": "^7.16.8", | ||
| "eslint": "^8.10.0", | ||
| "eslint-config-cheminfo": "^8.0.2", | ||
| "jest": "^29.5.0", | ||
| "jest-matcher-deep-close-to": "^3.0.2", | ||
| "prettier": "^2.5.1", | ||
| "rollup": "^3.22.0" | ||
| }, | ||
@@ -48,0 +48,0 @@ "dependencies": { |
+0
-6
| # airpls | ||
| [![NPM version][npm-image]][npm-url] | ||
| [![build status][travis-image]][travis-url] | ||
| [![Test coverage][codecov-image]][codecov-url] | ||
| [![David deps][david-image]][david-url] | ||
| [![npm download][download-image]][download-url] | ||
@@ -36,9 +34,5 @@ | ||
| [npm-url]: https://www.npmjs.com/package/ml-airpls | ||
| [travis-image]: https://img.shields.io/travis/mljs/airpls/master.svg?style=flat-square | ||
| [travis-url]: https://travis-ci.org/mljs/airpls | ||
| [codecov-image]: https://img.shields.io/codecov/c/github/mljs/airpls.svg?style=flat-square | ||
| [codecov-url]: https://codecov.io/gh/mljs/airpls | ||
| [david-image]: https://img.shields.io/david/mljs/airpls.svg?style=flat-square | ||
| [david-url]: https://david-dm.org/mljs/airpls | ||
| [download-image]: https://img.shields.io/npm/dm/ml-airpls.svg?style=flat-square | ||
| [download-url]: https://www.npmjs.com/package/ml-airpls |
@@ -142,2 +142,3 @@ // Based on https://github.com/scijs/cholesky-solve | ||
| } | ||
| function ldlDsolve( | ||
@@ -153,2 +154,3 @@ n /* D is n-by-n, where n >= 0 */, | ||
| } | ||
| function ldlLTsolve( | ||
@@ -288,3 +290,3 @@ n /* L is n-by-n, where n >= 0 */, | ||
| if (d === n) { | ||
| return function (b) { | ||
| return (b) => { | ||
| ldlPerm(n, bp1, b, P); | ||
@@ -291,0 +293,0 @@ ldlLsolve(n, bp1, Lp, Li, Lx); |
+3
-5
@@ -1,2 +0,2 @@ | ||
| import Cholesky from './choleskySolver'; | ||
| import cholesky from './choleskySolver'; | ||
| import { updateSystem, getDeltaMatrix, getCloseIndex } from './utils'; | ||
@@ -18,3 +18,3 @@ | ||
| */ | ||
| function airPLS(x, y, options = {}) { | ||
| export default function airPLS(x, y, options = {}) { | ||
| let { | ||
@@ -66,3 +66,3 @@ maxIterations = 100, | ||
| let cho = Cholesky(leftHandSide, nbPoints, permutationEncodedArray); | ||
| let cho = cholesky(leftHandSide, nbPoints, permutationEncodedArray); | ||
@@ -105,3 +105,1 @@ baseline = cho(rightHandSide); | ||
| } | ||
| export { airPLS as default }; |
+0
-0
@@ -0,0 +0,0 @@ import cuthillMckee from 'cuthill-mckee'; |
-11
| ## [1.0.0](https://github.com/mljs/airpls/compare/v0.2.0...v1.0.0) (2021-03-24) | ||
| # [0.2.0](https://github.com/mljs/airpls/compare/v0.0.2...v0.2.0) (2020-02-05) | ||
| <a name="0.0.2"></a> | ||
| ## 0.0.2 (2018-11-03) | ||
| import { toBeDeepCloseTo } from 'jest-matcher-deep-close-to'; | ||
| import airPLS from '../index'; | ||
| expect.extend({ toBeDeepCloseTo }); | ||
| let y = [1, 1, 1, 1, 3, 6, 3, 1, 1, 1]; | ||
| let x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | ||
| describe('airPLS test', () => { | ||
| it('Small vector to find baseline', () => { | ||
| let result = airPLS(x, y); | ||
| expect(result.baseline).toBeDeepCloseTo([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2); | ||
| expect(result.corrected).toBeDeepCloseTo([0, 0, 0, 0, 2, 5, 2, 0, 0, 0], 2); | ||
| }); | ||
| }); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
857
4.38%32585
-2.34%38
-13.64%