# Multiple linear regression model using Flux.jl

**URL:** <https://discourse.julialang.org/t/multiple-linear-regression-model-using-flux-jl/90775>\
**Category:** Machine Learning\
**Tags:** flux\
**Created:** [November 24, 2022, 8:11pm UTC](https://discourse.julialang.org/t/multiple-linear-regression-model-using-flux-jl/90775 "2022-11-24T20:11:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bertschi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bertschi/32/33462_2.png) [@bertschi](https://discourse.julialang.org/u/bertschi)\
**Post date:** [November 24, 2022, 8:57pm UTC](https://discourse.julialang.org/t/multiple-linear-regression-model-using-flux-jl/90775/2 "2022-11-24T20:57:23Z")

</div>

Train calls the loss function as `loss(d...)` if each datum `d` is a tuple, i.e., with your definition of `data` it is called as `loss( (V_train, S_train)... ) = loss(V_train, S_train)`. On the other hand, your loss function is defined as taking input and target as arguments (in that order). Thus, your model learns to map `V` to `S` instead of the intended mapping. Flipping either the order of targets and inputs in your data set or in the arguments of the loss function will fix it.

---

_[View the full topic](https://discourse.julialang.org/t/multiple-linear-regression-model-using-flux-jl/90775)._
