npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

predictor

v0.0.0

Published

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

Downloads

4

Readme

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.