Documentation
¶
Overview ¶
Copyright 2019 GramLabs, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type API
- type Assignment
- type Bounds
- type Error
- type ErrorType
- type Experiment
- type ExperimentItem
- type ExperimentList
- type ExperimentListMeta
- type ExperimentListQuery
- type ExperimentMeta
- type ExperimentName
- type Meta
- type Metric
- type Optimization
- type Parameter
- type ParameterType
- type TrialAssignments
- type TrialItem
- type TrialList
- type TrialMeta
- type TrialStatus
- type TrialValues
- type Value
Constants ¶
const ( ErrExperimentNameInvalid ErrorType = "experiment-name-invalid" ErrExperimentNameConflict = "experiment-name-conflict" ErrExperimentInvalid = "experiment-invalid" ErrExperimentNotFound = "experiment-not-found" ErrExperimentStopped = "experiment-stopped" ErrTrialInvalid = "trial-invalid" ErrTrialNotFound = "trial-not-found" )
const ( TrialStaged TrialStatus = "staged" TrialActive = "active" TrialCompleted = "completed" TrialFailed = "failed" )
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) (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
}
API provides bindings for the supported endpoints
type Assignment ¶
type Error ¶
Error represents the API specific error messages and may be used in response to HTTP status codes
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 absolute URL used to reference the individual experiment.
ItemRef string `json:"itemRef,omitempty"`
}
type ExperimentList ¶
type ExperimentList struct {
ExperimentListMeta
// The list of experiments.
Experiments []ExperimentItem `json:"experiments,omitempty"`
}
type ExperimentListMeta ¶
func (*ExperimentListMeta) SetLastModified ¶
func (m *ExperimentListMeta) SetLastModified(time.Time)
func (*ExperimentListMeta) SetLink ¶
func (m *ExperimentListMeta) SetLink(rel, link string)
func (*ExperimentListMeta) SetLocation ¶
func (m *ExperimentListMeta) SetLocation(string)
type ExperimentListQuery ¶
func (*ExperimentListQuery) Encode ¶
func (p *ExperimentListQuery) Encode() string
type ExperimentMeta ¶
type ExperimentMeta struct {
Self string `json:"-"`
Trials string `json:"-"`
NextTrial string `json:"-"`
}
func (*ExperimentMeta) SetLastModified ¶
func (m *ExperimentMeta) SetLastModified(time.Time)
func (*ExperimentMeta) SetLink ¶
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 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"`
// Labels for this trial.
Labels map[string]string `json:"labels"`
}
type TrialList ¶
type TrialList struct {
// The list of trials.
Trials []TrialItem `json:"trials"`
}
type TrialMeta ¶
type TrialMeta struct {
ReportTrial string `json:"-"`
}
func (*TrialMeta) SetLastModified ¶
func (*TrialMeta) SetLocation ¶
type TrialStatus ¶
type TrialStatus string