I am trying to do binary classification in MATLAB but the following code throws an error at the end.
load('ex6data1.mat');
% Plot training data
plotData(X, y);
fprintf('Program paused. Press enter to continue.\n');
pause;
model=fitcsvm(X,y);
visualizeBoundaryLinear(X,y,model); //error shows up here i guess
fprintf('Paused');
Error window
Error using subsref
No appropriate method, property, or field 'w' for class
'ClassificationSVM'.
Error in classreg.learning.internal.DisallowVectorOps/subsref (line
21)
[varargout{1:nargout}] = builtin('subsref',this,s);
Error in visualizeBoundaryLinear (line 7)
w = model.w;
Error in Untitled2 (line 18)
visualizeBoundaryLinear(X,y,model);
Note:Y is 1 for positive example and -1 for negative.
visualizeBoundaryLinear
look like? The error happens in that function, butvisualizeBoundaryLinear
is not part of the native MATLAB distribution. – rayryeng