Matlab中常用机器学习函数

更多内容请参考http://cn.mathworks.com/help/stats/index.html?s_cid=doc_ftr

Naive Bayes(朴素贝叶斯)

Factor = NaiveBayes.fit(train_data, train_label);
Scores = posterior(Factor, test_data);
[Scores,Predict_label] = posterior(Factor, test_data);
Predict_label = predict(Factor, test_data);

Random Forest(随机森林)

Factor = TreeBagger(nTree, train_data, train_label);
[Predict_label,Scores] = predict(Factor, test_data);
%scores是语义向量(概率输出)

KNN(K近邻分类器)

新版本将无法使用knnclassify

predict_label = knnclassify(test_data, train_data,train_label, num_neighbors);
mdl = ClassificationKNN.fit(train_data,train_label,'NumNeighbors',1);
predict_label = predict(mdl, test_data);

SVM(支持向量机)

matlab自带svm

Factor = svmtrain(train_data, train_label);
predict_label = svmclassify(Factor, test_data);
libsvm
Factor = svmtrain(train_label, train_data, '-b 1');
[predicted_label, accuracy, Scores] = svmpredict(test_label, test_data, Factor, '-b 1');

集成学习器(Ensembles for Boosting, Bagging, or Random Subspace)

ens = fitensemble(train_data,train_label,'AdaBoostM1' ,100,'tree','type','classification');
predict_label = predict(ens, test_data);

鉴别分析分类器(discriminant analysis classifier)

obj = ClassificationDiscriminant.fit(train_data, train_label);
[predict_label, Scores] = predict(Factor, test_data);
上一篇:struts2框架搭建(一)


下一篇:Maven构建Struts2框架的注意事项