Lee Hodg

Category Archives: Machine Learning

NLP Pipelines with NLTK

Often with Natural Language Processing (NLP) applications a pipeline is useful to take the raw text and process it and extract relevant features before inputting it into a machine learning (ML) algorithm. Normalization From the standpoint of an ML algorithm, it may not make much sense to differentiate between different cases of a word – […]

Backprop: coding it up

In a previous post, I walked through the maths of back-propagation (“backprop”). Here I will go through the implementation in Python (heavily based on Andrew Ng’s course). I’m going to use the alternative form equations (in the last blog post I denoted those with a tilde, but now I will drop that tilde). This means […]

Logistic Regression

Logistic Regression

In simple Logistic Regression, we have the cost function   $$\mathcal{L}(a, y) = -yln{(a)} – (1-y)ln{(1-a)}$$ where $a$ is the predicted value and $y$ is the ground-truth label on the training set (${0, 1}$).   Why this function? The intuitive version is that if $y=1$ the second term goes away, and the first term that […]