导航:首页 > 编程语言 > c45java

c45java

发布时间:2024-06-01 04:28:35

1. 从java中调用weka中的分类函数的问题

详细咐轮乱请见:http://stackoverflow.com/questions/8112041/error-while-using-weka-api-in-java-code-class-attribute-not-set
你应桐正该在这行 Instances instances = getArffData("E:\\Book2.arff"); // 读衡档入文件
后加入一条语句: instances.setClassIndex(instances.numAttributes() - 1);
You should set class index of for your dataset before passing it into classifier. Your classifier must know which is your outcome variable.
//Rest of your code
loader.setQuery("select * from data_training"); Instances data = loader.getDataSet(); //add this line here
data.setClassIndex(instances.numAttributes() - 1);
//if Hujan is your class attribute(outcome variable)

2. java 将字符串中含有unicode 转成中文!

publicclassConvert
{
(Stringasciicode)
{
String[]asciis=asciicode.split("\\u");
StringnativeValue=asciis[0];
try
{
for(inti=1;i<asciis.length;i++)
{
Stringcode=asciis[i];
nativeValue+=(char)Integer.parseInt(code.substring(0,4),16);
if(code.length()>4)
{
nativeValue+=code.substring(4,code.length());
}
}
}
catch(NumberFormatExceptione)
{
returnasciicode;
}
returnnativeValue;
}

publicstaticvoidmain(String[]args)
{
Stringstr=""JWHQK_JWQC":""";
Stringresult=ascii2native(str);
System.out.println(result);
}
}

3. 缂栦竴涓 java 灏忕▼搴 镐ユ眰 镐ユユユユユユ

import java.io.*;

public class Test
{
public static void main(String arg[])throws IOException{
int a=0;
int b=0;
int c=0;
int d=0;
int f=0;
int n=0;
System.out.println("璇疯緭鍏ユ垚缁,鎸夊洖杞︾‘瀹,鎴愮哗杈揿叆瀹屾垚钖,杈揿叆F鎴杅镆ョ湅缁撴灉.");
for(;;n++)
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=br.readLine();
if (s.equals("F")||s.equals("f")) break;
int i=Integer.parseInt(s);

if(i>100||i<0){System.out.println("杈揿叆链夐敊璇锛佽烽吨鏂拌緭鍏!");n--; }
else
if (i>=85 && i<=100) {a++;}
if (i>=70 && i<85) {b++;}
if (i>=55 && i<70) {c++;}
if (i>=45 && i<55) {d++;}
if (i>=0 && i<45) {f++;}

}
System.out.println("鍏辫緭鍏"+ n + "涓瀛︾敓镄勬垚缁" + "\n"+
"绛夌骇A镄勫︾敓链"+ a + "涓" + "\n" +
"绛夌骇B镄勫︾敓链"+ b + "涓" + "\n" +
"绛夌骇C镄勫︾敓链"+ c + "涓" + "\n" +
"绛夌骇D镄勫︾敓链"+ d + "涓" + "\n" +
"绛夌骇F镄勫︾敓链"+ f + "涓");}
}

阅读全文

与c45java相关的资料

热点内容
程序员那么可爱陆离穿正装 浏览:169
源码的账号密码在哪个文件 浏览:437
如何在中国农业银行app绑定银行卡 浏览:990
shopnum1多用户商城系统源码 浏览:743
红包广告平台源码 浏览:770
硬盘格式化时用的dos命令是 浏览:940
找人缓解压力 浏览:935
iphone的pdf 浏览:349
90压缩饼干怎么吃 浏览:666
php教材下载 浏览:913
什么解压密码最好 浏览:588
数据库与服务器如何连接 浏览:443
架构师需要阅读的源码 浏览:483
ch编译器 浏览:456
java必须自己写一个编译器吗 浏览:944
如何制作androidrom 浏览:476
单片机万能板怎么写入程序 浏览:27
迈锐宝xl压缩比 浏览:346
靠算法买彩票 浏览:503
程序员考核d 浏览:242