ex6.m
Part 2: Training Linear SVM
-
Try different value of C, sp. changing the value of C from 1 to 100 in ex6.m makes the classification work out correctly
Part 3: Implementing Gaussian Kernel
-
Fill in this function to return the similarity between x1 and x2 computed using a Gaussian kernel with bandwidth sigma
1 | sim = exp(-sum((x1-x2).^2) / (2*(sigma^2))) |
Part 7: Training SVM with RBF Kernel (Dataset 3)
-
Fill in this function to return the optimal C and sigma learning parameters found using the cross validation set
1 | val = [0.01 0.03 0.1 0.3 1 3 10 30]; |
ex6_spam.m
Part 1: Email Preprocessing
-
Fill in this function to add the index of str to word_indices if it is in the vocabulary
1 | for i = 1 : length(vocabList) |
Part 2: Feature Extraction
-
Fill in this function to return a feature vector for the given email (word_indices)
1 | for i = 1 : length(word_indices) |
or a better and simpler approach
1 | x(word_indices(i)) = 1; |