v1alpha1

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrExperimentNameInvalid  ErrorType = "experiment-name-invalid"
	ErrExperimentNameConflict           = "experiment-name-conflict"
	ErrExperimentInvalid                = "experiment-invalid"
	ErrExperimentNotFound               = "experiment-not-found"
	ErrExperimentStopped                = "experiment-stopped"
	ErrTrialInvalid                     = "trial-invalid"
	ErrTrialUnavailable                 = "trial-unavailable"
	ErrTrialNotFound                    = "trial-not-found"
	ErrUnexpected                       = "unexpected"
)
View Source
const (
	TrialStaged    TrialStatus = "staged"
	TrialActive                = "active"
	TrialCompleted             = "completed"
	TrialFailed                = "failed"
	TrialAbandoned             = "abandoned"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetAllExperiments(context.Context, *ExperimentListQuery) (ExperimentList, error)
	GetAllExperimentsByPage(context.Context, string) (ExperimentList, error)
	GetExperimentByName(context.Context, ExperimentName) (Experiment, error)
	GetExperiment(context.Context, string) (Experiment, error)
	CreateExperiment(context.Context, ExperimentName, Experiment) (Experiment, error)
	DeleteExperiment(context.Context, string) error
	GetAllTrials(context.Context, string, *TrialListQuery) (TrialList, error)
	CreateTrial(context.Context, string, TrialAssignments) (string, error) // TODO Should this return TrialAssignments?
	NextTrial(context.Context, string) (TrialAssignments, error)
	ReportTrial(context.Context, string, TrialValues) error
	AbandonRunningTrial(context.Context, string) error
}

API provides bindings for the supported endpoints

func NewApi

func NewApi(c api.Client) API

NewApi returns a new version specific API for the specified client

func NewForConfig

func NewForConfig(c *api.Config) (API, error)

NewForConfig returns a new version specific API for the specified client configuration

type Assignment

type Assignment struct {
	// The name of the parameter in the experiment the assignment corresponds to.
	ParameterName string `json:"parameterName"`
	// The assigned value of the parameter.
	Value json.Number `json:"value"`
}

type Bounds

type Bounds struct {
	// The minimum value for a numeric parameter.
	Min json.Number `json:"min"`
	// The maximum value for a numeric parameter.
	Max json.Number `json:"max"`
}

type Error

type Error struct {
	Type       ErrorType     `json:"-"`
	Message    string        `json:"error"`
	RetryAfter time.Duration `json:"-"`
}

Error represents the API specific error messages and may be used in response to HTTP status codes

func (*Error) Error

func (e *Error) Error() string

type ErrorType

type ErrorType string

type Experiment

type Experiment struct {
	ExperimentMeta

	// The display name of the experiment. Do not use for generating URLs!
	DisplayName string `json:"displayName,omitempty"`
	// Controls how the optimizer will generate trials.
	Optimization Optimization `json:"optimization,omitempty"`
	// The metrics been optimized in the experiment.
	Metrics []Metric `json:"metrics"`
	// The search space of the experiment.
	Parameters []Parameter `json:"parameters"`
}

Experiment combines the search space, outcomes and optimization configuration

type ExperimentItem

type ExperimentItem struct {
	Experiment

	// The metadata for an individual experiment.
	Metadata Metadata `json:"_metadata,omitempty"`
}

type ExperimentList

type ExperimentList struct {
	ExperimentListMeta

	// The list of experiments.
	Experiments []ExperimentItem `json:"experiments,omitempty"`
}

type ExperimentListMeta

type ExperimentListMeta struct {
	Next string `json:"-"`
	Prev string `json:"-"`
}

func (*ExperimentListMeta) SetLastModified

func (m *ExperimentListMeta) SetLastModified(time.Time)
func (m *ExperimentListMeta) SetLink(rel, link string)

func (*ExperimentListMeta) SetLocation

func (m *ExperimentListMeta) SetLocation(string)

type ExperimentListQuery

type ExperimentListQuery struct {
	Offset int
	Limit  int
}

func (*ExperimentListQuery) Encode

func (p *ExperimentListQuery) Encode() string

type ExperimentMeta

type ExperimentMeta struct {
	LastModified time.Time `json:"-"`
	Self         string    `json:"-"`
	Trials       string    `json:"-"`
	NextTrial    string    `json:"-"`
}

func (*ExperimentMeta) SetLastModified

func (m *ExperimentMeta) SetLastModified(lastModified time.Time)
func (m *ExperimentMeta) SetLink(rel, link string)

func (*ExperimentMeta) SetLocation

func (m *ExperimentMeta) SetLocation(string)

type ExperimentName

type ExperimentName interface {
	Name() string
}

ExperimentName exists to clearly separate cases where an actual name can be used

func NewExperimentName

func NewExperimentName(n string) ExperimentName

NewExperimentName returns an experiment name for a given string

type Meta

type Meta interface {
	SetLocation(string)
	SetLastModified(time.Time)
	SetLink(rel, link string)
}

Meta is used to collect resource metadata from the response

type Metadata added in v1.1.1

type Metadata map[string][]string

Metadata is used to hold single or multi-value metadata from list responses

func (*Metadata) UnmarshalJSON added in v1.1.1

func (m *Metadata) UnmarshalJSON(b []byte) error

type Metric

type Metric struct {
	// The name of the metric.
	Name string `json:"name"`
	// The flag indicating this metric should be minimized.
	Minimize bool `json:"minimize,omitempty"`
}

type Optimization

type Optimization struct {
	// The estimated number of trial runs to perform for an experiment.
	ExperimentBudget int32 `json:"experimentBudget,omitempty"`
	// The total number of concurrent trial runs supported for an experiment.
	ParallelTrials int32 `json:"parallelTrials,omitempty"`
	// The total number of random trials used to start an experiment.
	BurnIn int32 `json:"burnIn,omitempty"`
}

type Parameter

type Parameter struct {
	// The name of the parameter.
	Name string `json:"name"`
	// The type of the parameter.
	Type ParameterType `json:"type"`
	// The domain of the parameter.
	Bounds Bounds `json:"bounds"`
}

Parameter is a variable that is going to be tuned in an experiment

type ParameterType

type ParameterType string
const (
	ParameterTypeInteger ParameterType = "int"
	ParameterTypeDouble                = "double"
)

type TrialAssignments

type TrialAssignments struct {
	TrialMeta

	// The list of parameter names and their assigned values.
	Assignments []Assignment `json:"assignments"`
}

type TrialItem

type TrialItem struct {
	TrialAssignments
	TrialValues

	// The current trial status.
	Status TrialStatus `json:"status"`
	// Ordinal number indicating when during an experiment the trail was generated.
	Number int64 `json:"number"`
	// Labels for this trial.
	Labels map[string]string `json:"labels,omitempty"`
}

type TrialList

type TrialList struct {
	// The list of trials.
	Trials []TrialItem `json:"trials"`
}

type TrialListQuery added in v1.2.0

type TrialListQuery struct {
	Status []TrialStatus
}

func (*TrialListQuery) Encode added in v1.2.0

func (p *TrialListQuery) Encode() string

type TrialMeta

type TrialMeta struct {
	ReportTrial string `json:"-"`
}

func (*TrialMeta) SetLastModified

func (m *TrialMeta) SetLastModified(time.Time)
func (m *TrialMeta) SetLink(string, string)

func (*TrialMeta) SetLocation

func (m *TrialMeta) SetLocation(location string)

type TrialStatus

type TrialStatus string

type TrialValues

type TrialValues struct {
	// The observed values.
	Values []Value `json:"values,omitempty"`
	// Indicator that the trial failed, Values is ignored when true.
	Failed bool `json:"failed,omitempty"`
}

type Value

type Value struct {
	// The name of the metric in the experiment the value corresponds to.
	MetricName string `json:"metricName"`
	// The observed value of the metric.
	Value float64 `json:"value"`
	//The observed error of the metric.
	Error float64 `json:"error,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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