I have encountered a problem where it says my dimension mismatch and I am not sure how to go about solving it. I tried making them the same but yet to no avail, it gives me the same error...Here are the Matrices I am using
X>83×5 Matrix{Float32}:
0.685468 2.71934 -1.3916 -1.64212 -2.46184
1.9476 -0.368776 -0.706665 0.552662 0.0840651
-0.896637 -0.774699 0.320741 -0.167762 0.471714
1.07655 -0.0556672 0.320741 1.69273 0.074243
0.836567 -0.590463 0.663209 -0.36163 0.469094
-1.13662 0.620122 -0.706665 1.21484 -1.04679
1.1921 -0.382114 0.320741 -0.0105933 0.854123
⋮
0.0544035 0.864285 -0.364196 -0.442209 -1.37747
-0.372231 2.37295 -1.3916 -2.17745 -1.94192
-1.09218 -0.786059 1.69061 0.437777 0.630833
0.0810681 -0.548226 1.00568 0.828704 0.418674
-0.869972 -0.774699 0.320741 -0.167762 0.471714
-1.01218 -0.786059 1.69061 0.437777 0.630833
Y>83 elments
Vector{Float64}
0.000282416
0.309485
0.676214
1.21552
0.374202
-0.416781
0.172861
0.633069
-1.37315
-1.13586
0.251959
1.45282
0.100953
-1.01361
-0.258585
0.906318
2.31571
-0.0356714
0.316676
0.704977
more
-0.0140991
-0.344874
0.331057
-0.474308
0.0146639
1.74045
-0.0860067
-1.028
-1.34439
The error comes when I run this specific line of code:
Flux.train!(loss(x,y),params(ms),data ,opt)
error:
DimensionMismatch("A has dimensions (83,5) but B has dimensions (83,5)")
gemm_wrapper!(::Matrix{Float64}, ::Char, ::Char, ::Matrix{Float64}, ::Matrix{Float64}, ::LinearAlgebra.MulAddMul{true, true, Bool, Bool})@matmul.jl:643
mul!@matmul.jl:169[inlined]
mul!@matmul.jl:275[inlined]
*@matmul.jl:160[inlined]
(::Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}})(::Matrix{Float64})@basic.jl:158
applychain@basic.jl:47[inlined]
(::Flux.Chain{Tuple{Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}, Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}, Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}}})(::Matrix{Float64})@basic.jl:49
loss(::Matrix{Float64}, ::Vector{Float64})@Other: 2
top-level scope@Local: 2[inlined]
The Model Architecture I am trying to use is a multi-layer perceptron and I have 5 input features and 1 output and I believe this is where my problem also is + I am using the Flux package>
ms = Chain(
Dense(83,5, relu),
Dense(5,83, relu),
Dense(5,83,relu),
)
This is how I defined my loss function:
loss(x,y)= Flux.mse(ms(x),y)
Could anyone please give me some form of guidance or a solution to fix this.