# Lack of performances in Flux MLP

**URL:** https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973
**Category:** New to Julia
**Created:** [October 15, 2023, 7:54am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973 "2023-10-15T07:54:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Mak](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@Mak](https://discourse.julialang.org/u/Mak)
#### Post date: [October 15, 2023, 7:54am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/1 "2023-10-15T07:54:03Z")

</div>

```julia

using CSV, DataFrames

using Flux, Statistics, ProgressMeter

using Plots

using CUDA,AMDGPU;

# Read the CSV file into a DataFrame

df = CSV.File("real_values_ex_00_fixed_time_step.csv") |> DataFrame

# Extract the temperature and time steps vectors

Temperatura = df[1:10:end, 2]

tsteps = df[1:10:end, 1]

#normalizze temperatura tra 0 e 1

Temperatura= (Temperatura .- minimum(Temperatura)) ./ (maximum(Temperatura) - minimum(Temperatura))

# Convert vectors into matrices

Temperatura = reshape(Temperatura, 1, :)

tsteps = reshape(tsteps, 1, :)

# Example: Using DataLoader

# Assuming `tsteps` are features and `Temperatura` are labels

loader = Flux.DataLoader((tsteps, Temperatura))

model = Flux.Chain(Flux.Dense(1 => 23, tanh),Flux.Dense(23 => 23,tanh),Flux.Dense(23 => 1, bias=false))

opt_state = Flux.setup(Flux.OptimiserChain(Flux.WeightDecay(0.42), Flux.Adam(0.01)), model)

loss(x,y)= mean(abs2.(model(x) .- y));

for epoch in 1:100

Flux.train!(model, loader, optim) do m, x, y

loss(m(x), y)

end

end

out2 = model(tsteps)

plot(tsteps[1,:], Temperatura[1,:], label="Real values")

plot!(tsteps[1,:], out2[1,:], label="Predicted values")

```

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1DsWvJrLF0fG7E14YD9TAVq4-nbth1Cuw%2Fview%3Fusp%3Ddrive_link&followup=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1DsWvJrLF0fG7E14YD9TAVq4-nbth1Cuw%2Fview%3Fusp%3Ddrive_link&ifkv=AVQVeyxMa2IInJktNXRlDVIzTjj3NwnYszWNqf_b5A15BCK7ZzylhJXsp-HaNxkj7gJKMmc3FVy13w&osid=1&passive=1209600&service=wise&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S1996503989%3A1697356350648896&theme=glif)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

---

<div class="post-metadata">

### Author: ![gvdr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gvdr/32/6387_2.png) [@gvdr](https://discourse.julialang.org/u/gvdr)
#### Post date: [October 15, 2023, 8:35am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/2 "2023-10-15T08:35:39Z")

</div>

Hi Mak, it’s not clear what you are trying to ask. Maybe take a look here [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757) 😊

---

<div class="post-metadata">

### Author: ![Mak](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@Mak](https://discourse.julialang.org/u/Mak)
#### Post date: [October 15, 2023, 8:38am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/3 "2023-10-15T08:38:33Z")

</div>

I have temperature and date data and my goal is to train an MLP neural network in flux for future temperature prediction

---

<div class="post-metadata">

### Author: ![gvdr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gvdr/32/6387_2.png) [@gvdr](https://discourse.julialang.org/u/gvdr)
#### Post date: [October 15, 2023, 8:40am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/4 "2023-10-15T08:40:55Z")

</div>

And the question is… 😊

---

<div class="post-metadata">

### Author: ![Mak](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@Mak](https://discourse.julialang.org/u/Mak)
#### Post date: [October 15, 2023, 8:45am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/5 "2023-10-15T08:45:39Z")

</div>

I am recently in julia and would like to know how to improve performance, after a while my training reaches a minimum it seems to me

---

<div class="post-metadata">

### Author: ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)
#### Post date: [October 15, 2023, 7:10pm UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/6 "2023-10-15T19:10:11Z")

</div>

Is there a reason to expect more performance out of this simple network?

We don’t really know what data you have, or how well it performs. It might be easier to give feedback if you provide more details.

Is there a reason you don’t use a recurrent network for this, they are typically good at time-series modelling.

---

<div class="post-metadata">

### Author: ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)
#### Post date: [October 16, 2023, 2:17am UTC](https://discourse.julialang.org/t/lack-of-performances-in-flux-mlp/104973/7 "2023-10-16T02:17:44Z")

</div>

> [@Mak](#):
>
> I am recently in julia and would like to know how to improve performance, after a while my training reaches a minimum it seems to me

That’s good! It means you’ve successfully converged on the optimal parameters.

For a simpler example, you can think of linear regression, where we have a function like

```julia
output = a * input + b

```

“Training” just means looking for the best values of `a` and `b` to predict the output. Once we’ve found the correct values, training longer doesn’t do anything, because `a` and `b` aren’t changing–any other values of `a` and `b` would be worse.
