NickGnd

NickGnd

Programming Machine Learning (book) - Livebooks with Nx and Axon

Hey all :wave:
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 :point_right: GitHub - nickgnd/programming-machine-learning-livebooks: Programming Machine Learning - Elixir Livebooks

Any suggestion, comment, feedback is welcome. :smiling_face:

I wish you a great day! :rainbow:

Most Liked

NickGnd

NickGnd

Thanks @AstonJ :slight_smile:

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 :thinking: 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 :grimacing: ).

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 :slight_smile:

heinsaris

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 :slightly_smiling_face:

Regards,

Hein

AstonJ

AstonJ

Nice one Nick! Do you think (with your work) it’s a good book for Elixir users? Is it an easy read? If so maybe we should run a book club on it :sunglasses:

Paolo Perrotta is a great author - he wrote one of my favourite Ruby books: Metaprpogramming Ruby! Here’s my recollection of it in his spotlight on DT:

shawn_leong

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 :pray:

gbarkhatov

gbarkhatov

Hey man. I’ve tried ML before that and it looks like this book was the only one that made sense to me. Other were a lot more complicated and math heavy.

Learning Elixir now and I am so happy that you created such repo. Amazing job!

Where Next?

Popular in Other Resources Top

PJUllrich
I’m happy to announce RunElixir.com, a free online guide to Elixir. It aims to answer the questions: How can I get started with Elixir?, ...
New
tmartin8080
I was having issues understanding how to deploy Phoenix applications, and decided to write an article on how I was eventually able to get...
New
New
ErlangSolutions
This month, we’re launching an in-depth 3-part webinar series on API design hosted by Bruce Tate. Bruce’s knowledge of, and love for Eli...
New
eksperimental
Let’s share Elixir documentation &amp; learning material written-in/translated-to languages other than English such as docs, books, cours...
New
aifrak
tl;td: My solutions are here and here. Elixir is awesome. Exercism is awesome. Thank you Elixir community. Recently, I have solved all t...
New
preciz
Last year I had this idea to stop practicing touch typing with gibberish and start using repositories from GitHub as the source of the t...
New
realcorvus
This document is to help you prevent a data breach due to your Elixir web application being hacked. It covers strategic and technical wor...
New
dimitarvp
Hello, While coding tests for a hobby project of mine, I stumbled upon something odd when directly comparing Decimals – which is a bad i...
New
danschultzer
TLDR This repo got all Terraform IaC files to setup AWS ECS for Elixir apps that includes web server(s) and database. It includes auto d...
New

Other popular topics Top

TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New

We're in Beta

About us Mission Statement