Documentation
¶
Overview ¶
Example (ExternalWeights) ¶
Output: Smoothed [5.00 3.50 2.00 3.50 5.00 5.00 4.25 3.50 4.25 5.00 5.00 4.25 3.50 4.25 5.00 5.00 3.75 2.50 3.75 5.00]
Example (Smooth) ¶
Output: Smoothed [5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00] Smoothed [5.50 4.60 3.86 3.93 4.86 5.43 5.21 4.50 4.14 4.71 5.14 4.78 4.50 4.57 5.00 5.43 4.93 4.22 4.35 4.78]
Index ¶
- func Linear(s *State, x, left, right float64) error
- func Quadratic(s *State, x, left, right float64) error
- func Regress(s *State, fn WeightUpdate, x, left, right float64) (retVal float64, err error)
- func Smooth(x []float64, width, jump int, fn WeightUpdate) ([]float64, error)
- func UnsafeSmooth(regression *State, width, jump int, fn WeightUpdate, retVal []float64) ([]float64, error)
- type State
- type WeightUpdate
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Linear ¶
Linear performs linear regression, but constrained to left and right values. The implementation is slightly different from the typical Y = (X'X)^-1(X'Y)
func Regress ¶
func Regress(s *State, fn WeightUpdate, x, left, right float64) (retVal float64, err error)
Regress performs local regression of x between left and right
func Smooth ¶
func Smooth(x []float64, width, jump int, fn WeightUpdate) ([]float64, error)
Smooth smooths a slice of float64, with the provided width, jumps and update functions
func UnsafeSmooth ¶
func UnsafeSmooth(regression *State, width, jump int, fn WeightUpdate, retVal []float64) ([]float64, error)
UnsafeSmooth is like Smooth, except the state is passed in, as well as a optional return value to be mutated.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents a state for regression. Every field will be mutated by the Regress and Smooth functions
func NewWithExternal ¶
NewWithExternal creates a new LOESS state with externally provided weights
type WeightUpdate ¶
WeightUpdate is a function that modifies the State.
Click to show internal directories.
Click to hide internal directories.