资源简介
最简单的贝叶斯分类器演示Matlab程序。入门必备。 详细请参考本人的博客http://blog.csdn.net/ranchlai/article/details/10375579

代码片段和文件信息
%
% Liscense Notification 2013
%
% Redistributions in source and binary forms with or without
% modification are totally FREE provided that you keep this keep this
% notification
%
% Descritption: This package demonstrates the discrete adaboost with
% stump(decision tree with only the root node) weak classifers.
% Author: Ranch Lai (ranchlai@hotmail.com)
% Release date: Aug 17 2013
%/
%%
clc;
clear;
close all;
%% generate random data
shift =3.0;
n = 2;%2 dim
%y = 1./exp(-w‘*x+b)
sigma = 1;
N = 500;
x = [randn(nN/2)-shift randn(nN/2)*sigma+shift];
y = [ones(N/21);-ones(N/21)];
%show the data
figure;
plot(x(11:N/2)x(21:N/2)‘rs‘);
hold on;
plot(x(11+N/2:N)x(21+N/2:N)‘go‘);
title(‘2d training data‘);
legend(‘Positve samples‘‘Negative samples‘‘Location‘‘SouthEast‘);
% model fitting using maximum likelihood
[model_posmodel_neg] = FindGuassianModel(xy);
%% test on new dataset same distribution
n = 2;%2 dim
%y = 1./exp(-w‘*x+b)
sigma = 2;
N = 500;
x = [randn(nN/2)-shift randn(nN/2)*sigma+shift];
y = [ones(N/21);-ones(N/21)];
figure;
plot(x(11:N/2)x(21:N/2)‘rs‘);
hold on;
plot(x(11+N/2:N)x(21+N/2:N)‘go‘);
title(‘2d testing data‘);
hold on;
%% gaussian model as a baseline
[errh] = FindModelError(model_posmodel_negxy);
fprintf(‘Baysian error on test data set: %f\n‘err/N);
x_pos = x(:h==1);
x_neg = x(:h~=1);
plot(x_pos(1:)x_pos(2:)‘r.‘);
hold on;
plot(x_neg(1:)x_neg(2:)‘g.‘);
legend(‘Positve samples‘‘Negative samples‘‘Positve samples as predicted‘‘Negative samples as predicted‘‘Location‘‘SouthEast‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-08-27 03:07 Baysian+Gaussian\
文件 8669 2013-08-27 03:07 Baysian+Gaussian\training.png
文件 11809 2013-08-27 03:07 Baysian+Gaussian\predict.png
文件 1583 2013-08-27 03:04 Baysian+Gaussian\demo_adaboost.m
文件 615 2013-08-26 09:43 Baysian+Gaussian\FindModelError.m
文件 401 2013-08-26 10:01 Baysian+Gaussian\FindGuassianModel.m
- 上一篇:基于matlab的海浪模拟程序
- 下一篇:遗传模拟退火解决tsp问题
相关资源
- 基于贝叶斯决策的分类
- 贝叶斯分类器Matlab实现113478
- zw_支持向量机与朴素贝叶斯算法matl
- svm支持向量机与nbc朴素贝叶斯算法比
- 基于MATLAB的柑橘果实分类图像朴素贝
- 用身高和/或体重数据进行性别分类的
- EM算法--基于贝叶斯
- bayes分类器完整版代码
- 贝叶斯网络Matlab源代码
- 贝叶斯网络工具箱MATLAB工具箱
- 贝叶斯压缩感知matlab源代码
- 模式识别4个实验(matlab)
- SVM分类器.zip
- 可视化贝叶斯网络建模软件GeNIe2.2用户
- genie 2.0贝叶斯网络软件
- BNT_SLP v1.5
- 贝叶斯网络工具箱Matlab工具包
- FullBNT-1.0.4
- 贝叶斯网络建模工具GeNie2.0安装程序
- 贝叶斯图像处理matlab程序
- 贝叶斯分类器的matlab实现及案例
- 贝叶斯压缩感知matlab函数包
- MATLAB贝叶斯网络工具箱174646
- seksgui v1.0.3
- 机器学习课程设计《基于朴素贝叶斯
- Matlab基于贝叶斯,朴素贝叶斯,最小
- MATLAB贝叶斯网络工具箱FullBNT-1.0.7
- 贝叶斯抠图算法matlab实现
- 集成分类器matlab
- matlab贝叶斯网络工具箱
评论
共有 条评论