-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunNaiveBayes.java
More file actions
52 lines (29 loc) · 1.37 KB
/
Copy pathRunNaiveBayes.java
File metadata and controls
52 lines (29 loc) · 1.37 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
import java.util.Scanner;
public class RunNaiveBayes {
public static void main ( String args[] ) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Cross Validation Fold Number: ");
System.out.println("Enter a negative value for NO cross validation: ");
int foldNumber = Integer.valueOf(sc.nextLine());
System.out.println("Enter File name of data set: ");
String fileName = sc.nextLine();
if (fileName == null || fileName.length() == 0) {
fileName = "project3_dataset1.txt";
}
System.out.println("Enter File name of testing data set: ");
String testFileName = sc.nextLine();
if (testFileName == null || testFileName.length() == 0) {
testFileName = fileName;
}
String path = "data/";
NaiveBayes nbHandler = new NaiveBayes(fileName, foldNumber);
double[][] featureMatrix = nbHandler.readFeatureValues(path, fileName);
double[][] testMatrix = nbHandler.readFeatureValues(path, testFileName);
nbHandler.startNaiveBayes(featureMatrix, testMatrix);
//double [][] normalizedMatrix = nbHandler.prepareFeatureMatrix(featureMatrix);
//List<NaiveBayes.MeanVariance>
/*Arrays.stream(normalizedMatrix).forEach(x -> {
System.out.println(Arrays.toString(x));
});*/
}
}