Skip to content

Commit

Permalink
Fix typo (#233)
Browse files Browse the repository at this point in the history
* correct "purse" to "parse"

* correct "Doubel" to "Double"

* Update push-model.go

fix lowercase

* Update push-study.go

use lowercase
  • Loading branch information
ytetra authored and k8s-ci-robot committed Nov 5, 2018
1 parent 04837a4 commit 5e51974
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmd/cli/command/push-model.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func pushModel(cmd *cobra.Command, opt *pushModelOpt) {
buf, _ := ioutil.ReadFile(opt.file)
err = yaml.Unmarshal(buf, &req)
if err != nil {
log.Fatalf("Fail to Purse config: %v", err)
log.Fatalf("Fail to parse config: %v", err)
return
}
} else if len(opt.args) > 0 {
err := json.Unmarshal(([]byte)(opt.args[0]), &req)
if err != nil {
log.Fatalf("Fail to Purse input: %v", err)
log.Fatalf("Fail to parse input: %v", err)
return
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/command/push-study.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ func pushStudy(cmd *cobra.Command, opt *pushStudyOpt) {
buf, _ := ioutil.ReadFile(opt.file)
err = yaml.Unmarshal(buf, &in)
if err != nil {
log.Fatalf("Fail to Purse config: %v", err)
log.Fatalf("Fail to parse config: %v", err)
return
}
} else if len(opt.args) > 0 {
err := json.Unmarshal(([]byte)(opt.args[0]), &in)
if err != nil {
log.Fatalf("Fail to Purse input: %v", err)
log.Fatalf("Fail to parse input: %v", err)
return
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions pkg/earlystopping/medianstopping.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewMedianStoppingRule() *MedianStoppingRule {
return m
}

func (m *MedianStoppingRule) purseEarlyStoppingParameters(sc *api.StudyConfig, eps []*api.EarlyStoppingParameter) (*MedianStoppingParam, error) {
func (m *MedianStoppingRule) parseEarlyStoppingParameters(sc *api.StudyConfig, eps []*api.EarlyStoppingParameter) (*MedianStoppingParam, error) {
p := &MedianStoppingParam{LeastStep: defaultLeastStep, Margin: defaultMargin, EvalMetric: sc.ObjectiveValueName, BurnIn: defaultBurnIn}
for _, ep := range eps {
switch ep.Name {
Expand Down Expand Up @@ -145,7 +145,7 @@ func (m *MedianStoppingRule) GetShouldStopWorkers(ctx context.Context, in *api.G
if err != nil {
return &api.GetShouldStopWorkersReply{}, err
}
p, err := m.purseEarlyStoppingParameters(sc, eparam)
p, err := m.parseEarlyStoppingParameters(sc, eparam)
if err != nil {
return &api.GetShouldStopWorkersReply{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/suggestion/grid_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *GridSuggestService) setP(gci int, p [][]*api.Parameter, pg [][]string,
}
}

func (s *GridSuggestService) purseSuggestParam(suggestParam []*api.SuggestionParameter) (int, int, map[string]int) {
func (s *GridSuggestService) parseSuggestParam(suggestParam []*api.SuggestionParameter) (int, int, map[string]int) {
ret := make(map[string]int)
defaultGrid := 0
i := 0
Expand Down Expand Up @@ -161,7 +161,7 @@ func (s *GridSuggestService) GetSuggestions(ctx context.Context, in *api.GetSugg
log.Printf("GetParameter failed: %v", err)
return &api.GetSuggestionsReply{}, err
}
df, iteration, glist := s.purseSuggestParam(spr.SuggestionParameters)
df, iteration, glist := s.parseSuggestParam(spr.SuggestionParameters)
log.Printf("Study %s iteration %d DefaltGrid %d Grids %v", in.StudyId, iteration, df, glist)
grids := s.genGrids(in.StudyId, scr.StudyConfig.ParameterConfigs.Configs, df, glist)
var reqnum = int(in.RequestNumber)
Expand Down
8 changes: 4 additions & 4 deletions pkg/suggestion/hyperband_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (h *HyperBandSuggestService) makeMasterBracket(ctx context.Context, c api.M
case api.ParameterType_DOUBLE:
dmin, _ := strconv.ParseFloat(pc.Feasible.Min, 64)
dmax, _ := strconv.ParseFloat(pc.Feasible.Max, 64)
t.ParameterSet[j].Value = strconv.FormatFloat(h.DoubelRandom(dmin, dmax), 'f', 4, 64)
t.ParameterSet[j].Value = strconv.FormatFloat(h.DoubleRandom(dmin, dmax), 'f', 4, 64)
case api.ParameterType_CATEGORICAL:
t.ParameterSet[j].Value = pc.Feasible.List[h.IntRandom(0, len(pc.Feasible.List)-1)]
}
Expand Down Expand Up @@ -195,7 +195,7 @@ func (h *HyperBandSuggestService) makeChildBracket(ctx context.Context, c api.Ma
return tids, ts, nil
}

func (h *HyperBandSuggestService) purseSuggestionParameters(ctx context.Context, c api.ManagerClient, studyID string, sparam []*api.SuggestionParameter) (*HyperBandParameters, error) {
func (h *HyperBandSuggestService) parseSuggestionParameters(ctx context.Context, c api.ManagerClient, studyID string, sparam []*api.SuggestionParameter) (*HyperBandParameters, error) {
p := &HyperBandParameters{
eta: -1,
sMax: -1,
Expand Down Expand Up @@ -238,7 +238,7 @@ func (h *HyperBandSuggestService) purseSuggestionParameters(ctx context.Context,
}
}
if p.rL <= 0 || p.ResourceName == "" {
log.Printf("Failed to purse Suggestion Parameter. r_l and ResourceName must be set.")
log.Printf("Failed to parse Suggestion Parameter. r_l and ResourceName must be set.")
return nil, fmt.Errorf("Suggestion Parameter set Error")
}
if p.eta <= 0 {
Expand Down Expand Up @@ -418,7 +418,7 @@ func (h *HyperBandSuggestService) GetSuggestions(ctx context.Context, in *api.Ge
log.Fatalf("GetParameter failed: %v", err)
return &api.GetSuggestionsReply{}, err
}
hbparam, err := h.purseSuggestionParameters(ctx, c, in.StudyId, spr.SuggestionParameters)
hbparam, err := h.parseSuggestionParameters(ctx, c, in.StudyId, spr.SuggestionParameters)
if err != nil {
return &api.GetSuggestionsReply{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/suggestion/random_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewRandomSuggestService() *RandomSuggestService {
return &RandomSuggestService{}
}

func (s *RandomSuggestService) DoubelRandom(min, max float64) float64 {
func (s *RandomSuggestService) DoubleRandom(min, max float64) float64 {
if min == max {
return min
}
Expand Down Expand Up @@ -65,7 +65,7 @@ func (s *RandomSuggestService) GetSuggestions(ctx context.Context, in *api.GetSu
case api.ParameterType_DOUBLE:
dmin, _ := strconv.ParseFloat(pc.Feasible.Min, 64)
dmax, _ := strconv.ParseFloat(pc.Feasible.Max, 64)
sT[i].ParameterSet[j].Value = strconv.FormatFloat(s.DoubelRandom(dmin, dmax), 'f', 4, 64)
sT[i].ParameterSet[j].Value = strconv.FormatFloat(s.DoubleRandom(dmin, dmax), 'f', 4, 64)
case api.ParameterType_CATEGORICAL:
sT[i].ParameterSet[j].Value = pc.Feasible.List[s.IntRandom(0, len(pc.Feasible.List)-1)]
}
Expand Down

0 comments on commit 5e51974

Please sign in to comment.