Versions in this module Expand all Collapse all v0 v0.8.2 Oct 29, 2020 v0.8.1 Oct 29, 2020 v0.8.0 Oct 27, 2020 Changes in this version + const CategoricalDistributionName + const DiscreteUniformDistributionName + const InMemoryStorageStudyID + const InMemoryStorageStudyUUID + const IntUniformDistributionName + const LogUniformDistributionName + const StepIntUniformDistributionName + const UniformDistributionName + var DefaultStudyNamePrefix = "no-name-" + var ErrDeleteNonFinishedTrial = errors.New("non finished trial is deleted") + var ErrInvalidStudyID = errors.New("invalid study id") + var ErrInvalidTrialID = errors.New("invalid trial id") + var ErrNoCompletedTrials = errors.New("no trials are completed yet") + var ErrTrialAlreadyDeleted = errors.New("trial is already deleted") + var ErrTrialCannotBeUpdated = errors.New("trial cannot be updated") + var ErrTrialPruned = errors.New("trial is pruned") + var ErrTrialsPartiallyDeleted = errors.New("some trials are already deleted") + var ErrUnknownDistribution = errors.New("unknown distribution") + var ErrUnsupportedSearchSpace = errors.New("unsupported search space") + var NewRandomSearchSampler = NewRandomSampler + var RandomSearchSamplerOptionSeed = RandomSamplerOptionSeed + var StudyOptionSetDirection = StudyOptionDirection + var StudyOptionSetLogger = StudyOptionLogger + var StudyOptionSetTrialNotifyChannel = StudyOptionTrialNotifyChannel + func DeleteStudy(name string, storage Storage) error + func DistributionIsSingle(distribution interface{}) (bool, error) + func DistributionToJSON(distribution interface{}) ([]byte, error) + func IntersectionSearchSpace(study *Study) (map[string]interface{}, error) + func JSONToDistribution(jsonBytes []byte) (interface{}, error) + func ToExternalRepresentation(distribution interface{}, ir float64) (interface{}, error) + type BlackHoleStorage struct + func NewBlackHoleStorage(n int) *BlackHoleStorage + func (s *BlackHoleStorage) CloneTrial(studyID int, baseTrial FrozenTrial) (int, error) + func (s *BlackHoleStorage) CreateNewStudy(name string) (int, error) + func (s *BlackHoleStorage) CreateNewTrial(studyID int) (int, error) + func (s *BlackHoleStorage) DeleteStudy(studyID int) error + func (s *BlackHoleStorage) GetAllStudySummaries() ([]StudySummary, error) + func (s *BlackHoleStorage) GetAllTrials(studyID int) ([]FrozenTrial, error) + func (s *BlackHoleStorage) GetBestTrial(studyID int) (FrozenTrial, error) + func (s *BlackHoleStorage) GetStudyDirection(studyID int) (StudyDirection, error) + func (s *BlackHoleStorage) GetStudyIDFromName(name string) (int, error) + func (s *BlackHoleStorage) GetStudyIDFromTrialID(trialID int) (int, error) + func (s *BlackHoleStorage) GetStudyNameFromID(studyID int) (string, error) + func (s *BlackHoleStorage) GetStudySystemAttrs(studyID int) (map[string]string, error) + func (s *BlackHoleStorage) GetStudyUserAttrs(studyID int) (map[string]string, error) + func (s *BlackHoleStorage) GetTrial(trialID int) (FrozenTrial, error) + func (s *BlackHoleStorage) GetTrialNumberFromID(trialID int) (int, error) + func (s *BlackHoleStorage) GetTrialParam(trialID int, paramName string) (float64, error) + func (s *BlackHoleStorage) GetTrialParams(trialID int) (map[string]interface{}, error) + func (s *BlackHoleStorage) GetTrialSystemAttrs(trialID int) (map[string]string, error) + func (s *BlackHoleStorage) GetTrialUserAttrs(trialID int) (map[string]string, error) + func (s *BlackHoleStorage) SetStudyDirection(studyID int, direction StudyDirection) error + func (s *BlackHoleStorage) SetStudySystemAttr(studyID int, key string, value string) error + func (s *BlackHoleStorage) SetStudyUserAttr(studyID int, key string, value string) error + func (s *BlackHoleStorage) SetTrialIntermediateValue(trialID int, step int, value float64) error + func (s *BlackHoleStorage) SetTrialParam(trialID int, paramName string, paramValueInternal float64, ...) error + func (s *BlackHoleStorage) SetTrialState(trialID int, state TrialState) error + func (s *BlackHoleStorage) SetTrialSystemAttr(trialID int, key string, value string) error + func (s *BlackHoleStorage) SetTrialUserAttr(trialID int, key string, value string) error + func (s *BlackHoleStorage) SetTrialValue(trialID int, value float64) error + type CategoricalDistribution struct + Choices []string + func (d *CategoricalDistribution) Contains(ir float64) bool + func (d *CategoricalDistribution) Single() bool + func (d *CategoricalDistribution) ToExternalRepr(ir float64) interface{} + type DiscreteUniformDistribution struct + High float64 + Low float64 + Q float64 + func (d *DiscreteUniformDistribution) Contains(ir float64) bool + func (d *DiscreteUniformDistribution) Single() bool + func (d *DiscreteUniformDistribution) ToExternalRepr(ir float64) interface{} + type Distribution interface + Contains func(float64) bool + Single func() bool + ToExternalRepr func(float64) interface{} + type FrozenTrial struct + DatetimeComplete time.Time + DatetimeStart time.Time + Distributions map[string]interface{} + ID int + IntermediateValues map[int]float64 + InternalParams map[string]float64 + Number int + Params map[string]interface{} + State TrialState + StudyID int + SystemAttrs map[string]string + UserAttrs map[string]string + Value float64 + func (t FrozenTrial) GetLatestStep() (step int, exist bool) + type FuncObjective func(trial Trial) (float64, error) + type InMemoryStorage struct + func NewInMemoryStorage() *InMemoryStorage + func (s *InMemoryStorage) CloneTrial(studyID int, baseTrial FrozenTrial) (int, error) + func (s *InMemoryStorage) CreateNewStudy(name string) (int, error) + func (s *InMemoryStorage) CreateNewTrial(studyID int) (int, error) + func (s *InMemoryStorage) DeleteStudy(studyID int) error + func (s *InMemoryStorage) GetAllStudySummaries() ([]StudySummary, error) + func (s *InMemoryStorage) GetAllTrials(studyID int) ([]FrozenTrial, error) + func (s *InMemoryStorage) GetBestTrial(studyID int) (FrozenTrial, error) + func (s *InMemoryStorage) GetStudyDirection(studyID int) (StudyDirection, error) + func (s *InMemoryStorage) GetStudyIDFromName(name string) (int, error) + func (s *InMemoryStorage) GetStudyIDFromTrialID(trialID int) (int, error) + func (s *InMemoryStorage) GetStudyNameFromID(studyID int) (string, error) + func (s *InMemoryStorage) GetStudySystemAttrs(studyID int) (map[string]string, error) + func (s *InMemoryStorage) GetStudyUserAttrs(studyID int) (map[string]string, error) + func (s *InMemoryStorage) GetTrial(trialID int) (FrozenTrial, error) + func (s *InMemoryStorage) GetTrialNumberFromID(trialID int) (int, error) + func (s *InMemoryStorage) GetTrialParam(trialID int, paramName string) (float64, error) + func (s *InMemoryStorage) GetTrialParams(trialID int) (map[string]interface{}, error) + func (s *InMemoryStorage) GetTrialSystemAttrs(trialID int) (map[string]string, error) + func (s *InMemoryStorage) GetTrialUserAttrs(trialID int) (map[string]string, error) + func (s *InMemoryStorage) SetStudyDirection(studyID int, direction StudyDirection) error + func (s *InMemoryStorage) SetStudySystemAttr(studyID int, key string, value string) error + func (s *InMemoryStorage) SetStudyUserAttr(studyID int, key string, value string) error + func (s *InMemoryStorage) SetTrialIntermediateValue(trialID int, step int, value float64) error + func (s *InMemoryStorage) SetTrialParam(trialID int, paramName string, paramValueInternal float64, ...) error + func (s *InMemoryStorage) SetTrialState(trialID int, state TrialState) error + func (s *InMemoryStorage) SetTrialSystemAttr(trialID int, key string, value string) error + func (s *InMemoryStorage) SetTrialUserAttr(trialID int, key string, value string) error + func (s *InMemoryStorage) SetTrialValue(trialID int, value float64) error + type IntUniformDistribution struct + High int + Low int + func (d *IntUniformDistribution) Contains(ir float64) bool + func (d *IntUniformDistribution) Single() bool + func (d *IntUniformDistribution) ToExternalRepr(ir float64) interface{} + type LogUniformDistribution struct + High float64 + Low float64 + func (d *LogUniformDistribution) Contains(ir float64) bool + func (d *LogUniformDistribution) Single() bool + func (d *LogUniformDistribution) ToExternalRepr(ir float64) interface{} + type Logger interface + Debug func(msg string, fields ...interface{}) + Error func(msg string, fields ...interface{}) + Info func(msg string, fields ...interface{}) + Warn func(msg string, fields ...interface{}) + type LoggerLevel int + const LoggerLevelDebug + const LoggerLevelError + const LoggerLevelInfo + const LoggerLevelWarn + type Pruner interface + Prune func(study *Study, trial FrozenTrial) (bool, error) + type RandomSampler struct + func NewRandomSampler(opts ...RandomSamplerOption) *RandomSampler + func (s *RandomSampler) Sample(study *Study, trial FrozenTrial, paramName string, ...) (float64, error) + type RandomSamplerOption func(sampler *RandomSampler) + func RandomSamplerOptionSeed(seed int64) RandomSamplerOption + type RandomSearchSampler RandomSampler + type RandomSearchSamplerOption RandomSamplerOption + type RelativeSampler interface + SampleRelative func(*Study, FrozenTrial, map[string]interface{}) (map[string]float64, error) + type Sampler interface + Sample func(*Study, FrozenTrial, string, interface{}) (float64, error) + type StdLogger struct + Color bool + Level LoggerLevel + Logger *log.Logger + func (l *StdLogger) Debug(msg string, fields ...interface{}) + func (l *StdLogger) Error(msg string, fields ...interface{}) + func (l *StdLogger) Info(msg string, fields ...interface{}) + func (l *StdLogger) Warn(msg string, fields ...interface{}) + type StepIntUniformDistribution struct + High int + Low int + Step int + func (d *StepIntUniformDistribution) Contains(ir float64) bool + func (d *StepIntUniformDistribution) Single() bool + func (d *StepIntUniformDistribution) ToExternalRepr(ir float64) interface{} + type Storage interface + CloneTrial func(studyID int, baseTrial FrozenTrial) (int, error) + CreateNewStudy func(name string) (int, error) + CreateNewTrial func(studyID int) (int, error) + DeleteStudy func(studyID int) error + GetAllStudySummaries func() ([]StudySummary, error) + GetAllTrials func(studyID int) ([]FrozenTrial, error) + GetBestTrial func(studyID int) (FrozenTrial, error) + GetStudyDirection func(studyID int) (StudyDirection, error) + GetStudyIDFromName func(name string) (int, error) + GetStudyIDFromTrialID func(trialID int) (int, error) + GetStudyNameFromID func(studyID int) (string, error) + GetStudySystemAttrs func(studyID int) (map[string]string, error) + GetStudyUserAttrs func(studyID int) (map[string]string, error) + GetTrial func(trialID int) (FrozenTrial, error) + GetTrialNumberFromID func(trialID int) (int, error) + GetTrialParam func(trialID int, paramName string) (float64, error) + GetTrialParams func(trialID int) (map[string]interface{}, error) + GetTrialSystemAttrs func(trialID int) (map[string]string, error) + GetTrialUserAttrs func(trialID int) (map[string]string, error) + SetStudyDirection func(studyID int, direction StudyDirection) error + SetStudySystemAttr func(studyID int, key string, value string) error + SetStudyUserAttr func(studyID int, key string, value string) error + SetTrialIntermediateValue func(trialID int, step int, value float64) error + SetTrialParam func(trialID int, paramName string, paramValueInternal float64, ...) error + SetTrialState func(trialID int, state TrialState) error + SetTrialSystemAttr func(trialID int, key string, value string) error + SetTrialUserAttr func(trialID int, key string, value string) error + SetTrialValue func(trialID int, value float64) error + type Study struct + ID int + Pruner Pruner + RelativeSampler RelativeSampler + Sampler Sampler + Storage Storage + func CreateStudy(name string, opts ...StudyOption) (*Study, error) + func LoadStudy(name string, opts ...StudyOption) (*Study, error) + func (s *Study) Direction() StudyDirection + func (s *Study) EnqueueTrial(internalParams map[string]float64) error + func (s *Study) GetBestParams() (map[string]interface{}, error) + func (s *Study) GetBestValue() (float64, error) + func (s *Study) GetLogger() Logger + func (s *Study) GetSystemAttrs() (map[string]string, error) + func (s *Study) GetTrials() ([]FrozenTrial, error) + func (s *Study) GetUserAttrs() (map[string]string, error) + func (s *Study) Optimize(objective FuncObjective, evaluateMax int) error + func (s *Study) SetSystemAttr(key, value string) error + func (s *Study) SetUserAttr(key, value string) error + func (s *Study) WithContext(ctx context.Context) + type StudyDirection string + const StudyDirectionMaximize + const StudyDirectionMinimize + type StudyOption func(study *Study) error + func StudyOptionDefineSearchSpace(space map[string]interface{}) StudyOption + func StudyOptionDirection(direction StudyDirection) StudyOption + func StudyOptionIgnoreError(ignore bool) StudyOption + func StudyOptionLoadIfExists(loadIfExists bool) StudyOption + func StudyOptionLogger(logger Logger) StudyOption + func StudyOptionPruner(pruner Pruner) StudyOption + func StudyOptionRelativeSampler(sampler RelativeSampler) StudyOption + func StudyOptionSampler(sampler Sampler) StudyOption + func StudyOptionStorage(storage Storage) StudyOption + func StudyOptionTrialNotifyChannel(notify chan FrozenTrial) StudyOption + type StudySummary struct + BestTrial FrozenTrial + DatetimeStart time.Time + Direction StudyDirection + ID int + Name string + SystemAttrs map[string]string + UserAttrs map[string]string + type Trial struct + ID int + Study *Study + func (t *Trial) CallRelativeSampler() error + func (t *Trial) GetContext() context.Context + func (t *Trial) GetSystemAttrs() (map[string]string, error) + func (t *Trial) GetUserAttrs() (map[string]string, error) + func (t *Trial) Number() (int, error) + func (t *Trial) SetSystemAttr(key, value string) error + func (t *Trial) SetUserAttr(key, value string) error + func (t *Trial) ShouldPrune(step int, value float64) error + func (t *Trial) SuggestCategorical(name string, choices []string) (string, error) + func (t *Trial) SuggestDiscreteFloat(name string, low, high, q float64) (float64, error) + func (t *Trial) SuggestDiscreteUniform(name string, low, high, q float64) (float64, error) + func (t *Trial) SuggestFloat(name string, low, high float64) (float64, error) + func (t *Trial) SuggestInt(name string, low, high int) (int, error) + func (t *Trial) SuggestLogFloat(name string, low, high float64) (float64, error) + func (t *Trial) SuggestLogUniform(name string, low, high float64) (float64, error) + func (t *Trial) SuggestStepInt(name string, low, high, step int) (int, error) + func (t *Trial) SuggestUniform(name string, low, high float64) (float64, error) + type TrialState int + const TrialStateComplete + const TrialStateFail + const TrialStatePruned + const TrialStateRunning + const TrialStateWaiting + func (i TrialState) IsFinished() bool + func (i TrialState) String() string + type UniformDistribution struct + High float64 + Low float64 + func (d *UniformDistribution) Contains(ir float64) bool + func (d *UniformDistribution) Single() bool + func (d *UniformDistribution) ToExternalRepr(ir float64) interface{}