# Don't understand findmax()

**URL:** <https://discourse.julialang.org/t/dont-understand-findmax/55636>\
**Category:** General Usage\
**Created:** [February 19, 2021, 6:01pm UTC](https://discourse.julialang.org/t/dont-understand-findmax/55636 "2021-02-19T18:01:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravinder\_Ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ravinder_ram/32/14617_2.png) [@Ravinder\_Ram](https://discourse.julialang.org/u/Ravinder_Ram)\
**Post date:** [February 19, 2021, 6:01pm UTC](https://discourse.julialang.org/t/dont-understand-findmax/55636/1 "2021-02-19T18:01:05Z")

</div>

**findmax(model(preprocess(images[i]))) .- (0,1)**

 ![Screenshot from 2021-02-19 23-25-29](https://global.discourse-cdn.com/julialang/original/3X/c/9/c95cb529055ff70799b019490847690e4e2444ef.png)

code link [code link](https://github.com/crhota/Handwritten-Digit-Recognition-using-MNIST-dataset-and-Julia-Flux/tree/master/src)

---

<div class="post-metadata">

**Author:** ![logankilpatrick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/logankilpatrick/32/38123_2.png) [@logankilpatrick](https://discourse.julialang.org/u/logankilpatrick)\
**Post date:** [February 19, 2021, 6:11pm UTC](https://discourse.julialang.org/t/dont-understand-findmax/55636/2 "2021-02-19T18:11:33Z")

</div>

Perhaps a little more context as far as what you understand and where you are getting stuck would help here

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [February 19, 2021, 6:26pm UTC](https://discourse.julialang.org/t/dont-understand-findmax/55636/3 "2021-02-19T18:26:01Z")

</div>

As the comment in the code explains, findmax returns the largest element of an array and its index. Here, the array seems to be a vector of length ten with each element being the probability of the image representing one of the digits 0 to 9. Findmax tells you that the highest predicted probability is 0.82, and that it is element number 8 in the vector. As Julia indexing is one based, 1 is subtracted from this to translate the array index into the relevant digit (array element 1 corresponds to digit 0, element 2 to digit 1 etc so element 8 corresponds up digit 7)
