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);

 

转载于:https://www.cnblogs.com/MrLancher/p/6217224.html

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值