-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunRandomForestBoosting.java
More file actions
56 lines (41 loc) · 1.72 KB
/
Copy pathRunRandomForestBoosting.java
File metadata and controls
56 lines (41 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.List;
import java.util.Random;
import java.util.Scanner;
/**
* Created by VenkataRamesh on 12/10/2016.
*/
public class RunRandomForestBoosting {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter File name of data set: ");
String fileName = sc.nextLine();
if (fileName == null || fileName.length() == 0) {
fileName = "project3_dataset1.txt";
}
String path = "data/";
Random rand = new Random(10);
int trees = rand.nextInt(100);
int randAttrVal = 25;
System.out.println("Enter File name of testing data set: ");
String testFileName = sc.nextLine();
if (testFileName == null || testFileName.length() == 0) {
testFileName = fileName;
}
RandomForestBoosting randomForest = new RandomForestBoosting(trees, fileName, randAttrVal);
double[][] dataMatrix = randomForest.readDataSet(path, fileName);
double[][] testMatrix = randomForest.readDataSet(path, testFileName);
List<DecisionNode> randomTrees = randomForest.runTreeInductionAlgo(dataMatrix, trees, randAttrVal);
if (testFileName != null && testFileName.length() > 0) {
randomForest.validateRandomForest(testMatrix, randomTrees);
} else {
randomForest.validateRandomForest(dataMatrix, randomTrees);
}
//double[][] distanceMatrix = KNN.calculateDistanceMatrix();
/*Arrays.stream(matrix).forEach(x -> {
System.out.println(Arrays.toString(x));
});*/
/* Arrays.stream(distanceMatrix).forEach(x -> {
System.out.println(Arrays.toString(x));
});*/
}
}