diff --git a/machine-learning-ex6/ex6/ex6.m b/machine-learning-ex6/ex6/ex6.m index a48e060..450c780 100644 --- a/machine-learning-ex6/ex6/ex6.m +++ b/machine-learning-ex6/ex6/ex6.m @@ -35,7 +35,7 @@ load('ex6data1.mat'); plotData(X, y); fprintf('Program paused. Press enter to continue.\n'); -pause; +% pause; %% ==================== Part 2: Training Linear SVM ==================== % The following code will train a linear SVM on the dataset and plot the @@ -55,7 +55,7 @@ model = svmTrain(X, y, C, @linearKernel, 1e-3, 20); visualizeBoundaryLinear(X, y, model); fprintf('Program paused. Press enter to continue.\n'); -pause; +% pause; %% =============== Part 3: Implementing Gaussian Kernel =============== % You will now implement the Gaussian kernel to use @@ -70,7 +70,7 @@ fprintf(['Gaussian Kernel between x1 = [1; 2; 1], x2 = [0; 4; -1], sigma = 0.5 : '\n\t%f\n(this value should be about 0.324652)\n'], sim); fprintf('Program paused. Press enter to continue.\n'); -pause; +% pause; %% =============== Part 4: Visualizing Dataset 2 ================ % The following code will load the next dataset into your environment and @@ -87,7 +87,7 @@ load('ex6data2.mat'); plotData(X, y); fprintf('Program paused. Press enter to continue.\n'); -pause; +% pause; %% ========== Part 5: Training SVM with RBF Kernel (Dataset 2) ========== % After you have implemented the kernel, we can now use it to train the diff --git a/machine-learning-ex6/ex6/gaussianKernel.m b/machine-learning-ex6/ex6/gaussianKernel.m index 5aa2fec..d4d000c 100644 --- a/machine-learning-ex6/ex6/gaussianKernel.m +++ b/machine-learning-ex6/ex6/gaussianKernel.m @@ -16,10 +16,12 @@ sim = 0; % % +xt = (x1 - x2).^2; +top = sum(xt); +bottom = 2 * (sigma^2); - - +sim = exp(-top/bottom); % ============================================================= diff --git a/machine-learning-ex6/ex6/token.mat b/machine-learning-ex6/ex6/token.mat new file mode 100644 index 0000000..64ba32b Binary files /dev/null and b/machine-learning-ex6/ex6/token.mat differ