Documentation ¶
Index ¶
- func DataPoint(obs float64, vars []float64) *dataPoint
- func MakeDataPoints(a [][]float64, obsIndex int) []*dataPoint
- func MultiplierCross(vars ...int) featureCross
- func PowCross(i int, power float64) featureCross
- type DataPoints
- type Regression
- func (r *Regression) AddCross(cross featureCross)
- func (r *Regression) Coeff(i int) float64
- func (r *Regression) GetObserved() string
- func (r *Regression) GetVar(i int) string
- func (r *Regression) Predict(vars []float64) (float64, error)
- func (r *Regression) Run() error
- func (r *Regression) SetObserved(name string)
- func (r *Regression) SetVar(i int, name string)
- func (r *Regression) String() string
- func (r *Regression) Train(d ...*dataPoint)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeDataPoints ¶
MakeDataPoints makes a `[]*dataPoint` from a `[][]float64`. The expected fomat for the input is a row-major [][]float64. That is to say the first slice represents a row, and the second represents the cols. Furthermore it is expected that all the col slices are of the same length. The obsIndex parameter indicates which column should be used
func MultiplierCross ¶
func MultiplierCross(vars ...int) featureCross
Feature cross based on the multiplication of multiple inputs.
Types ¶
type DataPoints ¶
type DataPoints []*dataPoint
DataPoints is a slice of *dataPoint . This type allows for easier construction of training Data points
type Regression ¶
type Regression struct { Data []*dataPoint R2 float64 Varianceobserved float64 VariancePredicted float64 Formula string // contains filtered or unexported fields }
func (*Regression) AddCross ¶
func (r *Regression) AddCross(cross featureCross)
Registers a feature cross to be applied to the Data points.
func (*Regression) Coeff ¶
func (r *Regression) Coeff(i int) float64
Coeff returns the calculated coefficient for variable i
func (*Regression) GetObserved ¶
func (r *Regression) GetObserved() string
GetObserved gets the name of the observed value
func (*Regression) GetVar ¶
func (r *Regression) GetVar(i int) string
GetVar gets the name of variable i
func (*Regression) Predict ¶
func (r *Regression) Predict(vars []float64) (float64, error)
Predict updates the "Predicted" value for the input dataPoint
func (*Regression) SetObserved ¶
func (r *Regression) SetObserved(name string)
Set the name of the observed value
func (*Regression) SetVar ¶
func (r *Regression) SetVar(i int, name string)
Set the name of variable i
func (*Regression) Train ¶
func (r *Regression) Train(d ...*dataPoint)
Train the regression with some Data points