It("Does not return an error", func() { _, err := gradientdescentestimator.NewGradientDescentParameterEstimator( 0.3, 0.3, 100, lossGradient, ) Ω(err).ShouldNot(HaveOccurred()) }) }) }) Describe("Train", func() { var trainingSet dataset.Dataset var estimator parameterestimator.ParameterEstimator BeforeEach(func() { var err error estimator, err = gradientdescentestimator.NewGradientDescentParameterEstimator( 0.3, 0.3, 100, lossGradient, ) Ω(err).ShouldNot(HaveOccurred()) }) Context("Given a dataset with non-float features", func() { BeforeEach(func() { columnTypes, err := columntype.StringsToColumnTypes([]string{"x", "1.0"})
import ( "github.com/amitkgupta/goodlearn/data/columntype" "github.com/amitkgupta/goodlearn/data/dataset" "github.com/amitkgupta/goodlearn/parameterestimator" "github.com/amitkgupta/goodlearn/parameterestimator/gradientdescentestimator" "fmt" "math/rand" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Linear Model Least Squares Parameter Estimation", func() { var estimator parameterestimator.ParameterEstimator var trueParameters []float64 Context("Given reasonable learning rate, precision, maximum number of iterations, and training set", func() { BeforeEach(func() { trueParameters = []float64{2, -3, 4} var err error estimator, err = gradientdescentestimator.NewGradientDescentParameterEstimator( 0.001, 0.000005, 1000, gradientdescentestimator.LinearModelLeastSquaresLossGradient, ) Ω(err).ShouldNot(HaveOccurred())