New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

predictor

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

predictor

A framework to automate the process of evaluating and running prediction models

latest
Source
npmnpm
Version
0.0.0
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

Predictor

Predictor automates the process of predicting future values in a set and evaluating this prediction models. Predictor doesn't predict the values for you but rather sets up a few tools to help you test and run your prediction functions. The base functions are guess and evaluate. Predictor also comes with a set of standard numeric datasets including but not limited to the s-curve, parabola, and Fibonacci sets. These can be found under the static datasets namespace.

Install

npm install predictor

Usage

var predictor = require("predictor");

var guesser = function(distance, dataset){
	return dataset[dataset.length-1]+distance;
}

var sCurvePredictor = new predictor(predictor.datasets.s_curve, guesser, predictor.evaluators.standard);

var evaluation = sCurvePredictor.evaluate({distance:3});

console.log(evaluation);

Predictor Object

new predictor(dataset, guesser, evaluator)

Creates a new predictor object.

  • dataset: the array of data the guesser is trying to predict.
  • guesser(distance, dataset): a function that guesses the array value of the dataset at x distance out;
    • distance: is the number of iterations out the guesser is trying to predict.
    • dataset: all historical data points up to and including the predict from point.
  • evaluator(guess, answer): returns a numeric representation of how accurate the guess was.
    • guess: a result of guesser
    • answer: the actually value from the dataset at the same location guesser tried to predict.

obj.guess(opt)

Guesses a value based on the supplied options.

Options

  • dataset: full dataset. Should included all datapoints up to the guess from point and can include more. Defaults to dataset provided in the initializer.
  • from: Where in the dataset to guess from. Defaults to the end of the dataset.
  • to: Where in the dataset to guess. Will have no effect if distance is provided.
  • distance: how far from the from point to guess. If not provided will default to the value of to minus from. If to is undefined, distance will default to 1.
  • guesser: a guesser function. Defaults to the one provided in the initializer.

obj.evaluate();

Evaluates a guesser function based on the supplied options. Returns an object of observations included the average evaluation, a list of guesses resulting in NaN and a record of each iteration through the dataset, guess, answer and evaluation.

Options

  • dataset: Full dataset. Should included all datapoints up to the guess from point and can include more. Defaults to dataset provided in the initializer.
  • distance: How far from the from point to guess. If not provided will default 1.
  • guesser: a guesser function. Defaults to the one provided in the initializer.
  • evaluator: an evaluator function. Defaults to the one provided in the initializer.

Static Values

predictor.datasets

A collection of predefined numeric sets.

  • predictor.datasets.S_CURVE:
  • predictor.datasets.PARABOLA:
  • predictor.datasets.FIBONACCI:

predictor.evaluators

A collection of predefined evaluators

  • predictor.evaluators.standard: evaluates the guess as a percentage away from the answer. 0 is a perfect score. 100 means the guess is as far from the answer as the answer is from 0.

FAQs

Package last updated on 17 Jun 2013

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