Example #1
0
// NewAROW creates an AROW model. regWeight means sensitivity for data. When regWeight is large,
// the model learns quickly but harms from noise. regWeight must be larger than zero.
func NewAROW(regWeight float32) (*AROW, error) {
	if regWeight <= 0 {
		return nil, errors.New("regularization weight must be larger than zero")
	}
	return &AROW{
		model:     make(model),
		regWeight: regWeight,
		intern:    intern.New(),
	}, nil
}
Example #2
0
// Clear clears a model.
func (a *AROW) Clear() {
	a.m.Lock()
	defer a.m.Unlock()
	a.model = make(model)
	a.intern = intern.New()
}