# Flux callback using accuracy not found

**URL:** <https://discourse.julialang.org/t/flux-callback-using-accuracy-not-found/69429>\
**Category:** Machine Learning\
**Tags:** flux\
**Created:** [October 8, 2021, 12:40pm UTC](https://discourse.julialang.org/t/flux-callback-using-accuracy-not-found/69429 "2021-10-08T12:40:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FrootLoops](https://avatars.discourse-cdn.com/v4/letter/f/c4cdca/32.png) [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Post date:** [October 8, 2021, 12:40pm UTC](https://discourse.julialang.org/t/flux-callback-using-accuracy-not-found/69429/1 "2021-10-08T12:40:45Z")

</div>

Hi,  
I start to work with the Flux.jl to create neural networks. Using the documentation [Flux\_Callback](https://fluxml.ai/Flux.jl/stable/training/training/#Callbacks) I wanted touse a callback for a train model.

Using the suggested callback

> cb = function ()  
> accuracy() \> 0.9 && Flux.stop()  
> end

ends in the error “accuracy not defined”. Does anybody know how to import the accuracy function in Flux? I already tried Flux.accuracy() but I get the same error.

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [October 8, 2021, 9:28pm UTC](https://discourse.julialang.org/t/flux-callback-using-accuracy-not-found/69429/2 "2021-10-08T21:28:07Z")

</div>

`accuracy` is just provided as an example and isn’t an actual function in Flux. Thankfully, writing your own implementation should be pretty straightforward 🙂

---

<div class="post-metadata">

**Author:** ![FrootLoops](https://avatars.discourse-cdn.com/v4/letter/f/c4cdca/32.png) [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Post date:** [October 9, 2021, 5:47am UTC](https://discourse.julialang.org/t/flux-callback-using-accuracy-not-found/69429/3 "2021-10-09T05:47:47Z")

</div>

I see 🙂 thank you!  
I was just confused since I worked with Knet too, and it is using the same function which is already Implemented.
