当前位置:网站首页>【故障诊断】基于贝叶斯优化支持向量机的轴承故障诊断附matlab代码
【故障诊断】基于贝叶斯优化支持向量机的轴承故障诊断附matlab代码
2022-07-26 06:28:00 【matlab_dingdang】
1 内容介绍
贝叶斯网络(Bayesian Network或BN)是人工智能领域进行建模和不确定性推理的一个有效工具。贝叶斯网推理的基本任务是:给定一组证据变量观察值,通过搜索条件概率表计算一组查询变量的后验概率分布。在现实应用中,观察到的证据值可以为任意值,即证据值可能不包含在条件概率表中。因此,有必要提出一种在给定任意证据值时都能计算后验概率分布的方法。针对这个问题,本文主要讨论了带学习功能的贝叶斯网的构造和推理:当从样本中构造贝叶斯网结构时,也从样本中学习极大似然参数(极大似然假设),用以取代相应的条件概率表,即把极大似然参数看作是贝叶斯网的一部分。 使用传统方法从样本中构造了贝叶斯网结构之后,本文主要关注如何从样本中学习极大似然参数。贝叶斯网中包含两种推理方法:正向推理和反向推理。对于正向推理,我们提出了基于支持向量机和Sigmoid函数来学习极大似然参数的方法。对于反向推理,首先基于贝叶斯公式,把反向推理问题转化为正向推理问题;然后对极大似然参数进行线性插值。 然而,对于已经构造完的贝叶斯网,它们很可能没有原始样本。针对这种情况,本文提出了把现有条件概率表映射成样本的方法,进而从得到的样本中学习极大似然假设。 进一步,为应用带有极大似然假设的贝叶斯网进行近似推理,本文给出了相应的Gibbs采样算法。 最后,我们给出一个应用实例,并给出了测试学习极大似然假设算法精度和验证Gibbs采样算法收敛性的实验。初步实验结果表明我们的方法是可行的。
本文的主要贡献如下: ●本文提出了学习带有学习功能的贝叶斯网的方法,即当使用现有方法从样本中构造贝叶斯网结构时,基于支持向量机和Sigmoid函数,也从样本中学习极大似然假设,用以取代相应的条件概率表。然后基于带有极大似然假设的贝叶斯网,本文进一步提出了相应的正向和反向推理方法。这解决了给定任意证据值都能进行推理的问题。 ●本文提出了把现有条件概率表映射成样本的方法,实现了从现有条件概率表中也能学习极大似然假设,解决了对于已经构造完的贝叶斯网(可能没有原始样本),给定任意证据值也能进行推理的问题。 ●进一步,为应用带有极大似然假设的贝叶斯网进行近似推理,本文给出了相应的Gibbs采样算法。一点程度上解决了贝叶斯网精确推理的低效问题。
2 仿真代码
clcclear allclose alladdpath(genpath(pwd))% 生成3类样本(二维高斯分布)?sigma = [0.6 0; 0 0.6];numData = 100;mu = [6 5];X_1 = mvnrnd(mu, sigma, numData);label_1 = ones(numData, 1);mu = [3 9];X_2 = mvnrnd(mu, sigma, numData);label_2 = 2*ones(numData, 1);mu = [-2 7];X_3 = mvnrnd(mu, sigma, numData);label_3 = 3*ones(numData, 1);data = [X_1; X_2; X_3];label = [label_1; label_2; label_3];%% 贝叶斯优化参数% 变量的上下限以及类型设置c = optimizableVariable('c', [1e-2 1e2], 'Type', 'real');g = optimizableVariable('g', [2^-7 2^7], 'Type', 'real');parameter = [c, g];% 交叉验证参数设置(关闭交叉验证时设置为[])?kfolds = 5;% kfolds = [];% 目标函数objFun = @(parameter) getObjValue(parameter, data, label, kfolds);% 贝叶斯优化iter = 30;points = 10;results = bayesopt(objFun, parameter, 'Verbose', 1, ...'MaxObjectiveEvaluations', iter,...'NumSeedPoints', points);% 优化结果[bestParam, ~, ~] = bestPoint(results, 'Criterion', 'min-observed');%% 利用最优参数重新训练SVM模型c = bestParam.c;g = bestParam.g;% 训练和测试cmd = ['-s 0 -t 2 ', '-c ', num2str(c), ' -g ', num2str(g), ' -q'];model = libsvmtrain(label, data, cmd);[~, acc, ~] = libsvmpredict(label, data, model);%% SVM边界可视化?d = 0.02;[X1, X2] = meshgrid(min(data(:, 1)):d:max(data(:, 1)), min(data(:, 2)):d:max(data(:, 2)));X_grid = [X1(:), X2(:)];grid_label = ones(size(X_grid, 1), 1);[pre_label, ~, ~] = libsvmpredict(grid_label, X_grid, model);% 缁樺埗鏁g偣鍥?figurecolor_p = [150, 138, 191;12, 112, 104; 220, 94, 75]/255; % 鏁版嵁鐐归鑹?color_b = [218, 216, 232; 179, 226, 219; 244, 195, 171]/255; % 杈圭晫鍖哄煙棰滆壊hold onax(1:3) = gscatter(X_grid (:,1), X_grid (:,2), pre_label, color_b);% 缁樺埗鍘熷鏁版嵁鍥?ax(4:6) = gscatter(data(:,1), data(:,2), label);set(ax(4), 'Marker','o', 'MarkerSize', 7, 'MarkerEdgeColor','k', 'MarkerFaceColor', color_p(1,:));set(ax(5), 'Marker','o', 'MarkerSize', 7, 'MarkerEdgeColor','k', 'MarkerFaceColor', color_p(2,:));set(ax(6), 'Marker','o', 'MarkerSize', 7, 'MarkerEdgeColor','k', 'MarkerFaceColor', color_p(3,:));set(gca, 'linewidth', 1.1)title('Decision boundary (gaussian kernel function)')axis tightlegend('off')box onset(gca, 'linewidth', 1.1)
3 运行结果

4 参考文献
[1]王君宇. 基于小波包和优化支持向量机的滚动轴承故障诊断研究.
[2]苏小杰. 大规模数据下基于支持向量机的轴承故障诊断研究.
[3]杨正友, 彭涛, 李健宝,等. 基于贝叶斯推断LSSVM的滚动轴承故障诊断[J]. 电子测量与仪器学报, 2010, 24(5):5.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
边栏推荐
- Oc/swift Technology Download File (breakpoint continuation AFN download file alamofire Download File native download) (source code)
- Sequential action localization | fine grained temporal contrast learning for weak supervised temporal action localization (CVPR 2022)
- Latex merges multiple rows and columns of a table at the same time
- Nuxt configuration topic switching
- 【Day_03 0420】字符串中找出连续最长的数字串
- WebAPI整理
- Convolutional neural network (IV) - special applications: face recognition and neural style transformation
- [day_020419] sort subsequence
- Leetcode:741. picking cherries
- Cdga | how to build data asset catalogue?
猜你喜欢

Interpretation of TPS motion (cvpr2022) video generation paper

Code runner for vs code, with more than 40million downloads! Support more than 50 languages

Input the records of 5 students (each record includes student number and grade), form a record array, and then output them in order of grade from high to low The sorting method adopts selective sortin

What are the aspects of performance testing? What are the classification and testing methods?

Age is a hard threshold! 42 years old, Tencent level 13, master of 985, looking for a job for three months, no company actually accepted!
![[untitled]](/img/42/5e8b62edc0aa289098425b26df2453.jpg)
[untitled]

Sequential action localization | fine grained temporal contrast learning for weak supervised temporal action localization (CVPR 2022)

Basis of multimodal semantic segmentation

VRRP protocol and experimental configuration

Advanced C language - archived address book (file)
随机推荐
白盒测试的概念、目的是什么?及主要方法有哪些?
Database and the future of open source
nuxt 配置主题切换
The number of weeks of Oracle last year and this year, with the start time and end time
VRRP principle and basic commands
BigDecimal becomes negative
Input the records of 5 students (each record includes student number and grade), form a record array, and then output them in order of grade from high to low The sorting method adopts selective sortin
Swift basic FileManager (file management)
【pytorch】图片增广
Upgrade appium automation framework to the latest 2.0
Leetcode:940. How many subsequences have different literal values
【Day_02 0419】排序子序列
[day03_0420] C language multiple choice questions
[pytorch] CNN practice - flower species identification
C language explanation series - comprehensive exercises, guessing numbers games
[C language] address book dynamic version and document version
[untitled]
Workflow activiti5.13 learning notes (I)
带你搞透IO多路复用原理(select、poll和epoll)
将金额数字转换为大写