Skip to content

Commit

Permalink
Merge pull request #142 from c-bata/reduce-report
Browse files Browse the repository at this point in the history
Reduce the count of reporting intermediate values.
  • Loading branch information
c-bata authored Jul 28, 2020
2 parents 8d81696 + 0e9e9e6 commit 3644851
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions _examples/gorgonia_iris/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func main() {
storage := rdb.NewStorage(db)

pruner, _ := successivehalving.NewPruner(
successivehalving.OptionSetMinResource(100),
successivehalving.OptionSetReductionFactor(3))
study, err := goptuna.CreateStudy(
"gorgonia-iris",
Expand Down Expand Up @@ -136,11 +135,13 @@ func objective(trial goptuna.Trial) (float64, error) {
return 0, err
}
acc = accuracy(predicted.Data().([]float64), Y.Value().Data().([]float64))
machine.Reset() // Reset is necessary in a loop like this

if err := trial.ShouldPrune(i, acc); err != nil {
return acc, err
if i%100 == 0 {
if err := trial.ShouldPrune(i, acc); err != nil {
return acc, err
}
}
machine.Reset() // Reset is necessary in a loop like this
}
return acc, nil
}
Expand Down

0 comments on commit 3644851

Please sign in to comment.