Aha, after the intricate BP neural network(I spend more than 24 hours to finish that exercise,but even i finish ,i am sure i am not understand BP neural network well),now i finally meet the powerful SVM algorithm .
As my idol -- Andrew Ng said,There are lots of package of SVM algorithm , It is no need to write a SVM algorithm by yourself,One thing U should do is that understanding the basic principle of SVM,and kown how to use it.
So, let's do this.
Here are my exercise's answer,Do not copy it! finish it by yourself!
I am not sure with my selet of C and sigma,I have print 11 figures which C and sigma make mean equal to 0,after that , I look at the 11 figures and choose the best answer of C and sigma, I think there are many better ways.
When using SVM,just think SVM as a logistic algorithm,U got X and Y,U do not need to add interrupt term,all U need to is passing X and y to your SVM algorithm,after svmTrain (U also should pick some other parameters),U got model(I am not sure about what model exactly is).Then using svmPredict to test or apply it to real work.
The part 2 of ex2 is email spam,just few things different from part 1.U should first Preprocessing Emails,then selet the word which appeared in vocabList,And recording the indicates of the word.Finally each email will be a vector (1988 features).Next U should do is like Part 1(U can not plot it since there are 1988 feature in any examples of part 2).