j48算法
1. 请问如何能够让weka支持中文如何让id3算法可视化
hi,
weka支持中文的话,可以在weka安装目录下,打开RunWeka.ini文件,把其中fileEncoding=utf-8设为utf-8即可支持中文,id3可视化搞定了。。详搜“csdn 天泽28 weka中ID3算法及可视化”博客里介绍了。。不好意思没法放链接,网络不让放。。
2. 如何使用java Weka开源项目,实现J48决策树、支持向量机算法,在10个UCI数据集上对这两个算法进行性能
publicstaticvoidRegular()throwsException{
Fileinputfile=newFile("F:\weka\eucalyptus_Train.arff");
ArffLoaderloader=newArffLoader();
loader.setFile(inputfile);
InstancesinsTrain=loader.getDataSet();
insTrain.setClassIndex(insTrain.numAttributes()-1);
inputfile=newFile("F:\weka\eucalyptus_Test.arff");
loader.setFile(inputfile);
InstancesinsTest=loader.getDataSet();
insTest.setClassIndex(insTest.numAttributes()-1);
doublesum=insTest.numInstances();
intright=0;
Classifierclas=newJ48();
//Classifierclas=newweka.classifiers.bayes.BayesNet();
clas.buildClassifier(insTrain);
for(inti=0;i<sum;i++){
if(clas.classifyInstance(insTest.instance(i))==insTest.instance(i).classValue()){
right++;
}
System.out.println(clas.classifyInstance(insTest.instance(i))+":"+insTest.instance(i).classValue());
}
System.out.println("分类准确率:"+right/sum);
}
svm的话,要用一个wlsvm的包。 代码是一样的,就是Classifier class= new J48()这里要用svm的实例
3. 谁知道OVERFITTING程度在WEKA里用J48算法得到的结果中是怎么看出来的,或者通过什么方法可以看出来
如果你将数据集分成两半A和B,用A来建模,再用A去测试,得到的精度很高,用B测试,得到的精度很低,则是overfitting。
可以手动分,也可以用cross-validation直接看
4. weka的explorer运行j48算法后,输出如下类容,各是什么含义
这就是决策树分类算法的准确度细节表。第三列是准确率,也就是查准率,第四列是召回率,也就是查全率,第五列是F值,是根据准确率跟召回率算出来的。下面是权重应该。
5. 信息增益准则为什么对可取值数目较多的属性有所偏好
从公式出发,信息增益是整个数据集的经验熵与特征A对整个数据集的经验条件熵的差值,信息增益越大即经验条件熵越小,那什么情况下的属性会有极小的的经验条件熵呢?举个极端的例子,如果将身份证号作为一个属性,那么,其实每个人的身份证号都是不相同的,也就是说,有多少个人,就有多少种取值,如果用身份证号这个属性去划分原数据集,那么,原数据集中有多少个样本,就会被划分为多少个子集,这样的话,会导致信息增益公式的第二项整体为0,虽然这种划分毫无意义,但是从信息增益准则来讲,这就是最好的划分属性。其实从概念来讲,就一句话,信息增益表示由于特征A而使得数据集的分类不确定性减少的程度,信息增益大的特征具有更强的分类能力。
6. weka 代码 算法 j48 决策树 c4.5
我想你应该是想通过这个页面的url来得到这个网页里面的某些数据把。用HttpClient 。
下面我这个方法是得到搜狗页面命中多少条记录的代码。
public static void main (String args[]){
String sRequestUrlString="http://www.sogou.com/web?query=ondblclick
%3D%22%22";
GetMethod getMethod = new GetMethod(sRequestUrlString);
HttpClient client = new HttpClient();
client.setConnectionTimeout(1000 * 60);
int status=0;
try {
status = client.executeMethod(getMethod);
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String sResponse="";
if(status==HttpStatus.SC_OK) {
sResponse=(getMethod.getResponseBodyAsString());
} else {
System.out.println("检索失败");
}
getMethod.releaseConnection();
String regExData = "找到 ([,\\d]*) 个网页";
if(sResponse!=null && sResponse.trim().length()>0) {
Pattern pattern = Pattern.compile(regExData);
Matcher matcher = pattern.matcher(sResponse);
if(matcher.find()) {
if(matcher.groupCount()>=1) {
int iTmpInteger =
Integer.parseInt(matcher.group(1).replaceAll(",",""),10);
System.out.println("找到"+iTmpInteger+"个网页");
}
}
}
}
这段测试代码是来测试搜狗的,String sRequestUrlString="http://www.sogou.com/web?
query=ondblclick%3D%22%22";
这里是拼写好的检索的url,
sResponse=(getMethod.getResponseBodyAsString());这个是得到本页面的源文件,然后通过
String regExData = "找到 ([,\\d]*) 个网页";正则表达式来获取([,\\d]*) ,得到命中的条数。
7. weka中用J48(即C4.5)算法对数据集进行训练建模与测试,结果不是很理想,
weka 对数据进行操作的时候没有要求必须使用arff文件类型的,可以选择,一般都是将表格数据转换为.csv格式的数据进行导入。
8. 数据挖掘软件 Weka 中将 C4.5 算法命名为 J48,C4.5 和 J48 名称的含义和来由是什么
C4.5的作者把算法升级到C4.8,然后Weka的作者用Java 语言实现了C4.8,并把它命名为J4.8
最新的版本已经是 C5.0
9. 数据挖掘j48算法和randomtree 算法的异同
不同算法的结果当然会不一样
J48是简单算法,按照树枝分类法来分析数据。假如a=3,b=4,在j48做training的时候就会记录:x<=3为a,x>3为b
可能你的数据不适合j48这种算法
个人推荐在function中的svm算法,很灵活