I need a descriptive example, which shows how the 10-fold SVM classification on a set of two squares of data The catalog is just one example in the documentation but it is not 10 times. Can anyone help me?
Using the following functions from the Bioinformatics toolbox, here is a complete example:,.
Load fishiris% # load iris dataset group = icemember (species, 'satosa'); % # Two-level problem constitutes% of cross-validation folds:% # If you have 50 samples, then divide them into 10 groups of 5 samples, then train with 9 groups (45 samples) And test with 1 group (5 samples)% # It is repeated ten times, with each group is used once as a test set. % # Finally, 10 results of folds are average to produce %% performance estimation on average. K = 10; Cvfolds = Crowland ('Kulf', Group, K); % # 10 times CV CP = get index of group (group); % # Init display tracker for I = 1: k% # for every% testIdx = (cvFolds == i); Get trains of Exam Examples # trainIdx = ~ testIdx; Get the SVM model on% # index training example #% training example SVMModel = SVMTrain (IEEE (Trainedx, :), Group (Trainedx) ... 'Autoskele', true, 'showplot', wrong, 'method', 'Kp', ... 'box content', 2i-1, 'kernel function', 'rbf', 'rbf sigma', 1); % # Exam test examples are used pred = svmclassify (svm model, measurement (testIdx, :), 'showloot', incorrect); % # Evaluation and display object CP = classifier (CP, Pre, TestIDx); End% # get the accuracy cp.CorrectRate% # Get the confusion matrix #% column: Actual, Lines: Estimated, Last Line: Uncategorized Example cp.CountingMatrix With Output:
ans = 0.99333 ans = 100 1 0 0 0 We achieved accuracy with just one 'Satosa' example, 99.33%
Categorized as UPDATE : SVM Functions R2013a
Comments
Post a Comment