NickGnd
Programming Machine Learning (book) - Livebooks with Nx and Axon
Hey all ![]()
I took me a bit more than 1 year but I finally managed to finish “Programming Machine Learning - From Coding to Deep Learning” book and to reproduce all the Python Jupyter notebooks with Nx/Axon of course by running them in Livebook.
Overall, the experience was pretty good. I found the elixir-nx libraries rather stable in terms of APIs even if they are pre 1.0. And when I had doubts or when I stumbled across some potential issues, I’ve reached out for help in Github or here in the forum.
The repository is hosted here
GitHub - nickgnd/programming-machine-learning-livebooks: Programming Machine Learning - Elixir Livebooks · GitHub
Any suggestion, comment, feedback is welcome. ![]()
I wish you a great day! ![]()
Most Liked
NickGnd
Thanks @AstonJ ![]()
Do you think (with your work) it’s a good book for Elixir users? Is it an easy read?
It is definitely a good and well written book, with a practical approach and only a couple of “heavy-math” chapters. In general I liked it and I found it easy to follow, even if I didn’t have much experience with numpy. In the first chapters I struggled a bit to replicate the examples in Nx, but mainly because I was completely new to the library and to the concepts, that’s part of the game.
If so maybe we should run a book club on it
I think it can be a valuable reading if you wanna start with ML, on the other hand, the book is 3 years old and given the pace of innovation in ML, maybe there are more up to date resources out there
The basis won’t change tho’, but for example I’d have like some chapters on more advanced topics such as NLP, transformers, reinforcement learning (but I guess they deserve a book on their own
).
Paolo Perrotta is a great author - he wrote one of my favourite Ruby books: Metaprpogramming Ruby!
I never read it, but I saw a talk on Git by him once and it was great ![]()
heinsaris
Hi Nick,
Thank you for doing this. It is really great.
I started reading the book, and follow along with your livebooks. I have only just started so I am only at Chapter two at the moment.
By evaluating your code for the Linear Regression example, I noticed that it always goes through all the iterations, whereas the Python code in the book stops when the error is no longer smaller then the previous error.
By using a reduce_while instead of a reduce in the train function, you could mimic that behaviour. Here is how I changed it:
def train(x, y, iterations, lr) when is_list(x) and is_list(y) do
Enum.reduce_while(0..iterations, 0, fn i, w ->
current_loss = loss(x, y, w)
IO.puts("Iteration #{i} => Loss: #{current_loss}")
cond do
loss(x, y, w + lr) < current_loss -> {:cont, w + lr}
loss(x, y, w - lr) < current_loss -> {:cont, w - lr}
true -> {:halt, w}
end
end)
end
It will then stop at the 184th iteration, just like in the book ![]()
Regards,
Hein
shawn_leong
@NickGnd This is so timely & amazing. Thank you.
I’ve tried the Dockyard tutorials at first since I didn’t want to leave Elixir-land but soon found it easier to understand nx/axon it after I understood the analogous libraries in Python.
Be happy to provide feedback on the livebooks as I progress.
Have a great day too ![]()
Popular in Other Resources
Other popular topics
Latest Livebook Threads
Latest on Elixir Forum
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








