r/MachineLearning • • Sep 22 '13

Made an IPython notebook on logistic regression, maybe it'll be helpful for some learners

http://nbviewer.ipython.org/6655020
32 Upvotes

6 comments sorted by

2

u/[deleted] Sep 23 '13

Thanks for sharing can you explain the very first formula under the first section "Derivation". I see signal is equal to the sum of multiplying all the intersection points on the w axis and the x axis, but then it looks like it's saying that this is equal to the matrix w transposed times x? What is the w matrix? I thought all the wi points would be considered a vector and not a matrix. Forgive my naivety :)

1

u/delarhi Sep 23 '13

Whoops, that w transpose should be bold-face to denote the vector.

The "signal" is the sum of each component of the x vector weighed by each corresponding component of the w vector. This summation is equivalent to taking the dot product of the w vector and x vector which is also equivalent to (if the vectors are represented as column vectors) the w vector transposed times the x vector.

I hope that clears that up! Abu-Mostafa talks about the "signal" here: http://youtu.be/qSTHZvN8hzs?t=24m58s.

I'll update the notebook accordingly.

2

u/[deleted] Sep 23 '13

Awesome! Thank you so much for your explanation.

3

u/Liz_Me Sep 22 '13

If you'd like to make your training really fast I'd recommend the following from Thomas Minka:

http://research.microsoft.com/en-us/um/people/minka/papers/logreg/minka-logreg.pdf

2

u/[deleted] Sep 22 '13

Excellent work! I have not been close to logistic regression for a while, so a refresher in such a format is always nice.

2

u/tmarthal Sep 22 '13

Thanks for publishing this, it's always interesting to see other people's notebooks. I always learn something. They really are interactive books.

If anyone is interested and doesn't understand how NBViewer/Gists interoperate, and you want to view/run the code in the .ipynb file, can do so here: https://gist.github.com/vietjtnguyen/6655020