knn算法java实现
(2015-08-25 17:52:03)
转载▼
分类:机器学习
标签:
股票
KNN类:
package KNN;
import java.util.ArrayList;
import http://www.doczj.com/doc/de193f3e524de518974b7d9a.htmlparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
public class KNN {
private Comparator comparator = new Comparator() { public int compare(KNNNode o1, KNNNode o2) {
if (o1.getDistance() >= o2.getDistance()) {
return 1;
} else {
return 0;
}
}
};