"Toward Talent Scientist: Sharing and Learning Together" --- Jingwei Too
-
This toolbox contains 8 widely used machine learning algorithms
-
The
A_Main
file provides the examples of how to use these methods on benchmark dataset -
Main goals of this toolbox are:
- Sharing knowledge on machine learning works
- Helping others in machine learning projects
The main function jml
is used to perform the classification. You may switch the algorithm by simply changes the 'da'
to other abbreviations
- If you wish to use discriminate analysis ( DA ) classifier then you may write
ML = jml('da',feat,label,opts);
- If you want to use naive bayes ( NB ) classifier then you may write
ML = jml('nb',feat,label,opts);
feat
: feature vector matrix ( Instance x Features )label
: label matrix ( Instance x 1 )opts
: parameter settingstf
: choose either hold-out / k-fold / leave-one-outho
: ratio of testing data in hold-out validationkfold
: number of folds in k-fold cross-validation
ML
: Machine learning model ( It contains several results )acc
: classification accuracycon
: confusion matrixt
: computational time (s)
There are three types of performance validations. These validation strategies are listed as following. However, if you do not select any of them, then the algorithm will automatically perform 10-fold cross-validation as default.
- Hold-out validation
opts.tf = 1;
opts.ho = 0.3; % 30% data for testing
- K-fold cross-validation
opts.tf = 2
opts.kfold = 10; % 10-fold cross-validation
- Leave-one-out validation
opts.tf = 3
% Parameter settings
opts.tf = 2;
opts.kfold = 10;
opts.k = 3; % k-value in KNN
% Load data
load iris.mat;
% Classification
ML = jml('knn',feat,label,opts);
% Accuracy
accuracy = ML.acc;
% Confusion matrix
confmat = ML.con;
% Parameter settings
opts.tf = 1;
opts.ho = 0.3;
opts.fun = 'r'; % radial basis kernel function in SVM
% Load data
load iris.mat;
% Classification
ML = jml('msvm',feat,label,opts);
% Accuracy
accuracy = ML.acc;
% Confusion matrix
confmat = ML.con;
% Parameter settings
opts.tf = 3;
opts.nSplit = 50; % number of split in DT
% Load data
load iris.mat;
% Classification
ML = jml('dt',feat,label,opts);
% Accuracy
accuracy = ML.acc;
% Confusion matrix
confmat = ML.con;
- MATLAB 2014 or above
- Statistics and Machine Learning Toolbox
- Click on the name of algorithm to check the parameters
- Use the
opts
to set the specific parameters
No. | Abbreviation | Name | Support |
---|---|---|---|
09 | 'gmm' |
Gaussian Mixture Model | Multi-class |
08 | 'knn' |
K-nearest Neighbor | Multi-class |
07 | 'msvm' |
Multi-class Support Vector Machine | Multi-class |
06 | 'svm' |
Support Vector Machine | Binary class |
05 | 'dt' |
Decision Tree | Multi-class |
04 | 'da' |
Discriminate Analysis Classifier | Multi-class |
03 | 'nb' |
Naive Bayes | Multi-class |
02 | 'rf' |
Random Forest | Multi-class |
01 | 'et' |
Ensemble Tree | Multi-class |