retina

package
v0.0.0-...-8d87d8f Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxFitness Used as max value which we add error too to get an organism's fitness
	MaxFitness = 1000.0

	// FitnessThreshold is the fitness value for which an organism is considered to have won the experiment
	// TODO update to value which beats the environment (not yet determined)
	FitnessThreshold = 55
)
View Source
const (
	RightSide = Side("right")
	LeftSide  = Side("left")
	BothSide  = Side("both")
)

Variables

This section is empty.

Functions

func EvaluatePredictions

func EvaluatePredictions(predictions []float64, leftObj VisualObject, rightObj VisualObject) float64

EvaluatePredictions returns the loss between predictions and ground truth of leftObj and rightObj

func ParseVisualObjectConfig

func ParseVisualObjectConfig(config string) [][]float64

ParseVisualObjectConfig parses config semantically in the format (config = "x1 x2 \n x3 x4") to [ [x1, x2], [x3, x4] ] where if xi == "o" => xi = 1

Types

type CPPNNetworkBuilder

type CPPNNetworkBuilder struct {
	UseLEO          bool
	SubstrateLayout cppn.EvolvableSubstrateLayout
	NodesActivation utils.NodeActivationType
	Context         *eshyperneat.ESHyperNEATContext

	// New Graph Builder generator function.
	// Note: Graph Builder is used to store graphs in a user-friendly format
	NewGraphBuilder func() *cppn.GraphBuilder
}

CPPNNetworkBuilder handles the building of Network's using CPPN network's to query connections/topology by the esHyperNEAT algorithm

func (*CPPNNetworkBuilder) CreateANNFromCPPN

func (builder *CPPNNetworkBuilder) CreateANNFromCPPN(cppnNetwork *network.Network) (network.NetworkSolver, error)

CreateANNFromCPPN creates a NetworkSolver (ANN) by querying the cppnNetwork by the ESHyperNeat Algorithm

func (*CPPNNetworkBuilder) CreateANNFromCPPNOrganism

func (builder *CPPNNetworkBuilder) CreateANNFromCPPNOrganism(cppnOrganism *genetics.Organism) (network.NetworkSolver, error)

CreateANNFromCPPNOrganism creates a NetworkSolver (ANN) by querying the Organism.Phenotype cppnNetwork by the ESHyperNeat Algorithm

type Environment

type Environment struct {
	VisualObjects []VisualObject
}

Environment holds the dataset and evaluation methods for the modular retina experiment

func NewRetinaEnvironment

func NewRetinaEnvironment() Environment

NewRetinaEnvironment creates a new Retina Environment with a dataset of all possible Visual Object

type GenerationEvaluator

type GenerationEvaluator struct {
	OutputPath         string
	Environment        *Environment
	CPPNNetworkBuilder *CPPNNetworkBuilder
}

GenerationEvaluator holds the Retina environment and setup instructions. it implemens the GenerationEvaluator interface by implementing GenerationEvaluate

func (GenerationEvaluator) GenerationEvaluate

func (eval GenerationEvaluator) GenerationEvaluate(population *genetics.Population, epoch *experiments.Generation, context *neat.NeatContext) (err error)

GenerationEvaluate evaluates a population of organisms and prints their performance on the retina experiment

func (GenerationEvaluator) OrganismEvaluate

func (eval GenerationEvaluator) OrganismEvaluate(organism *genetics.Organism, context *neat.NeatContext) (bool, error)

OrganismEvaluate evalutes an individual phenotype network with retina experiment and returns true if its won

type Side

type Side string

Side that a Visual Object is valid in

func (Side) String

func (s Side) String() string

type VisualObject

type VisualObject struct {
	// Setup visual object
	Side   Side
	Size   int
	Config string

	// Inner computed values from Config parsing
	Data [][]float64
}

VisualObject represents a left, right, or both, object classified by retina

func CreateRetinaDataset

func CreateRetinaDataset() []VisualObject

CreateRetinaDataset returns the 16 possible permuations of visual objects

func NewVisualObject

func NewVisualObject(side Side, size int, config string) VisualObject

NewVisualObject creates a new VisuaObject by first parsing the config string into a VisualObject

func (*VisualObject) Flatten

func (obj *VisualObject) Flatten() []float64

Flatten returns a 1D array from the values in the 2D obj

func (*VisualObject) String

func (obj *VisualObject) String() string

Jump to

Keyboard shortcuts

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