Browse Source

Add knowledge base types definition

Signed-off-by: Jie Pu <i@jaypu.com>
tags/v0.6.0^2
Jie Pu 2 years ago
parent
commit
e1c920ac00
3 changed files with 59 additions and 7 deletions
  1. +43
    -3
      pkg/apis/sedna/v1alpha1/lifelonglearningjob_types.go
  2. +15
    -4
      pkg/globalmanager/runtime/types.go
  3. +1
    -0
      pkg/localcontroller/gmclient/types.go

+ 43
- 3
pkg/apis/sedna/v1alpha1/lifelonglearningjob_types.go View File

@@ -86,9 +86,47 @@ type LLDeploySpec struct {

// LifelongLearningJobList is a list of LifelongLearningJobs.
type LifelongLearningJobList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []LifelongLearningJob `json:"items"`
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []LifelongLearningJob `json:"items"`
OverallKBStatus OverallStatus `json:"overallStatus"`
OverallKBDetails KnowledgeBase `json:"overallKBStatus"`
}

type OverallStatus struct {
NumberOfUnseenSample int `json:"numberOfUnseenSample"`
NumberOfNewUnseenSample int `json:"numberOfNewUnseenSample"`
NumberOfAIModels int `json:"numberOfAIModels"`
PercentOfNewAIModels float32 `json:"percentOfNewAIModels"`
NumberOfClasses int `json:"numberOfClasses"`
PercentOfNewClasses float32 `json:"percentOfNewClasses"`
}

type KnowledgeBase struct {
AIModels AIModels `json:"AIModels"`
AIClasses AIClasses `json:"AIClasses"`
Samples Samples `json:"samples"`
}

type AIModels struct {
NumberOfAIModels int `json:"numberOfAIModels"`
ListOfAIModels []AIModel `json:"listOfAIModels,omitempty"`
}

type AIModel struct {
ModelID string `json:"modelID"`
AveragePrecision float32 `json:"averagePrecision"`
NumberOfTrainSamples int `json:"numberOfTrainSamples"`
}

type AIClasses struct {
NumberOfAIClasses int `json:"numberOfAIClasses"`
ListOfAIClasses []string `json:"listOfAIClasses,omitempty"`
}

type Samples struct {
NumberOfLabeledUnseenSample int `json:"numberOfLabeledUnseenSample"`
NumberOfUnseenSample int `json:"numberOfUnseenSample"`
}

// LLJobStatus represents the current state of a lifelonglearning job
@@ -97,6 +135,8 @@ type LLJobStatus struct {
// +optional
Conditions []LLJobCondition `json:"conditions,omitempty"`

KnowledgeBase KnowledgeBase `json:"knowledgeBase,omitempty"`

// Represents time when the job was acknowledged by the job controller.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.


+ 15
- 4
pkg/globalmanager/runtime/types.go View File

@@ -55,12 +55,23 @@ const (
)

type Model struct {
Format string `json:"format"`
URL string `json:"url"`
Devices []string `json:"device_soc_versions,omitempty"`
Metrics map[string]interface{} `json:"metrics,omitempty"`
Format string `json:"format"`
URL string `json:"url"`
Devices []string `json:"device_soc_versions,omitempty"`
Metrics map[string]interface{} `json:"metrics,omitempty"`
HistoryMetric float32 `json:"history_metric,omitempty"`
CurrentMetric map[string]ModelMetric `json:"current_metric,omitempty"`
Classes []string `json:"classes"`
NumberOfLabeledUnseenSample int `json:"number_of_labeled_unseen_sample,omitempty"`
NumberOfModel int `json:"number_of_model,omitempty"`
NumberOfUnseenSample int `json:"number_of_unseen_sample,omitempty"`
}

// ModelMetric map of "metric_name": "metric_value"
// example:
// {"mIoU": 0.2222, "acc", 0.1111}
type ModelMetric map[string]float32

func (m *Model) GetURL() string {
return m.URL
}


+ 1
- 0
pkg/localcontroller/gmclient/types.go View File

@@ -57,6 +57,7 @@ type Input struct {
}

type Output struct {
// All the TaskInfo has been writen to "Model"
Models []map[string]interface{} `json:"models"`
OwnerInfo map[string]interface{} `json:"ownerInfo"`
}


Loading…
Cancel
Save