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

zodiac-ts

v1.0.3

Published

time serie library

Downloads

463

Readme

Zodiac-ts alt tag

Build Status

Zodiac-ts is a time series library written in Javascript. Currently, it implements the following algorithms :

  • Simple exponential smoothing;
  • Double exponential smoothing;
  • Holt Smoothing;
  • Holt Winters smoothing.

Coming soon :

  • Moving average

How to use Zodiac-ts ?

  • You can install it using npm, by writting : npm install zodiac-ts
  • Or you can simply clone it using git clone
zodiac = require("zodiac-ts");
var data = [25, 29, 24, 21, 26, 23, 27, 25, 21, 24, 26, 29, 25];

//Case of simple exponential smoothing
var alpha = 0.4;

var ses = new zodiac.SimpleExponentialSmoothing(data, alpha);
var forecast = ses.predict(); //return an array with estimated values until t+1

//You can optimize alpha value
var optimizedAlpha = ses.optimizeParameter(20); //You have to pass the number of iterations as parameter
//After the optimization, the value of alpha is directly set to optimizedAlpha

//You can predict again with the optimized value of alpha
var optimizedForecast = ses.predict();


//Case of double exponential smoothing
var des = new zodiac.DoubleExponentialSmoothing(data, alpha);
forecast = des.predict(3); //You have to pass the horizon of the prediction

//You can also optimize alpha value
optimizedAlpha = des.optimizeParameter(20);
//After the optimization, the value of alpha is directly set to optimizedAlpha

//Case of Holt smoothing
var gamma = 0.3;
var hs = new zodiac.HoltSmoothing(data, alpha, gamma)
forecast = hs.predict();
console.log(forecast);
var optimizedParameters = hs.optimizeParameters(20); //return an object containing the optimized value of alpha and gamma
//After the optimization, the value of alpha and gamma are directly set to the optimized values

//Case of Holt Winters smoothing
var delta = 0.5;
var seasonLength = 4;
var multiplicative = false; //indicates if the model is additive or multiplicative

var hws = new zodiac.HoltWintersSmoothing(data, alpha, gamma, delta, seasonLength, multiplicative);
forecast = hws.predict();
optimizedParameters = hws.optimizeParameters(20); //return an object containing the optimized values of alpha, gamma and delta
//After the optimization, the value of alpha, gamma and delta are directly set to the optimized values