# How to get all candidates and their scores during optimization?

**URL:** https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291
**Category:** Arbiter
**Created:** [March 19, 2020, 4:33am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291 "2020-03-19T04:33:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![taufikalhkm](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/taufikalhkm/32/99_2.png) [@taufikalhkm](https://community.konduit.ai/u/taufikalhkm)
#### Post date: [March 19, 2020, 4:33am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/1 "2020-03-19T04:33:18Z")

</div>

i was trying to extract the Hyperparameter combination with it’s loss/score. is it possible to do so? i want to inspect all possible combination and its losses  
what kind of command i can use?

i am using DL4j-example repository with specific model on  
BasicHyperparameterOptimizationExample.java

[https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/arbiter](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/arbiter)

have been using getResult() getResultModel() on the list object of ResultReference type.

Thanks in Advance

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [March 19, 2020, 9:13am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/2 "2020-03-19T09:13:06Z")

</div>

Do I understand you correctly, you want to access each tested candidate, not only the best one?

---

<div class="post-metadata">

### Author: ![taufikalhkm](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/taufikalhkm/32/99_2.png) [@taufikalhkm](https://community.konduit.ai/u/taufikalhkm)
#### Post date: [March 19, 2020, 9:59am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/3 "2020-03-19T09:59:20Z")

</div>

yes, i want all candidate not only the best one.  
the focus is only on the hyperparameter that is being tuned and the score.

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [March 19, 2020, 11:01am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/4 "2020-03-19T11:01:19Z")

</div>

You can’t get all candidates after the training is done, keeping them all can take a lot of memory.  
But, if you want to collect them yourself, you can do this by implementing the [StatusListener Interface](https://deeplearning4j.org/api/latest/org/deeplearning4j/arbiter/optimize/runner/listener/StatusListener.html).

---

<div class="post-metadata">

### Author: ![printomi](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/printomi/32/129_2.png) [@printomi](https://community.konduit.ai/u/printomi)
#### Post date: [March 26, 2020, 8:52pm UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/5 "2020-03-26T20:52:13Z")

</div>

Yes, you can get all candidates. Optimization uses `ResultSaver` interface to save all candidates generated, and you can use `ResultReference` interface to read the candidates after the optimization is done.  
I have used these interfaces to write model structures and result scores to a database.  
But if you just want to read the results in Java code, you may be fine with the file based implementation `FileModelSaver` and `LocalFileNetResultReference` that is used in the example.  
See [LocalFileNetResultReference](https://github.com/eclipse/deeplearning4j/blob/master/arbiter/arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/saver/local/LocalFileNetResultReference.java) and [FileModelSaver](https://github.com/eclipse/deeplearning4j/blob/master/arbiter/arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/saver/local/FileModelSaver.java)

---

<div class="post-metadata">

### Author: ![taufikalhkm](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/taufikalhkm/32/99_2.png) [@taufikalhkm](https://community.konduit.ai/u/taufikalhkm)
#### Post date: [March 27, 2020, 3:42am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/6 "2020-03-27T03:42:38Z")

</div>

Thanks for the help, yes have been using the [StatusListener Interface](https://deeplearning4j.org/api/latest/org/deeplearning4j/arbiter/optimize/runner/listener/StatusListener.html?_ga=2.193132333.1659008090.1585280409-362135157.1584343180). I might take a look on the file saved based on `FileModelSaver`

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [March 27, 2020, 7:18am UTC](https://community.konduit.ai/t/how-to-get-all-candidates-and-their-scores-during-optimization/291/7 "2020-03-27T07:18:58Z")

</div>

> [@printomi](#):
>
> Yes, you can get all candidates. Optimization uses `ResultSaver` interface to save all candidates generated, and you can use `ResultReference` interface to read the candidates after the optimization is done.

You are actually right, I somehow missed that ResultSaver actually does get to save each model. Thank you very much for correcting me.
