ml-regression-base
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -0,1 +1,10 @@ | ||
# [2.1.0](https://github.com/mljs/regression-base/compare/v2.0.1...v2.1.0) (2020-02-04) | ||
### Features | ||
* allow types array ([28adfa8](https://github.com/mljs/regression-base/commit/28adfa86c8c7feb491565e060ee16705991e98cf)) | ||
## [2.0.1](https://github.com/mljs/regression-base/compare/v2.0.0...v2.0.1) (2019-04-30) | ||
@@ -2,0 +11,0 @@ |
@@ -5,2 +5,6 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var isAnyArray = _interopDefault(require('is-any-array')); | ||
function maybeToPrecision(value, digits) { | ||
@@ -24,3 +28,3 @@ if (value < 0) { | ||
function checkArraySize(x, y) { | ||
if (!Array.isArray(x) || !Array.isArray(y)) { | ||
if (!isAnyArray(x) || !isAnyArray(y)) { | ||
throw new TypeError('x and y must be arrays'); | ||
@@ -114,3 +118,3 @@ } | ||
chi2: chi2, | ||
rmsd: Math.sqrt(rmsd / n) | ||
rmsd: Math.sqrt(rmsd / n), | ||
}; | ||
@@ -117,0 +121,0 @@ } |
{ | ||
"name": "ml-regression-base", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Base class for regression modules", | ||
@@ -37,14 +37,19 @@ "main": "lib/index.js", | ||
}, | ||
"dependencies": { | ||
"is-any-array": "0.0.3" | ||
}, | ||
"devDependencies": { | ||
"babel-jest": "^24.7.1", | ||
"@babel/plugin-transform-modules-commonjs": "^7.4.4", | ||
"eslint": "^5.16.0", | ||
"eslint-config-cheminfo": "^1.20.1", | ||
"eslint-plugin-import": "^2.17.2", | ||
"eslint-plugin-jest": "^22.5.1", | ||
"eslint-plugin-no-only-tests": "^2.3.0", | ||
"jest": "^24.7.1", | ||
"rollup": "^1.10.1" | ||
}, | ||
"dependencies": {} | ||
"@babel/plugin-transform-modules-commonjs": "^7.8.3", | ||
"babel-jest": "^25.1.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-cheminfo": "^2.0.4", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-jest": "^23.6.0", | ||
"eslint-plugin-no-only-tests": "^2.4.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"jest": "^25.1.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.31.0" | ||
} | ||
} |
@@ -30,3 +30,3 @@ import maybeToPrecision from '../maybeToPrecision'; | ||
it('wrong digit option', () => { | ||
expect(function () { | ||
expect(function() { | ||
maybeToPrecision(0, 0); | ||
@@ -33,0 +33,0 @@ }).toThrow(/toPrecision\(\) argument must be between 1 and (100|21)/); |
@@ -16,3 +16,3 @@ import BaseRegression from '..'; | ||
it('should not be directly constructable', () => { | ||
expect(function () { | ||
expect(function() { | ||
// eslint-disable-next-line no-new | ||
@@ -25,3 +25,3 @@ new BaseRegression(); | ||
const reg = new NoPredict(); | ||
expect(function () { | ||
expect(function() { | ||
reg.predict(0); | ||
@@ -40,3 +40,3 @@ }).toThrow(/_predict must be implemented/); | ||
const basic = new Basic(2); | ||
expect(function () { | ||
expect(function() { | ||
basic.predict(); | ||
@@ -59,3 +59,3 @@ }).toThrow(/must be a number or array/); | ||
chi2: 0, | ||
rmsd: 0 | ||
rmsd: 0, | ||
}); | ||
@@ -68,5 +68,5 @@ expect(basic.score([1, 2], [2, 4.1]).rmsd).toBe(0.0707106781186545); | ||
chi2: 6.5, | ||
rmsd: 1.7677669529663689 | ||
rmsd: 1.7677669529663689, | ||
}); | ||
}); | ||
}); |
@@ -0,3 +1,5 @@ | ||
import isAnyArray from 'is-any-array'; | ||
export default function checkArraySize(x, y) { | ||
if (!Array.isArray(x) || !Array.isArray(y)) { | ||
if (!isAnyArray(x) || !isAnyArray(y)) { | ||
throw new TypeError('x and y must be arrays'); | ||
@@ -4,0 +6,0 @@ } |
@@ -85,5 +85,5 @@ export { default as maybeToPrecision } from './maybeToPrecision'; | ||
chi2: chi2, | ||
rmsd: Math.sqrt(rmsd / n) | ||
rmsd: Math.sqrt(rmsd / n), | ||
}; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15249
328
1
12
1
+ Addedis-any-array@0.0.3
+ Addedis-any-array@0.0.3(transitive)