資源簡介
KNN算法詳解,查看我的博客關于KNN算法的淺析,博客連接:https://blog.csdn.net/wang_xiaogui/article/details/61413594............

代碼片段和文件信息
package?com.KNN;
public?class?KNNnode?implements?Comparable{
/**
?*?實現comparable接口重寫compareTo()方法
?*?目的:方便存放KNNnode對象的List進行排序,排序的目標屬性為l(即與待測點距離)
?*/
float?x1x2;??//特征值
String?type;??//特征值對應的類型
double?l?;?????//與待預測點的距離
public?float?getX1()?{
return?x1;
}
public?void?setX1(float?x1)?{
this.x1?=?x1;
}
public?float?getX2()?{
return?x2;
}
public?void?setX2(float?x2)?{
this.x2?=?x2;
}
public?String?getType()?{
return?type;
}
public?void?setType(String?type)?{
this.type?=?type;
}
public?double?getL()?{
return?l;
}
public?void?setL(double?l)?{
this.l?=?l;
}
@Override
public?String?toString()?{
return?“KNNnode?[x1=“?+?x1?+?“?x2=“?+?x2?+?“?type=“?+?type?+?“?l=“
+?l?+?“]“;
}
//從大到小排列
@Override
public?int?compareTo(KNNnode?o)?{
//?TODO?Auto-generated?method?stub
if(l>o.getL())
return?-1;
if(l return?1;
return?0;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\
?????文件?????????240??2017-03-29?18:02??KNN_wangxiaogui\knn.txt
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\
?????文件?????????301??2017-03-10?14:57??KNN_wangxiaogui\KNN_algorithm\.classpath
?????文件?????????389??2017-03-10?14:57??KNN_wangxiaogui\KNN_algorithm\.project
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\.settings\
?????文件?????????598??2017-03-10?14:57??KNN_wangxiaogui\KNN_algorithm\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\bin\
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\bin\com\
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\bin\com\KNN\
?????文件????????1850??2017-03-21?14:56??KNN_wangxiaogui\KNN_algorithm\bin\com\KNN\KNNnode.class
?????文件????????4021??2017-03-30?09:23??KNN_wangxiaogui\KNN_algorithm\bin\com\KNN\KNNprocess.class
?????文件????????2713??2017-03-30?09:24??KNN_wangxiaogui\KNN_algorithm\bin\com\KNN\TestKNN.class
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\src\
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\src\com\
?????目錄???????????0??2017-03-30?09:25??KNN_wangxiaogui\KNN_algorithm\src\com\KNN\
?????文件????????1123??2017-03-11?15:12??KNN_wangxiaogui\KNN_algorithm\src\com\KNN\KNNnode.java
?????文件????????3152??2017-03-30?09:23??KNN_wangxiaogui\KNN_algorithm\src\com\KNN\KNNprocess.java
?????文件????????1216??2017-03-30?09:24??KNN_wangxiaogui\KNN_algorithm\src\com\KNN\TestKNN.java
- 上一篇:exe4j注冊機
- 下一篇:android課程設計通訊錄代碼
評論
共有 條評論