regressions

package module
v0.0.0-...-50da7c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2017 License: MIT Imports: 3 Imported by: 0

README

go-regressions

Regressions library in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPoint

type DataPoint interface {
	GetX() float64
	GetY() float64
}

DataPoint represents a data point in the regression.

type ErrLogUndefined

type ErrLogUndefined float64

ErrLogUndefined signifies that the logarithm of the underlying value is undefined.

func (ErrLogUndefined) Error

func (f ErrLogUndefined) Error() string

Error implements the error interface

func (ErrLogUndefined) Value

func (f ErrLogUndefined) Value() float64

Value returns the floating point value for which the logarithm is undefined.

type Fitter

type Fitter interface {
	Fit(dps ...DataPoint) error
}

Fitter is the interface that wraps the Fit method.

type Predicter

type Predicter interface {
	Predict(x float64) (float64, error)
}

Predicter is the interface that wraps the Predict method.

type Regression

type Regression interface {
	Fitter
	Predicter

	// GetR2 returns the R-squared metric of the regression.
	GetR2() float64
}

Regression is the interface that groups the Fit and Predict methods.

func NewCombined

func NewCombined(combiner func(x, y float64) float64, first, second Regression) Regression

NewCombined returns a new Regression combining other regression.

func NewExponential

func NewExponential() Regression

NewExponential returns a new Regression for exponential regression.

func NewExponentialWithLogExpFunc

func NewExponentialWithLogExpFunc(log, exp func(float64) float64) Regression

NewExponentialWithLogExpFunc returns a new Regression for log-log regression.

func NewLinear

func NewLinear() Regression

NewLinear returns a new Regression for linear regression.

func NewLogLog

func NewLogLog() Regression

NewLogLog returns a new Regression for log-log regression.

func NewLogLogWithLogFunc

func NewLogLogWithLogFunc(log func(float64) float64) Regression

NewLogLogWithLogFunc returns a new Regression for log-log regression.

func NewLogarithmic

func NewLogarithmic() Regression

NewLogarithmic returns a new Regression for logarithmic regression.

func NewLogarithmicWithLogFunc

func NewLogarithmicWithLogFunc(log func(float64) float64) Regression

NewLogarithmicWithLogFunc returns a new Regression for logarithmic regression.

func NewPower

func NewPower() Regression

NewPower returns a new Regression for power regression.

func NewPowerWithLogFunc

func NewPowerWithLogFunc(log func(float64) float64) Regression

NewPowerWithLogFunc returns a new Regression for power regression.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL