Weka中的贝叶斯网络类和变量分析

上传人:m**** 文档编号:503760873 上传时间:2023-07-22 格式:DOCX 页数:5 大小:47.45KB
返回 下载 相关 举报
Weka中的贝叶斯网络类和变量分析_第1页
第1页 / 共5页
Weka中的贝叶斯网络类和变量分析_第2页
第2页 / 共5页
Weka中的贝叶斯网络类和变量分析_第3页
第3页 / 共5页
Weka中的贝叶斯网络类和变量分析_第4页
第4页 / 共5页
Weka中的贝叶斯网络类和变量分析_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《Weka中的贝叶斯网络类和变量分析》由会员分享,可在线阅读,更多相关《Weka中的贝叶斯网络类和变量分析(5页珍藏版)》请在金锄头文库上搜索。

1、QK23sQ) = P(s)Iin1=0 J=1Weka中的贝叶斯网络类和变量分析全同学著因为涉及的接11等地方很多,所以我一般情况卞不对接11类的东西进行描述。对于一些 重要的变量和类,有必要进行详细说明,这在程序中似乎没有足够的讲解,有必要性。我试图按照程序或者数学逻辑的顺序进行一一解释,同时兼顾一些非常关键的限制条件 类。把贝叶斯牧师的照片放在下边以便膜拜。贝叶斯(1702(壬午年)-1763) Thomas Bayes,英国数学家。1702年出生于伦敦,做过神甫。:1742年成为英国皇家学 会会员。:1763年4月7 口逝世。贝叶斯在数学方面主要 研究概率论。他首先将归纳推理法用于概率

2、论基础理论, 并创立了贝叶斯统计理论,对于统计决策函数、统计推断、 统计的估算等做出了贡献。1763年发表了这方面的论著, 对于现代概率论和数理统计都有很重要的作用。贝叶斯的 另一著作机会的学说概论发表于1758年。贝叶斯所 采用的许多术语被沿用至今。首先,要构建一个网络。We useNjj(l Wi Wn, 1 jqi) to denotethe number of records in Dfor which pa(xi)takes its jth value.We use Nijk(l Wi Wn, 1 Wj Wqi, 1 WkWri) to denote the number of re

3、cords in Dfor which pa(xi) takes its jth value and for which xitakes its kth value. So,Nij =Prik=S Nijk理解喺的含义是有好处的。中文表达是,Xi的地i个属性取第j个值得时候,xi 本身取第K个值的时候数据的数量。我看的K2算法的数学含义就写在卜边公式:儿乎所有方法都与hill climbing的思想有些关系,但是实现上略有不同。Arcs 是弧线的意思o Manual里边给出的意思是:hill climbing add arcs with a fixed ordering of variable

4、s .Specific option: randomOrderif true a random ordering of the nodes ismade at the beginning of the searchIffalse (defauIt) the ordering in thedata set is used The only exception in both cases is that in case the initialnetwork is a naive Bayes network (initAsNaiveBayessettrue) the classvariable is

5、 made first in the order in g因为local和global里边都会有k2等算法,所以我觉得这几句话也是必要的:local score metrics: Learning a network structure BS can be considered an optimization problem where a quality measure of a network structure given the training dataQ(BS|D) needs to be maximized.global score metrics: A natural way

6、to measure how well a Bayesian net-work performs on a iven data set is to predict its future performance by estimating expected utilities, such as classification accuracy. Cross-validation provides an out of sample evaluation method to facilitate this by repeatedly splitting the data in training and

7、 validationsets. A Bayesian network structure can be evaluated by estimating the networks param eters from the training set and the resulting ayesian networks performance determined against the validation set. The average performance of the Bayesian network over the validation sets provides a metric

8、 for the quality of the network. Cross-validation differs from local scoring metrics in thatthe quality of a network structure often cannot be decomposed in the scores of the indi-vidual nodes So, the whole network needs to be considered inorder to determine the score.这个东西以后也有用:The SimpleEstimator c

9、lass produces direct estimates of the conditional probabilities, that is:P(窃=kpa(xi) = j)=N诽+心Nij+Wjwhore Njk is the alpha paramo ter that can be set and is 0.5 by default Witli alpha = (h wc get maximum likelihood cstirnates.很多时候我们根本用不到ADTree education eaucation-nuit irarlLaL-suatus ccupaoion relat

10、ionshipracesex capitaL-cam capital-1033 hours-per-week native-country 1Q3Z itode :10-fold cro3S-validation =Classifier model (full training set)=Bayes Nerworr ciassiner not; using ADTree tQtoributco-1.4 #clao3indcx-9比如(nodes fclloved by parents)Network 3tructureAca I i. How do I create a random Baye

11、s net structure?Running from the command line java .BayesNetGenerator B -N 10 -A 9 -C2 will print a Bayes net with 10 nodes, 9 arcs and binary variables in XML BIF format to standard output意味着这个类一般都不怎么用,因为我们都是用训练数据去构造一个可靠的贝叶斯 类。作为抽彖类classifier这个函数,又继承了一批接I I。主要是一个分类器的构建问题,需要用 到一些功能。Attribute这个类经常被用到

12、,看到代码发现他主要是冇很多多态函数。参数不同意思也有点 变化。还有一些函数几乎没有用处。毕竞是一个人型的系统,所以,不可能一个雷中就只针对性的 列出需要的功能。那个capacities的类,我看着像一个大容器。但是她定义了什么enable,我不知道是想干什 么。下边这个函数很重要,但是代码注释还是很简明的。publicvoid buildclassifier(Instances instances) throws Exception / can classifier handie the data?getCapabilities().testwithFail(instances);/ rem

13、ove instances with missing classinstances = new Instances(instanews);instancesdeleteWithMissingClass();/ ensure we have a data set with discrete variables only and with no missing valuesinstances = normalizeDataSet(instances);/ Copy the instancesm_Instances = new Instances(instances);/ sanity check:

14、 need more than 1 variable in datat set m_NumClasses = instanewsnumClasses();/ initialize ADTreeif (m_bUseADTree) m_ADTree = ADNode./wa/?e4Drree(instances);/ System.out.println(Oefdone!);/ build the network structureinitStructure();/ build the network structurebuildstructure();/ build the set of CPT

15、sestimateCPTs();/ Save space/ m_Instances = new Instances(m_Instances 0); m_ADTree = null; / buildclassifierFcount和iclass.仔细看一下能够知道它们是用来计数和计算CPT的publicvoid setOptions(String options) throws Exception 这个函数,主要是根据外界输入來判断该怎么调用搜索算法的,public String getOptions() 我感觉这个函数主要目的是根据weka运行的选项找 到操作的方法。不一定对,就说说自己的理解。public String toString() 就是输出到界面的方法,我感觉weka里边的代码不能直 接在myeclipse 改动。不知道是怎么做到的它还能画出图,所以会有一些关于作图的神奇函数,其实java里边我应该叫方法,但是无 所谓了, whateverpublicint graphType() return Drawable.BayesNet;/* * Returns a BayesNet graph in XMLBIF ver 0.3 format.* return String representi

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文 > 其它学术论文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号