func (l *LocalLinear) Examples() int {
	return len(l.trainingSet)
}
Examples returns the number of training examples (m)
that the model currently is training from.
package linear
import (
	"bytes"
	"fmt"
	"io"
	"math"
	"os"
	"github.com/cdipaolo/goml/base"
)
type LocalLinear struct {
	alpha          float64
	regularization float64
	bandwidth      float64
	maxIterations  int
	method base.OptimizationMethod
	trainingSet     [][]float64
	expectedResults []float64
	Parameters []float64 `json:"theta"`
	Output io.Writer
}
func NewLocalLinear(method base.OptimizationMethod, alpha, regularization, bandwidth float64, maxIterations int, trainingSet [][]float64, expectedResults []float64) *LocalLinear {
	var params []float64
	if trainingSet == nil || len(trainingSet) == 0 {
		params = []float64{}
	} else {
		params = make([]float64, len(trainingSet[0])+1)
	}
	return &LocalLinear{
		alpha:          alpha,
		regularization: regularization,
		bandwidth:      bandwidth,
		maxIterations:  maxIterations,
		method: method,
		trainingSet:     trainingSet,
		expectedResults: expectedResults,
		Parameters: params,
		Output: os.Stdout,
	}
}
func (l *LocalLinear) UpdateTrainingSet(trainingSet [][]float64, expectedResults []float64) error {
	if len(trainingSet) == 0 {
		return fmt.Errorf("Error: length of given training set is 0! Need data!")
	}
	if len(expectedResults) == 0 {
		return fmt.Errorf("Error: length of given result data set is 0! Need expected results!")
	}
	l.trainingSet = trainingSet
	l.expectedResults = expectedResults
	return nil
}
func (l *LocalLinear) UpdateLearningRate(a float64) {
	l.alpha = a
}
func (l *LocalLinear) LearningRate() float64 {
	return l.alpha
}