资 源 简 介
k-means算法在单机上的MapReduce实现
public ArrayList> getrandomCenters(String filepath)
throws NumberFormatException, IOException {
BufferedReader reader = new BufferedReader(new FileReader(filepath));
int mk = KmeansDriver.getMk();
int i = 0;
String line = "";
ArrayList tmpDataList = new ArrayList ();
ArrayList> randomCenterList = new ArrayList>();
while ((line = reader.readLine()) != null && tmpDataList.size() < mk*20) {
if (line.trim().length() == 0) {
continue;
}
i++;
String[] dataList = line.split(",");
for(String data : dataList){
tmpDataList.add(data);
}