stats

package
v0.0.0-...-7a5de80 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package stats provides functions for summarizing results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMeanVals

func GetMeanVals(values []BenchRound, fes int) []float64

func SaveStats

func SaveStats(stats []Stats, fName string)

func SaveTable

func SaveTable(algo string, algoStats [][]Stats)

SaveTable sifts through computed values, organises data in table-like structure as defined in the `report` pkg and passes it on to be fed to a tmpl, result of which is then saved in a `.tex` file (filename based on the algo name string).

Types

type AlgoBenchMean

type AlgoBenchMean struct {
	Algo       string
	BenchMeans []BenchMean
}

AlgoBenchMean holds BenchMean structs of different benchmarks but the same algorithm.

func (AlgoBenchMean) Len

func (a AlgoBenchMean) Len() int

Len implements the sort.Interface.

func (AlgoBenchMean) Less

func (a AlgoBenchMean) Less(i, j int) bool

Less implements the sort.Interface.

func (AlgoBenchMean) Swap

func (a AlgoBenchMean) Swap(i, j int)

Swap implements the sort.Interface.

type AlgoMeanVals

type AlgoMeanVals struct {
	Title string
	// MeanVals of a particular bench func to compare.
	MeanVals []float64
}

AlgoMeanVals holds computed mean values of an Algo.

type BenchMean

type BenchMean struct {
	Bench  string
	Dimens int

	Iterations  int
	Generations int
	// Neighbours param is used in Hill Climbing type algos, set to -1 if not
	// applicable.
	Neighbours int
	// MeanVals holds the mean value for each step of the iteration.
	MeanVals []float64
}

BenchMean structure holds mean vals and metadata of a bench-params combination.

type BenchRound

type BenchRound struct {
	Iteration int
	Results   []float64
}

BenchRound holds the iteration couter value and Results of size 'maxFES'.

type FuncStats

type FuncStats struct {
	BenchName    string
	BenchResults []BenchRound
	// MeanVals holds the mean value for each step of the iteration.
	MeanVals []float64
}

func GetFuncStats

func GetFuncStats(funcName string, benchResults []BenchRound) FuncStats

type MeanStats

type MeanStats struct {
	AlgoMeans []AlgoBenchMean
}

MeanStats aggregates AlgoMean structs of different algos.

func (MeanStats) Len

func (m MeanStats) Len() int

Len implements the sort.Interface.

func (MeanStats) Less

func (m MeanStats) Less(i, j int) bool

Less implements the sort.Interface. note: this in fact sorts in reverse (fits with our use case atm).

func (MeanStats) Swap

func (m MeanStats) Swap(i, j int)

Swap implements the sort.Interface.

type Stats

type Stats struct {
	Algo           string
	Dimens         int
	BenchFuncStats []FuncStats
	Iterations     int
	// this should perhaps be named FES as that is a smarter thing to be
	// comparing than algo generations, which can vary based on the type of
	// algo, number of neighbours, etc..
	Generations int
	// NP is the initial population size, disable with 0. Only applicable to
	// GAs (see algo/de for more details).
	NP int
	// F is the mutation factor, disable with 0. Only applicable to GAs.
	F float64
	// CR is the crossover probability, disable with 0. Only applicable to GAs.
	CR float64
}

func GetStats

func GetStats(algo string, dimens int, benchFuncStats []FuncStats, iterations, generations int) Stats

Jump to

Keyboard shortcuts

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