djaouen
Axon: How come my predicted values have the same shape as my input tensor?
I am slowly but surely making my way through learning about Neural Networks with Axon, but I did have this question. For some reason, my predicted values have the same shape as my input tensor (which is 60 x 60 x 1) and I am not sure the reason why. I expected the predicted values to have the shape (60, ), (as in, a single vector with 60 elements), but that is not the case for some reason.
In case you need it, here is my model:
input = Axon.input("input", shape: {prediction_days, 1})
model =
input
|> Axon.lstm(50)
|> then(fn {seq, _} -> seq end)
|> Axon.dropout(rate: 0.2)
|> Axon.lstm(50)
|> then(fn {seq, _} -> seq end)
|> Axon.dropout(rate: 0.2)
|> Axon.lstm(50)
|> then(fn {seq, _} -> seq end)
|> Axon.dropout(rate: 0.2)
|> Axon.dense(1, activation: :sigmoid)
And here is my prediction code:
params =
model
|> Axon.Loop.trainer(:mean_squared_error, :adam)
|> Axon.Loop.metric(:mean_absolute_error, "MAE")
|> Axon.Loop.run(Stream.zip(batched_x_train, batched_y_train), %{}, epochs: 25, compiler: EXLA)
y_pred = Axon.predict(model, params, x_test)
What am I missing here? Thanks!
Most Liked
djaouen
Thanks!
Edit: For future (Google-able) reference, here is the (now closed) GitHub issue: Axon.Display.as_table(model, x_test) gives error when using LSTM models with .then in them · Issue #388 · elixir-nx/axon · GitHub
1
Popular in Questions
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
lets say i have a sample like
a = 20; b = 10;
if (a > b) do
{:ok, "a"}
end
if (a < b) do
{:ok, b}
end
if (a == b) do
{:ok, "equa...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Hi All,
I set a environment variables in dev.exs , like below code.
when i start server, how can i set the ${enable} value?
thanks.
d...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
Hi everyone,
I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Other popular topics
Hello, how can I check the Phoenix version ?
Thanks !
New
I would like to know what is the best IDE for elixir development?
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









