Version: v0.0.0-...-4408542 Latest Latest

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

Go to latest
Published: Jan 10, 2014 License: BSD-3-Clause Imports: 1 Imported by: 0




This section is empty.


This section is empty.


func Cumulative

func Cumulative(s *Simulation) []float64

Cumulative performance returns an array of mean rewards at each trial point. Averaged over sims

func Performance

func Performance(s *Simulation) []float64

Performance returns an array of mean rewards at each trial point. Averaged over sims


type Arm

type Arm func() float64

Arm simulates a single strategy arm pull with every execution. Returns {0,1}.

type Simulation

type Simulation struct {
	Sims        int
	Trials      int
	Description string
	Sim         []int
	Trial       []int
	Selected    []int
	Reward      []float64
	Cumulative  []float64

Simulation is a matrix of simulation results. Columns represent individual trial results that grow to the right with each trial

func MonteCarlo

func MonteCarlo(sims, trials int, arms []Arm, b Strategy) (Simulation, error)

MonteCarlo runs a monte carlo experiment with the given strategy and arms.

type Strategy

type Strategy interface {
	SelectArm() int
	Update(arm int, reward float64)

Strategy can select arm or update information

type Summary

type Summary func(s *Simulation) []float64

Summary summarizes a Simulation and returns corresponding plot points.

func Accuracy

func Accuracy(bestArms []int) Summary

Accuracy returns the proportion of times the best arm was pulled at each trial point. Takes a slice of best arms since n arms may be equally good.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL