package com.rf.real.categ;

import java.util.ArrayList;

public class MainRun {
  public static void main(String[] args){
		String traindata="/home/mohammad/Desktop/Material/KDDTrainSmall.txt";//data has to be separated by either ',' or ' ' only...
		String testdata="/home/mohammad/Desktop/Material/KDDTestSmall.txt";
		int numTrees=50;
		
		DescribeTreesCateg DT = new DescribeTreesCateg(traindata);
		ArrayList<ArrayList<String>> Train = DT.CreateInputCateg(traindata);
		ArrayList<ArrayList<String>> Test = DT.CreateInputCateg(testdata);
		int M=0;//set this
		int Ms=0;//set this
		
		RandomForestCateg RFC = new RandomForestCateg(numTrees, M, Ms, Train, Test);
		RFC.M=Train.get(0).size()-1;
		RFC.Ms = (int)Math.round(Math.log(RFC.M)/Math.log(2)+1);;
		RFC.Start();
		
		//System.out.println("Printing traindata "+Train);
		
	}
}

@@ -48,16 +48,42 @@
 rayList;
+%0Aimport java.util.HashMap;
 %0A%0Apublic
@@ -103,10 +103,9 @@
 n %7B%0A
-  
+%09
 publ
@@ -341,27 +341,8 @@
 t%22;%0A
-%09%09int numTrees=50;%0A
 %09%09%0A%09
@@ -463,32 +463,74 @@
 ateg(traindata);
+//System.out.println(Train.get(0).size());
 %0A%09%09ArrayList%3CArr
@@ -586,140 +586,400 @@
 ta);
-%0A%09%09int M=0;//set this%0A%09%09int Ms=0;//set this%0A%09%09%0A%09%09RandomForestCateg RFC = new RandomForestCateg(numTrees, M, Ms, Train, Test);%0A%09%09RFC.
+//System.out.println(Test.get(0).size());%0A%09%09%0A%09%09//for class-labels %0A%09%09HashMap%3CString, Integer%3E Classes = new HashMap%3CString, Integer%3E();%0A%09%09for(ArrayList%3CString%3E dp : Train)%7B%0A%09%09%09String clas = dp.get(dp.size()-1);%0A%09%09%09if(Classes.containsKey(clas))%0A%09%09%09%09Classes.put(clas, Classes.get(clas)+1);%0A%09%09%09else%0A%09%09%09%09Classes.put(clas, 1);%09%09%09%09%0A%09%09%7DSystem.out.println(Classes.size());%0A%09%09%0A%09%09int numTrees=1;%0A%09%09int 
 M=Tr
@@ -1001,20 +1001,20 @@
 ()-1;%0A%09%09
-RFC.
+int 
 Ms = (in
@@ -1035,20 +1035,16 @@
 ath.log(
-RFC.
 M)/Math.
@@ -1053,16 +1053,120 @@
 g(2)+1);
+%0A%09%09RandomForestCateg RFC = new RandomForestCateg(numTrees, M, Ms, Train, Test);%0A%09%09RFC.C = Classes.size()
 ;%0A%09%09RFC.

Update MainRun.java