Documentation ¶
Index ¶
- func ExploreLearning(af FDAdaptiveFilter, d [][]float64, x [][]float64, muStart, muEnd float64, ...) ([]float64, []float64, error)
- func PreTrainedRun(af FDAdaptiveFilter, d [][]float64, x [][]float64, nTrain float64, epochs int) (y, e [][]float64, w [][]float64, err error)
- type FDAdaptiveFilter
- type FiltFBLMS
- func (af *FiltFBLMS) Adapt(d []float64, x []float64)
- func (af *FiltFBLMS) GetKindName() (kind string)
- func (af *FiltFBLMS) GetParams() (n int, mu float64, w []float64)
- func (af *FiltFBLMS) Predict(x []float64) (y []float64)
- func (af *FiltFBLMS) Run(d [][]float64, x [][]float64) ([][]float64, [][]float64, [][]float64, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExploreLearning ¶
func ExploreLearning(af FDAdaptiveFilter, d [][]float64, x [][]float64, muStart, muEnd float64, steps int, nTrain float64, epochs int, criteria string, targetW []float64) ([]float64, []float64, error)
ExploreLearning searches the `mu` with the smallest error value from the input matrix `x` and desired values `d`. The arg `d` is desired value. `x` is input matrix. `muStart` is starting learning rate. `muEnd` is final learning rate. `steps` : how many learning rates should be tested between `muStart` and `muEnd`. `nTrain` is train to test ratio, typical value is 0.5. (that means 50% of data is used for training) `epochs` is number of training epochs, typical value is 1. This number describes how many times the training will be repeated. `criteria` is how should be measured the mean error. Available values are "MSE", "MAE" and "RMSE". `target_w` is target weights. If the slice is nil, the mean error is estimated from prediction error. If an slice is provided, the error between weights and `target_w` is used.
Example (Fblms) ¶
Output: the step size mu with the smallest error is 0.010
func PreTrainedRun ¶
func PreTrainedRun(af FDAdaptiveFilter, d [][]float64, x [][]float64, nTrain float64, epochs int) (y, e [][]float64, w [][]float64, err error)
PreTrainedRun use part of the data for few epochs of learning. The arg `d` is desired values. rows are `x` is input matrix. rows are samples and columns are features. `nTrain` is train to test ratio, typical value is 0.5. (that means 50% of data is used for training). `epochs` is number of training epochs, typical value is 1. This number describes how many times the training will be repeated.
Types ¶
type FDAdaptiveFilter ¶
type FDAdaptiveFilter interface { //Predict calculates the new estimated value `y` from input slice `x`. Predict(x []float64) (y []float64) //Adapt calculates the error `e` between desired value `d` and estimated value `y`, //and update filter weights according to error `e`. Adapt(d []float64, x []float64) //Run calculates the errors `e` between desired values `d` and estimated values `y` in a row, //while updating filter weights according to error `e`. Run(d [][]float64, x [][]float64) ([][]float64, [][]float64, [][]float64, error) //GetParams returns the parameters at the time this func is called. //parameters contains `n`: filter length, `mu`: filter update step size and `w`: filter weights. GetParams() (int, float64, []float64) //GetParams returns the name of FDADF. GetKindName() (kind string) // contains filtered or unexported methods }
FDAdaptiveFilter is the basic Frequency Domain Adaptive Filter interface type.
func Must ¶
func Must(af FDAdaptiveFilter, err error) FDAdaptiveFilter
Must checks whether err is nil or not. If err in not nil, this func causes panic.
func NewFiltFBLMS ¶
func NewFiltFBLMS(n int, mu float64, w interface{}) (FDAdaptiveFilter, error)
NewFiltFBLMS is constructor of FBLMS filter. This func initialize filter length `n`, update step size `mu` and filter weight `w`.
type FiltFBLMS ¶
type FiltFBLMS struct {
// contains filtered or unexported fields
}
FiltFBLMS is base struct for FBLMS filter (Fast Block Least Mean Square filter). Use NewFiltFBLMS to make instance.
func (*FiltFBLMS) Adapt ¶
Adapt calculates the error `e` between desired value `d` and estimated value `y`, and update filter weights according to error `e`.
func (*FiltFBLMS) GetKindName ¶
func (af *FiltFBLMS) GetKindName() (kind string)
GetParams returns the kind name of ADF.
func (*FiltFBLMS) GetParams ¶
GetParams returns the parameters at the time this func is called. parameters contains `n`: filter length, `mu`: filter update step size and `w`: filter weights.
func (*FiltFBLMS) Run ¶
func (af *FiltFBLMS) Run(d [][]float64, x [][]float64) ([][]float64, [][]float64, [][]float64, error)
Run calculates the errors `e` between desired values `d` and estimated values `y` in a row, while updating filter weights according to error `e`. The arg `x`: rows are samples sets, columns are input values.