package com.rf.real.categ;

import java.util.ArrayList;
import java.util.HashMap;

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";
		
		DescribeTreesCateg DT = new DescribeTreesCateg(traindata);
		ArrayList<ArrayList<String>> Train = DT.CreateInputCateg(traindata);//System.out.println(Train.get(0).size());
		ArrayList<ArrayList<String>> Test = DT.CreateInputCateg(testdata);//System.out.println(Test.get(0).size());
		
		//for class-labels 
		HashMap<String, Integer> Classes = new HashMap<String, Integer>();
		for(ArrayList<String> dp : Train){
			String clas = dp.get(dp.size()-1);
			if(Classes.containsKey(clas))
				Classes.put(clas, Classes.get(clas)+1);
			else
				Classes.put(clas, 1);				
		}System.out.println(Classes.size());
		
		int numTrees=1;
		int M=Train.get(0).size()-1;
		int Ms = (int)Math.round(Math.log(M)/Math.log(2)+1);
		RandomForestCateg RFC = new RandomForestCateg(numTrees, M, Ms, Train, Test);
		RFC.C = Classes.size();
		RFC.Start();
		
		//System.out.println("Printing traindata "+Train);
		
	}
}

@@ -96,16 +96,21 @@
  MainRun
+Categ
  %7B%0A%09publ
@@ -152,202 +152,634 @@
 %0A%09%09S
-tring traindata=%22/home/mohammad/Desktop/Material/KDDTrainSmall.txt%22;//data has to be separated by either ',' or ' ' only...%0A%09%09String testdata=%22/home/mohammad/Desktop/Material/KDDTestSmall
+ystem.out.println(%22Random-Forest with Categorical support%22);%0A%09%09System.out.println(%22Now Running%22);%0A%09%09/*%0A%09%09 * data has to be separated by either ',' or ' ' only...%0A%09%09 */%0A%09%09int categ=0;%0A%09%09String traindata,testdata;%0A%09%09if(categ%3E0)%7B%0A%09%09%09traindata=%22/home/mohammad/Desktop/Material/KDDTrainSmall.txt%22;%0A%09%09%09testdata=%22/home/mohammad/Desktop/Material/KDDTestSmall.txt%22;%0A%09%09%7Delse if(categ%3C0)%7B%0A%09%09%09traindata=%22/home/mohammad/Desktop/Material/Data.txt%22;%0A%09%09%09testdata=%22/home/mohammad/Desktop/Material/Test.txt%22;%0A%09%09%7Delse%7B%0A%09%09%09traindata=%22/home/mohammad/Desktop/Material/KDDTrain+.txt%22;%0A%09%09%09testdata=%22/home/mohammad/Desktop/Material/KDDTest+
 .txt%22;%0A
+%09%09%7D%0A
 %09%09%0A%09
@@ -912,50 +912,8 @@
 ta);
-//System.out.println(Train.get(0).size());
 %0A%09%09A
@@ -981,58 +981,20 @@
 ta);
-//System.out.println(Test.get(0).size());
 %0A%09%09
+/*
 %0A%09%09
-//f
+ * F
 or c
@@ -1006,16 +1006,22 @@
 labels %0A
+%09%09 */%0A
 %09%09HashMa
@@ -1278,43 +1278,8 @@
 %0A%09%09%7D
-System.out.println(Classes.size());
 %0A%09%09%0A
@@ -1294,16 +1294,17 @@
 mTrees=1
+0
 ;%0A%09%09int 
@@ -1383,16 +1383,42 @@
 (2)+1);%0A
+%09%09int C = Classes.size();%0A
 %09%09Random
@@ -1473,16 +1473,19 @@
 , M, Ms,
+ C,
  Train, 
@@ -1501,96 +1501,14 @@
 RFC.
-C = Classes.size();%0A%09%09RFC.Start();%0A%09%09%0A%09%09//System.out.println(%22Printing traindata %22+Train
+Start(
 );%0A%09

Update MainRun.java