meta

package
v0.0.0-...-8433fb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoldenLineSearch

type GoldenLineSearch struct {
	Min, Max float64 // Initial interval
	Tol      float64
}

GoldenLineSearch implements Golden-section line-search.

func (GoldenLineSearch) Solve

func (gls GoldenLineSearch) Solve(f func(x float64) float64) float64

Solve of GoldenLineSearch taken from https://www.wikiwand.com/en/Golden-section_search.

type GradientBoosting

type GradientBoosting struct {
	xgp.GPConfig
	NRounds              uint
	NEarlyStoppingRounds uint
	LearningRate         float64
	LineSearcher         LineSearcher
	Loss                 metrics.DiffMetric
	RowSampling          float64
	ColSampling          float64
	Programs             []xgp.Program
	Steps                []float64
	UsedCols             [][]int
	ValScores            []float64
	TrainScores          []float64
	YMean                float64
	UseBestRounds        bool
	MonitorEvery         uint
	RNG                  *rand.Rand
}

GradientBoosting implements gradient boosting on top of genetic programming.

func NewGradientBoosting

func NewGradientBoosting(
	conf xgp.GPConfig,
	nRounds uint,
	nEarlyStoppingRounds uint,
	learningRate float64,
	lineSearcher LineSearcher,
	loss metrics.DiffMetric,
	rowSampling float64,
	colSampling float64,
	useBestRounds bool,
	monitorEvery uint,
	rng *rand.Rand,
) (*GradientBoosting, error)

NewGradientBoosting returns a GradientBoosting.

func (*GradientBoosting) Fit

func (gb *GradientBoosting) Fit(

	X [][]float64,
	Y []float64,

	W []float64,
	XVal [][]float64,
	YVal []float64,
	WVal []float64,
	verbose bool,
) error

Fit iteratively trains a GP on the gradient of the loss.

func (GradientBoosting) MarshalJSON

func (gb GradientBoosting) MarshalJSON() ([]byte, error)

MarshalJSON serializes a GradientBoosting.

func (GradientBoosting) Predict

func (gb GradientBoosting) Predict(X [][]float64, proba bool) ([]float64, error)

Predict accumulates the predictions of each stored Program.

func (*GradientBoosting) UnmarshalJSON

func (gb *GradientBoosting) UnmarshalJSON(bytes []byte) error

UnmarshalJSON parses a GradientBoosting.

type LineSearcher

type LineSearcher interface {
	Solve(f func(x float64) float64) float64
}

A LineSearcher finds a good enough step size to a gradient descent problem. f is the function we want to minimize given a step size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL