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

ml-regression-base

Package Overview
Dependencies
Maintainers
7
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-regression-base

Base class for regression modules

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
64K
increased by10.08%
Maintainers
7
Weekly downloads
 
Created
Source

regression-base

NPM version build status Test coverage npm download

Base class for regression modules.
This package is for ml.js internal use.

Usage

You only have to implement the _predict method. It is always called with a number.

The model should be created in the constructor.

Optional methods that can be implemented: toString, toLaTeX.

import BaseRegression from 'ml-regression-base';

class MyRegression extends BaseRegression {
  constructor(factor) {
    super();
    this.factor = factor;
  }
  _predict(x) {
    return x * this.factor;
  }
  toString() {
    return `f(x) = x * ${this.factor}`;
  }
}

maybeToPrecision(value, digits)

Convenience method to transform numbers to readable strings.

If digits is not specified, "value.toString()" is used. Otherwise "value.toPrecision(digits)" is used.

This method can be used to implement toString() or toLaTeX().

checkArrayLength(x, y)

Convenience method to check if the input and output arrays passed to a regression constructor are effectively arrays with the same length.

License

MIT

FAQs

Package last updated on 15 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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