# Run.history() returns different values on almost each call

**URL:** <https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431>\
**Category:** W&B Help\
**Tags:** dashboard, wandb\
**Created:** [May 16, 2022, 3:00pm UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431 "2022-05-16T15:00:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carloshernandezp](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/carloshernandezp/32/806_2.png) [@carloshernandezp](https://community.wandb.ai/u/carloshernandezp)\
**Post date:** [May 16, 2022, 3:00pm UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431/1 "2022-05-16T15:00:29Z")

</div>

I recently started using the `wandb.Api()` in order not to manually download all the Charts in `.csv` format.

The problem is that I cannot get consistent results, most of the times that I call the API in a jupyter-notebook I get different results.

I have made public one of my dashboards to tackle this issue. Here is a screenshot with a reproducible example:

 ![2022-05-16-165542_647x517_scrot](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/3bd006338d2541c672c4bf4c2f5e60aa6144e60c.png)

In order to obtain the `csv_val_f1` variable one just needs to download the `Val F1` chart. Two things can be seen here:

1. Multiple runs of the same code produce different results
2. The maximum value obtained by the API differs from the maximum value obtained by manually downloading the `.csv` version of the Chart.

Any ideas on what I’m missing?

---

<div class="post-metadata">

**Author:** ![jaeheelee](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaeheelee](https://community.wandb.ai/u/jaeheelee)\
**Post date:** [May 27, 2022, 6:59am UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431/2 "2022-05-27T06:59:45Z")

</div>

I am experiencing the same issue.  
I wanted to generate matplotlib plots using the API, but run.history() shows different results at each call so that it is impossible to reproduce the wandb charts .

---

<div class="post-metadata">

**Author:** ![nathank](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nathank](https://community.wandb.ai/u/nathank)\
**Post date:** [May 27, 2022, 4:47pm UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431/3 "2022-05-27T16:47:31Z")

</div>

Hi @jaeheelee and @carloshernandezp,  
I believe you are seeing this because we sample the data points when you call `run.history()`. You can use `run.scan_history()` if you would like to have the entire history returned. [Here](https://docs.wandb.ai/guides/track/public-api-guide#sampling) is some more information on this.

Let me know if this solves the issue for you.

Thank you,  
Nate

---

<div class="post-metadata">

**Author:** ![jaeheelee](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaeheelee](https://community.wandb.ai/u/jaeheelee)\
**Post date:** [May 28, 2022, 12:52pm UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431/4 "2022-05-28T12:52:43Z")

</div>

Yes, this solved my problem. Thank you @nathank !

---

<div class="post-metadata">

**Author:** ![carloshernandezp](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/carloshernandezp/32/806_2.png) [@carloshernandezp](https://community.wandb.ai/u/carloshernandezp)\
**Post date:** [May 30, 2022, 9:41am UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431/5 "2022-05-30T09:41:55Z")

</div>

This indeed solved the issue. Thank you for answering!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [July 29, 2022, 9:42am UTC](https://community.wandb.ai/t/run-history-returns-different-values-on-almost-each-call/2431/6 "2022-07-29T09:42:40Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
