Learn Before
Concept
Vectorizing logistic regression on m examples
To compute logistic regression and its gradient descent on examples, we can use for loop to accumulate errors and derivatives and then average them, but it will take a long time to run on a big data set. So vectorization is a good way to get rid of explicit for loop in your code. First, stack the examples horizontally into vectors of and , so the shape of is , where is the number of features, and the shape of is (1, m). Then, compute the and , , the shape of and should be . The derivatives of with respect to , , and are
0
1
Updated 2021-11-16
Tags
Data Science