Skip to content

Move cheminfo-types to dev dependencies #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"vitest": "^2.1.3"
},
"dependencies": {
"cheminfo-types": "^1.8.0",
"ml-matrix": "^6.12.0",
"ml-regression-base": "^4.0.0"
}
Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { NumberArray } from 'cheminfo-types';
import { createRandomArray, xSum } from 'ml-spectra-processing';
import { expect, it, describe } from 'vitest';

import { PolynomialRegression } from '..';
import { PolynomialRegression, type NumberArray } from '..';

function assertCoefficientsAndPowers(
result: PolynomialRegression,
Expand Down
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import { type NumberArray } from 'cheminfo-types';
import { Matrix, MatrixTransposeView, solve } from 'ml-matrix';
import {
BaseRegression,
checkArrayLength,
maybeToPrecision,
} from 'ml-regression-base';

export type NumberArray =
| number[]
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array;

interface PolynomialRegressionOptions {
interceptAtZero?: boolean;
}
Expand All @@ -13,12 +24,12 @@
degree: number;
powers: number[];
coefficients: number[];
/**

Check warning on line 27 in src/index.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc block description
* @param x - independent or explanatory variable
* @param y - dependent or response variable
* @param degree - degree of the polynomial regression, or array of powers to be used. When degree is an array, intercept at zero is forced to false/ignored.
* @example `new PolynomialRegression(x, y, 2)`, in this case, you can pass the option `interceptAtZero`, if you need it.
* @param options

Check warning on line 32 in src/index.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "options" description
* @example `new PolynomialRegression(x, y, [1, 3, 5])`
* Each of the degrees corresponds to a column, so if you have them switched, just do:
* @example `new PolynomialRegression(x, y, [3, 1, 5])`
Expand Down Expand Up @@ -122,14 +133,14 @@
}
}

/**

Check warning on line 136 in src/index.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @returns declaration
* Perform a polynomial regression on the given data set.
* This is an internal function.
* @param x - independent or explanatory variable
* @param y - dependent or response variable
* @param degree - degree of the polynomial regression
* @param options.interceptAtZero - force the polynomial regression so that $f(0) = 0$

Check warning on line 142 in src/index.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

@param path declaration ("options.interceptAtZero") root node name ("options") does not match previous real parameter name ("degree")
* @param options

Check warning on line 143 in src/index.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "options" description
*/
function regress(
x: NumberArray,
Expand Down