ml-regression-base
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -0,1 +1,10 @@ | ||
## [2.1.1](https://github.com/mljs/regression-base/compare/v2.1.0...v2.1.1) (2020-02-04) | ||
### Bug Fixes | ||
* allows any array for predict and score ([23bfb60](https://github.com/mljs/regression-base/commit/23bfb607923985ade77aad33f76f09dc9e43e874)) | ||
# [2.1.0](https://github.com/mljs/regression-base/compare/v2.0.1...v2.1.0) (2020-02-04) | ||
@@ -2,0 +11,0 @@ |
@@ -45,3 +45,3 @@ 'use strict'; | ||
return this._predict(x); | ||
} else if (Array.isArray(x)) { | ||
} else if (isAnyArray(x)) { | ||
const y = []; | ||
@@ -80,3 +80,3 @@ for (let i = 0; i < x.length; i++) { | ||
score(x, y) { | ||
if (!Array.isArray(x) || !Array.isArray(y) || x.length !== y.length) { | ||
if (!isAnyArray(x) || !isAnyArray(y) || x.length !== y.length) { | ||
throw new Error('x and y must be arrays of the same length'); | ||
@@ -83,0 +83,0 @@ } |
{ | ||
"name": "ml-regression-base", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Base class for regression modules", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -19,2 +19,10 @@ import checkArrayLength from '../checkArrayLength'; | ||
}); | ||
it('correct result', () => { | ||
expect(checkArrayLength([1, 2], [2, 3])).toBeUndefined(); | ||
expect( | ||
checkArrayLength(new Float64Array([1, 2]), new Float64Array([2, 3])), | ||
).toBeUndefined(); | ||
expect(checkArrayLength([1, 2], new Float64Array([2, 3]))).toBeUndefined(); | ||
}); | ||
}); |
@@ -0,4 +1,5 @@ | ||
import isAnyArray from 'is-any-array'; | ||
export { default as maybeToPrecision } from './maybeToPrecision'; | ||
export { default as checkArrayLength } from './checkArrayLength'; | ||
export default class BaseRegression { | ||
@@ -14,3 +15,3 @@ constructor() { | ||
return this._predict(x); | ||
} else if (Array.isArray(x)) { | ||
} else if (isAnyArray(x)) { | ||
const y = []; | ||
@@ -49,3 +50,3 @@ for (let i = 0; i < x.length; i++) { | ||
score(x, y) { | ||
if (!Array.isArray(x) || !Array.isArray(y) || x.length !== y.length) { | ||
if (!isAnyArray(x) || !isAnyArray(y) || x.length !== y.length) { | ||
throw new Error('x and y must be arrays of the same length'); | ||
@@ -52,0 +53,0 @@ } |
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
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
15812
336
0