Documentation ¶
Index ¶
- type Env
- type F
- func (env *F) Add(s float64) *F
- func (env *F) AddF(envs ...*F) *F
- func (env *F) Copy() *F
- func (env *F) Diff(envDiff []float64) int
- func (env *F) DiffSingle(f float64) int
- func (env *F) Divide(s float64) *F
- func (env *F) DivideF(envs ...*F) *F
- func (env *F) Get(i int) float64
- func (env *F) GetBinary(i int) float64
- func (env *F) GetP(i int) *float64
- func (env *F) Len() int
- func (env *F) Mult(s float64) *F
- func (env *F) MultF(envs ...*F) *F
- func (env *F) Mutate(chance float64, mutator mut.FloatMutator) *F
- func (env *F) New(envDiff []float64) *F
- func (env *F) Randomize(min *F, max *F)
- func (env *F) RandomizeSingle(mn float64, mx float64)
- func (env *F) Reinforce(learningRate float64, envs ...*F) *F
- func (env *F) Set(i int, f float64)
- func (env *F) SetAll(f float64)
- func (env *F) SetMap(m map[int]float64)
- func (env *F) SetP(i int, f *float64)
- func (env *F) String() string
- func (env *F) Sub(s float64) *F
- func (env *F) SubF(envs ...*F) *F
- func (env *F) ToEnv() *F
- func (env *F) ToIntRandom() *I
- type I
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Env ¶
An Env represents a slice of values which can be modified by a slice of float64s or return a patterned difference between a slice of float64s and the Env
type F ¶
type F []*float64
F returns a float-valued environment
func (*F) Diff ¶
Diff returns the absolute difference between the given environment and the passed in expectations. 0 in envDiff is treated as insignificant.
func (*F) DiffSingle ¶
DiffSingle returns the sum of the difference between f and each element in the environment
func (*F) New ¶
New creates a combined environment by the given envDiff inputs and returns a new environment pointer
func (*F) RandomizeSingle ¶
RandomizeSingle sets env[i] to a uniform sample between mn and max for all i
func (*F) ToEnv ¶
ToEnv is an assistant function for structs composed with F for interfaces to obtain their F
func (*F) ToIntRandom ¶
ToIntRandom treats the environment as a set of probabilities, and creates an env.I where each element has a env[i] percent chance of being 1, else 0.
type I ¶
type I []*int
I represents an integer-valued environment
func (*I) Diff ¶
Diff returns the absolute difference between the given environment and the passed in expectations. 0 in envDiff is treated as insignificant.
func (*I) MatchDiff ¶
MatchDiff compares each element in envDiff and env and returns the number of elements which are not the same.