Giter Site home page Giter Site logo

analytics's Introduction

analytics

Analytics and curve fitting library in go.
The library provides a Series structure that can be initialized with two []float64 containing x/y data.
Once initialized, functions can be applied to create new Series, or curve fitting can be applied to interpolate or (depending on the algorithm) extrapolate data points.

Simple example usage:

	//Define a small dataset
	x := []float64{1, 2, 3, 4, 5, 6, 7, 8}
	y := []float64{8, 6, 5, 5, 4, 3, 3, 2}
	
	//Use the dataset as a series
	series1 := analytics.NewSeriesFrom(x, y)

	//Get a 3rd Order Polynomial fit for the series
	fit := series1.FitPolynomial(3)

	//Display two interpolated/extrapolated points
	fmt.Println(analytics.Extrapolate(fit, 4))
	fmt.Println(analytics.Extrapolate(fit, 9))

	//Create smoothed version of the dataset
	series2 := series1.Smoother(3)

	//Display the underlying smoothed values
	x1, y1 := series2.ToArrays()
	fmt.Println(series2.x1)
	fmt.Println(series2.y1)

##General Data Manipulation Functions
Smoother - Iterative noise removal algorithm.
Pixelize - Quantization function.
MA - Moving average
EMA - Exponential moving average
LWMA - Linear weighted moving average
TrendChanges - Apex for peaks and troughs for smoothed data.
ApplyOffset - Move a series on x/y axes

##Data Splicing and Combining Functions
RecentTrends - Splices smoothed data into multiple series, each describing a trend.
Last - Extracts a copy of the last n points from the end of a series.
From - Extracts a copy of data points starting from an arbitrary x value.
Append - Joins two series together to form a new series.

##Financial Analysis Based Functions
ITrend - John Ehlers instantaneous trend (iTrend) indicator
CCI - Commodity Channel Index

##Misc Functions ToArrays - Extracts two 1D slices of values, one for x and one for y ToValues - As ToArrays, but takes an offset from the last datapoint

##Curve fit types Linear
Logarithmic
Exponential
Power
Polynomial (n-order)
Gaussian
Parabolic

##Todo Tests! (started) Fix up Gaussian fit (use scaling in addition to the offset) Fix up Parabolic fit (use scaling in addition to the offset)
Implement Cubic Spline
Cache sums for curve fit
Error handling

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.