ex2.m

implement logistic regression and apply it to two different datasets (ex2data1.txt, ex2data2.txt)

  • Plot Data (in ex2data1.txt)

ex2_plotting_data.png

  • Compute Cost and Gradient

hypothesis function: 1./(1+e.^(-1(Xtheta)))

  • Learning parameters using fminunc

initial theta: zeros, iteration: 400

  • Plot Decision Boundary

ex2_plotting_decisionBoundary.png

  • Predict and Accuracies

use the logistic regression model to predict the probability that a student with score 45 on exam 1 and score 85 on exam 2 will be admitted.

ex2_reg.m

The axes are the two test scores, and the positive (y = 1, accepted) and negative (y = 0, rejected) examples are shown with different markers.

  • Plot Data (in ex2data2.txt)

ex2_reg_plotting_data.png

  • Add Polynomial Features and Compute Cost

original X: [X1 X2]

mapFeatured X: [X1 X2 (X1.^2) (X2.^2) (X1X2) (X1X2.^2) …]

hypothesis function: 1./(1+e.^(-1(Xtheta)))

  • Plot Decision Boundary with lambda 0

ex2_reg_plotting_decisionBoundary_with_lambda_0.png

  • Plot Decision Boundary with lambda 1

ex2_reg_plotting_decisionBoundary_with_lambda_1

  • Plot Decision Boundary with lambda 100

ex2_reg_plotting_decisionBoundary_with_lambda_100

Standord Machine Learning Class: Week7 Assignment

## ex6.m> you will be using support vector machines (SVMs) with various example 2D datasets.- Plot Data (in ex6data1.mat)![ex6_plotting_e...… Continue reading