I'm currently about 29% through the Udemy course on Machine Learning using Python and R. Their forums aren't very active, so I tried my hand at tutoring someone who had an interesting question there.
This question interests me not so much because it pertains to machine learning (it doesn't really, that is just the subject of the code in question), but because I am only familiar with one line by line code walk-through technique.
If you are familiar with other code walk-through techniques or if you have any tips on how to deal with foreign code, please drop me a comment and share the knowledge love!
I'm fairly new to Python and I want to make sure that I understood each line of the "Backward Elimination with p-values only".
Can anyone please help with this?(I especially could not nail the two loops and understand how the sequence follows).
There is a technique for this sort of thing called Rubber Duck Debugging. The idea is that you should pretend that you are explaining the code to someone else, even though you may not really know what is going on there, and in the process, you will gain new insights into the code. This someone else is often a rubber duck, if nobody else is around, and from there the name. I have a rubber duck on my desk that I use for debugging code line by line, and also to alienate co-workers.
A rubber duck assisting with debugging.
My suggestion would be:
My answer on the forums included code too but I did not include that here for two reasons:
Feel free to drop some comments!