Summary
This week are covering linear regression with multiple variables. It show us how linear regression can be extended to accommodate multiple input features. It also discuss best practices for implementing linear regression.
题目
plotData.m
 coding 12345678910111213function plotData(X, y)% Create New Figurefigure; hold on;% ====================== YOUR CODE HERE ======================% Instructions: Plot the positive and negative examples on a% 2D plot, using the option 'k+' for the positive% examples and 'ko' for the negative examples.%pos = find(y == 1); neg = find(y == 0);plot(X(pos,1),X(pos,2),'k+','LineWidth',2,'MarkerSize',7);plot(X(neg,1),X(neg,2),'ko','MarkerFaceColor','y','MarkerSize',7);end
1) Sigmmoid function
formula


coding


2) Compute cost and Gradient for logistic regression
formula


coding


result
3) Predict function


4) Compute cost and Gradient for regularized LR
fomula


coding

