導航:首頁 > 編程語言 > 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相關的資料

熱點內容
sql資料庫查詢表命令 瀏覽:551
簡單音樂網站源碼 瀏覽:644
運動健康app華為手錶怎麼連接 瀏覽:748
肌肉塑造全書pdf下載 瀏覽:796
安卓簡約拼圖用什麼軟體好 瀏覽:289
fx1n加密程序 瀏覽:844
淘客阿里雲伺服器 瀏覽:476
100壓縮打造 瀏覽:422
安卓手機怎麼和蘋果平板傳文件 瀏覽:973
開始選項卡中的頁眉和頁腳命令選項 瀏覽:424
pdf的字體怎麼改 瀏覽:856
python讀寫視頻 瀏覽:88
科魯茲壓縮機軸承 瀏覽:353
word文檔轉換成pdf文件找不到 瀏覽:27
組件注冊命令 瀏覽:760
安卓大屏導航用的是什麼運放 瀏覽:443
myandroidtools的備份 瀏覽:900
python爬蟲天氣預報 瀏覽:761
android70許可權管理 瀏覽:749
魔獸辛迪加是什麼伺服器 瀏覽:472