Documentation
¶
Index ¶
- Variables
- func ArtifactIDMap(artifacts []Artifact) map[string]Artifact
- func ArtifactIDs(artifacts []Artifact) []string
- func IsValidContentType(contentType string) bool
- func NewAlreadyInUseErr(s string) error
- func NewBadRequest(s string) error
- func NewInternalErr(s string) error
- func NewInvalidInputErr(s string) error
- func NewNotFoundErr(s string) error
- func NormalizeID(s string) string
- func ParseVal(s string) any
- func UniqueMetrics(runs []*Run) []string
- type Artifact
- type CheckpointArtifact
- type ContentType
- type Experiment
- type ExperimentInfo
- type GenericMetric
- func (s *GenericMetric[T]) Add(v T)
- func (s *GenericMetric[T]) AddVal(v any)
- func (s *GenericMetric[T]) Commit()
- func (s *GenericMetric[T]) LastVal() any
- func (s GenericMetric[T]) Name() string
- func (s *GenericMetric[T]) SetVals(vs []any)
- func (s *GenericMetric[T]) Type() MetricType
- func (s *GenericMetric[T]) UnCommited() []T
- func (s GenericMetric[T]) Vals() []any
- func (s GenericMetric[T]) ValsToCommit() []any
- type Metric
- type MetricType
- type ModelEntry
- type ModelRegistry
- func (m *ModelRegistry) Add(url string, tags ...string)
- func (m *ModelRegistry) AddTag(tag string, version int) error
- func (m ModelRegistry) LastModel() ModelEntry
- func (m ModelRegistry) LatestVersion() int
- func (m ModelRegistry) MarshalEntries() ([][]byte, error)
- func (m ModelRegistry) ModelByTag(tag string) (ModelEntry, error)
- func (m ModelRegistry) ModelByVersion(version int) (ModelEntry, error)
- func (m ModelRegistry) ModelsByTag(tag string) ([]ModelEntry, error)
- func (m ModelRegistry) VersionTag(version int) string
- type PlainTextArtifact
- type Run
- type SavedArtifact
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ArtifactIDMap ¶
func ArtifactIDs ¶
func IsValidContentType ¶
func NewAlreadyInUseErr ¶
func NewBadRequest ¶
func NewInternalErr ¶
func NewInvalidInputErr ¶
func NewNotFoundErr ¶
func NormalizeID ¶
func UniqueMetrics ¶
UniqueMetrics returns all distinct/unique metric names ids from a slice of runs.
Types ¶
type Artifact ¶
type Artifact interface {
Name() string
Content() []byte
ContentType() ContentType
}
type CheckpointArtifact ¶
func (CheckpointArtifact) Content ¶
func (c CheckpointArtifact) Content() []byte
func (CheckpointArtifact) ContentType ¶
func (c CheckpointArtifact) ContentType() ContentType
func (CheckpointArtifact) Name ¶
func (c CheckpointArtifact) Name() string
type ContentType ¶
type ContentType string
const ( TextContentType ContentType = "content-type/text" ModelContentType ContentType = "content-type/model" )
type Experiment ¶
type ExperimentInfo ¶
type ExperimentInfo struct {
Description string `redis:"Description"`
}
ExperimentInfo is struct that represent additional (user-set) information on an experiment.
func NewExperimentInfo ¶
func NewExperimentInfo(m map[string]string) ExperimentInfo
NewExperimentInfo creates an ExperimentInfo struct from the provided hasmap.
type GenericMetric ¶
type GenericMetric[T cmp.Ordered] struct { Key string Values []T // contains filtered or unexported fields }
func NewGenericMetric ¶
func NewGenericMetric[T cmp.Ordered](key string, sizeAlloc int) *GenericMetric[T]
func (*GenericMetric[T]) Add ¶
func (s *GenericMetric[T]) Add(v T)
func (*GenericMetric[T]) AddVal ¶
func (s *GenericMetric[T]) AddVal(v any)
func (*GenericMetric[T]) Commit ¶
func (s *GenericMetric[T]) Commit()
func (*GenericMetric[T]) LastVal ¶
func (s *GenericMetric[T]) LastVal() any
func (GenericMetric[T]) Name ¶
func (s GenericMetric[T]) Name() string
func (*GenericMetric[T]) SetVals ¶
func (s *GenericMetric[T]) SetVals(vs []any)
func (*GenericMetric[T]) Type ¶
func (s *GenericMetric[T]) Type() MetricType
Type infers the MetricType using reflection. If the metric has multiple values it can either be a ContinuousMetric (numerical) or a MultiValueMetric. In the case where no value is present or a single value is present, it can be SingleMetric or SingleNumericMetric.
func (*GenericMetric[T]) UnCommited ¶
func (s *GenericMetric[T]) UnCommited() []T
func (GenericMetric[T]) Vals ¶
func (s GenericMetric[T]) Vals() []any
func (GenericMetric[T]) ValsToCommit ¶
func (s GenericMetric[T]) ValsToCommit() []any
type MetricType ¶
type MetricType string
const ( ContinuousMetric MetricType = "metric/continuous" MultiValueMetric MetricType = "metric/multival" SingleNumericMetric MetricType = "metric/single-numeric" SingleMetric MetricType = "metric/single" ComplexMetric MetricType = "metric/complex" )
func CollectMetric ¶
func CollectMetric(runs []*Run, metric string) (map[string]any, MetricType)
CollectMetric aggregates all values of a metric present in a slice of runs. Returns a key-value map of runIds (keys) and metric values.
type ModelEntry ¶
type ModelRegistry ¶
type ModelRegistry struct {
Name string
Models []ModelEntry
Tags map[string][]int
Timestamp time.Time
}
func NewModelRegistry ¶
func NewModelRegistry(name string) *ModelRegistry
func NewModelRegistryWithTime ¶
func NewModelRegistryWithTime(name string, t time.Time) *ModelRegistry
func (*ModelRegistry) Add ¶
func (m *ModelRegistry) Add(url string, tags ...string)
Add registers a model checkpoint with a highest version number. Additional tags can be supplied such (`latest`, `prod`, `dev`).
func (ModelRegistry) LastModel ¶
func (m ModelRegistry) LastModel() ModelEntry
func (ModelRegistry) LatestVersion ¶
func (m ModelRegistry) LatestVersion() int
func (ModelRegistry) MarshalEntries ¶
func (m ModelRegistry) MarshalEntries() ([][]byte, error)
func (ModelRegistry) ModelByTag ¶
func (m ModelRegistry) ModelByTag(tag string) (ModelEntry, error)
func (ModelRegistry) ModelByVersion ¶
func (m ModelRegistry) ModelByVersion(version int) (ModelEntry, error)
func (ModelRegistry) ModelsByTag ¶
func (m ModelRegistry) ModelsByTag(tag string) ([]ModelEntry, error)
func (ModelRegistry) VersionTag ¶
func (m ModelRegistry) VersionTag(version int) string
type PlainTextArtifact ¶
func (PlainTextArtifact) Content ¶
func (p PlainTextArtifact) Content() []byte
func (PlainTextArtifact) ContentType ¶
func (p PlainTextArtifact) ContentType() ContentType
func (PlainTextArtifact) Name ¶
func (p PlainTextArtifact) Name() string
type Run ¶
type Run struct {
Name string
Timestamp time.Time
ExperimentID string
Color string
Metrics map[string]Metric
Artifacts map[string]Artifact
}
Run struct holds all data (information, metrics, artifacts) related to a run.
func NewRun ¶
NewRun initializes a new run with a name and an experiment id. The supplied name is normalized to avoid whitespace.
func (*Run) AddAritifact ¶
AddAritifact adds a new artifact to the run. Retruns a non-nil error if the supplied name is already in use `ErrAlreadyInUse`.
func (*Run) AddMetric ¶
AddMetric adds a new metric with a name. returns an error if the metric name is already in use `ErrAlreadyInUse`.
func (*Run) ArtifactsSlice ¶
type SavedArtifact ¶
type SavedArtifact struct {
Name string
ContentType ContentType
S3Key string
}