Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ml-regression-base

Package Overview
Dependencies
Maintainers
8
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-regression-base - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

9

History.md

@@ -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 @@

4

lib/index.js

@@ -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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc