Skip to content

Commit

Permalink
convertFeasibleSpace fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Shashank Mittal <[email protected]>
  • Loading branch information
shashank-iitbhu committed Aug 15, 2024
1 parent 375e107 commit a3e6c72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,23 @@ func convertParameterType(typ experimentsv1beta1.ParameterType) suggestionapi.Pa
}

func convertFeasibleSpace(fs experimentsv1beta1.FeasibleSpace) *suggestionapi.FeasibleSpace {
res := &suggestionapi.FeasibleSpace{
distribution := convertDistribution(fs.Distribution)
if distribution == suggestionapi.Distribution_DISTRIBUTION_UNKNOWN {
return &suggestionapi.FeasibleSpace{
Max: fs.Max,
Min: fs.Min,
List: fs.List,
Step: fs.Step,
}
}

return &suggestionapi.FeasibleSpace{
Max: fs.Max,
Min: fs.Min,
List: fs.List,
Step: fs.Step,
Distribution: convertDistribution(fs.Distribution),
Distribution: distribution,
}
return res
}

func convertDistribution(typ experimentsv1beta1.Distribution) suggestionapi.Distribution {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,23 +597,6 @@ func TestConvertFeasibleSpace(t *testing.T) {
},
testDescription: "Convert feasible space with normal distribution",
},
{
inFeasibleSpace: experimentsv1beta1.FeasibleSpace{
Max: "1.0",
Min: "0.1",
List: nil,
Step: "0.05",
Distribution: experimentsv1beta1.DistributionUnknown,
},
expectedFeasibleSpace: &suggestionapi.FeasibleSpace{
Max: "1.0",
Min: "0.1",
List: nil,
Step: "0.05",
Distribution: suggestionapi.Distribution_DISTRIBUTION_UNKNOWN,
},
testDescription: "Convert feasible space with unknown distribution",
},
}

for _, tc := range tcs {
Expand Down

0 comments on commit a3e6c72

Please sign in to comment.