random

package
v0.0.0-...-8099d2f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset   = "\033[0m"
	Red     = "\033[31m"
	Green   = "\033[32m"
	Yellow  = "\033[33m"
	Blue    = "\033[34m"
	Magenta = "\033[35m"
	Cyan    = "\033[36m"
	Gray    = "\033[37m"
	White   = "\033[97m"
)
View Source
const (
	// Symbols
	Symbols = 11
	// Input is the network input size
	Input = Symbols + 2*7 + 1
	// Width is the width of the markov model
	Width = 3
	// Height is the height of the markov model
	Height = 3
	// Size is the size of the markov model
	Size = Width*Height - 1
)

Variables

This section is empty.

Functions

func Random

func Random()

Random mode

Types

type Example

type Example struct {
	Input  [][]byte `json:"input"`
	Output [][]byte `json:"output"`
}

Example is a learning example

type Image

type Image struct {
	W int
	H int
	I []Pixel
}

Image is an image

type Model

type Model struct {
	Query    matrix.RandomMatrix
	Key      matrix.RandomMatrix
	Value    matrix.RandomMatrix
	Solution matrix.RandomMatrix
	Order    matrix.RandomMatrix
}

Model model is the random matrix model

type Opt

type Opt struct {
	Opt    matrix.Matrix
	Input  Pair
	Output Pair
}

Opt is an optimization

func GetTrainingData

func GetTrainingData(sets []Set, s, t int) (opt []Opt, w [Symbols]int)

GetTrainingData gets the training data

func (Opt) TargetOffset

func (o Opt) TargetOffset() int

TargetOffset is the target offset

func (Opt) TargetSize

func (o Opt) TargetSize() int

TargetSize is the size of the target

type OptSingle

type OptSingle struct {
	Count  int
	Opt    matrix.Matrix
	Input  Pair
	Output Pair
}

OptSingle is an optimization

func GetSingleTrainingData

func GetSingleTrainingData(sets []Set, s, t int) (opt []OptSingle, w [Symbols]int)

GetSingleTrainingData gets the training data

func (OptSingle) TargetOffset

func (o OptSingle) TargetOffset() int

TargetOffset is the target offset

func (OptSingle) TargetSize

func (o OptSingle) TargetSize() int

TargetSize is the size of the target

type Pair

type Pair struct {
	Class  int
	Input  Image
	Output Image
}

Pair is an input output pair

type Pixel

type Pixel struct {
	C uint8
	X int
	Y int
}

Pixel is an image pixel

type Sample

type Sample struct {
	Query    matrix.Generator
	Key      matrix.Generator
	Value    matrix.Generator
	Solution matrix.Generator
	Order    matrix.Generator
	Cost     float64
	Grid     [][]int
}

Sample is a sample

type Set

type Set struct {
	Test  []Example `json:"test"`
	Train []Example `json:"train"`
}

Set is a set of examples

func Load

func Load() []Set

Load loads the data

type Stat

type Stat struct {
	Count      float64
	Sum        float64
	SumSquared float64
}

Stat is a statistic

type State

type State [Size]byte

State is a markov state

Jump to

Keyboard shortcuts

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