-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassify.java
More file actions
36 lines (29 loc) · 830 Bytes
/
Copy pathClassify.java
File metadata and controls
36 lines (29 loc) · 830 Bytes
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
import java.io.File;
import java.util.List;
import java.util.Scanner;
/**
* Created by arsee on 01.06.2017.
*/
public class Classify {
int num_of_features=3600;
double w []= new double[num_of_features+1];
String path ="java-svm.model";
Classify()throws Exception{
Scanner sc = new Scanner(new File(path));
sc.nextLine();
sc.nextLine();
sc.nextLine();
sc.nextLine();
sc.nextLine();
for (int i=1;i<=num_of_features;i++){
w[i]=Double.parseDouble(sc.nextLine());
}
}
public boolean classOf(List<Double> ar){
double sum=0;
for(int i=1;i<=num_of_features;i++){
sum+=w[i]*ar.get(i-1);
}
return (sum>0);
}
}