# MLJ fit and predict

**URL:** <https://discourse.julialang.org/t/mlj-fit-and-predict/66720>\
**Category:** General Usage\
**Tags:** machine-learning, fit, mlj\
**Created:** [August 20, 2021, 9:45am UTC](https://discourse.julialang.org/t/mlj-fit-and-predict/66720 "2021-08-20T09:45:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishal\_Sharma1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vishal_sharma1/32/26553_2.png) [@Vishal\_Sharma1](https://discourse.julialang.org/u/Vishal_Sharma1)\
**Post date:** [August 20, 2021, 9:45am UTC](https://discourse.julialang.org/t/mlj-fit-and-predict/66720/1 "2021-08-20T09:45:42Z")

</div>

Through MLJ’s fit and predict methods, we get the machine trained and then use it for test sample prediction respectively.  
What is the best way to get the training sample prediction?

If I use predict on the training sample, I get way high accuracy and it seems it is because the machine already knows this data and it able to nearly give perfect prediction.

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [August 20, 2021, 6:51pm UTC](https://discourse.julialang.org/t/mlj-fit-and-predict/66720/2 "2021-08-20T18:51:03Z")

</div>

You are probably experiencing [Overfitting - Wikipedia](https://en.wikipedia.org/wiki/Overfitting)
