freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

決策樹程序?qū)嶒?yàn)(編輯修改稿)

2024-09-01 02:51 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 private ArrayListString attrList = null。 //候選屬性集 public Gain(ArrayListArrayListString datas, ArrayListString attrList) { = datas。 = attrList。 } /** * 獲取最佳侯選屬性列上的值域(假定所有屬性列上的值都是有限的名詞或分類類型的) * @param attrIndex 指定的屬性列的索引 * @return 值域集合 */ public ArrayListString getValues(ArrayListArrayListString datas, int attrIndex){ ArrayListString values = new ArrayListString()。 String r = 。 for (int i = 0。 i ()。 i++) { r = (i).get(attrIndex)。 if (!(r)) { (r)。 } } return values。 } /** * 獲取指定數(shù)據(jù)集中指定屬性列索引的域值及其計(jì)數(shù) * @param d 指定的數(shù)據(jù)集 * @param attrIndex 指定的屬性列索引 * @return 類別及其計(jì)數(shù)的map */ public MapString, Integer valueCounts(ArrayListArrayListString datas, int attrIndex){ MapString, Integer valueCount = new HashMapString, Integer()。 String c = 。 ArrayListString tuple = null。 for (int i = 0。 i ()。 i++) { tuple = (i)。 c = (attrIndex)。 if ((c)) { (c, (c) + 1)。 } else { (c, 1)。 } } return valueCount。 } /** * 求對(duì)datas中元組分類所需的期望信息,即datas的熵 * @param datas 訓(xùn)練元組 * @return datas的熵值 */ public double infoD(ArrayListArrayListString datas){ double info = 。 int total = ()。 MapString, Integer classes = valueCounts(datas, ())。 Iterator iter = ().iterator()。 Integer[] counts = new Integer[()]。 for(int i = 0。 ()。 i++) { entry = () ()。 Integer val = (Integer) ()。 counts[i] = val。 } for (int i = 0。 i 。 i++) { double base = (counts[i], total, 3)。 info += (1) * base * (base)。 } return info。 } /** * 獲取指定屬性列上指定值域的所有元組 * @param attrIndex 指定屬性列索引 * @param value 指定屬性列的值域 * @return 指定屬性列上指定值域的所有元組 */ public ArrayListArrayListString datasOfValue(int attrIndex, String value){ ArrayListArrayListString Di = new ArrayListArrayListString()。 ArrayListString t = null。 for (int i = 0。 i ()。 i++) { t = (i)。 if((attrIndex).equals(value)){ (t)。 } } return Di。 } /** * 基于按指定屬性劃分對(duì)D的元組分類所需要的期望信息 * @param attrIndex 指定屬性的索引 * @return 按指定屬性劃分的期望信息值 */ public double infoAttr(int attrIndex){ double info = 。 ArrayListString values = getValues(D, attrIndex)。 for (int i = 0。 i ()。 i++) { ArrayListArrayListString dv = datasOfValue(attrIndex, (i))。 info += (((), (), 3), infoD(dv))。 } return info。 } /** * 獲取最佳分裂屬性的索引 * @return 最佳分裂屬性的索引 */ public int bestGainAttrIndex(){ int index = 1。 double gain = 。 double tempGain = 。 for (int i = 0。 i ()。 i++) { tempGain = infoD(D) infoAttr(i)。 if (tempGain gain) { gain = tempGain。 index = i。 } } return index。 }}package DecisionTree。import 。import 。import 。import 。import .*。/** * 決策樹構(gòu)造類 */public class DecisionTree { private Integer attrSelMode。 //最佳分裂屬性選擇模式,1表示以信息增益度量,2表示以信息增益率度量。暫未實(shí)現(xiàn)2 public DecisionTree(){ = 1。 } public DecisionTree(int attrSelMode) { = attrSelMode。 } public void setAttrSelMode(Integer attrSelMode) { = attrSelMode。 } /** * 獲取指定數(shù)據(jù)集中的類別及其計(jì)數(shù) * @param datas 指定的數(shù)據(jù)集 * @return 類別及其計(jì)數(shù)的map */ public MapString, Int
點(diǎn)擊復(fù)制文檔內(nèi)容
物理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1