亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? form1.cs.txt

?? 基于決策樹和貝葉斯的預測分析器
?? TXT
?? 第 1 頁 / 共 5 頁
字號:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using DecisionTree;

namespace DecisionTreeAlgorithm
{
    public partial class Form1 : Form
    {
        enum attributeSelectionMethodType { InformationGain, GainRate, Gini };
        enum ageType { year0_20, year21_30, year31_40, year41_50, year51_60, yearover60 };
        enum educationType { edu1_3, edu4_6, edu7_9, edu10_12, edu13_14, edu15_16 };
        enum occupationType {Tech_support, Craft_repair, Other_service, Sales, Exec_managerial, Prof_specialty,
            Handlers_cleaners, Machine_op_inspct, Adm_clerical, Farming_fishing, Transport_moving,
            Priv_house_serv, Protective_serv, Armed_Forces};
        enum sexType { Male, Female };
        enum native_countryType { developNO1, developNO2, developNO3, developNO4, developNO5};
        enum makeover50kType { yes, no };

        /* 1、 ageType分6類:<=20為year0_20,21-30為year21_30,31-40為year31_40,41-50為year41_50,51-60為year51_60,>=61為yearover60
           2、 原有education_numType: 1-16  ,分成6級:   edu1_3,edu4_6,edu7_9,edu10_12,edu13_14,edu15_16
           3、 occupationType共14類:Tech_support, Craft_repair, Other_service, Sales, Exec_managerial, Prof_specialty,
                   Handlers_cleaners, Machine_op_inspct, Adm_clerical, Farming_fishing, Transport_moving, 
                   Priv_house_serv, Protective_serv, Armed_Forces
           4 、原有native-countryType分成5類developNO1,developNO2,developNO3,developNO4,developNO5后:
              developNO1:(<0.1)       Outlying-US(Guam-USVI-etc),Vietnam,Mexico,Dominican-Republic,Laos,Haiti,Hungary,
				                 Guatemala,Nicaragua,Scotland,El-Salvador,Trinadad&Tobago,Holand-Netherlands	
              developNO2:(>=0.1 <0.2)  Puerto-Rico,South,China,Cuba,Poland,Jamaica,Portugal,Ireland,Ecuador,Peru,?
              developNO3:(>=0.2 <0.3)  Honduras,France,Columbia,United-States,England,Germany,Greece,Philippines,Thailand,         
                                  Yugoslavia
              developNO4:(>=0.3 <0.4)  India.Japan.
              developNO5:(>=0.4 )      Cambodia,Canada,Iran,Italy,Taiwan,Hong      
           5、sexType分為Male、Female兩類
         */

        struct Item
        {
            public int ID;
            public ageType age;
            public educationType education;
            public occupationType occupation;
            public sexType sex;
            public native_countryType native_country;
            public makeover50kType makeover50k;
        }

        private attributeSelectionMethodType attributeSelectionMethod;      //屬性選擇度量模式
        public ArrayList al;                                                //測試數據
        private ArrayList attributeList;
        

        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: 這行代碼將數據加載到表“adult_dataDataSet.traindata2”中。您可以根據需要移動或移除它。
            this.traindata2TableAdapter.Fill(this.adult_dataDataSet.traindata2);
            // TODO: 這行代碼將數據加載到表“adult_dataDataSet.traindata1”中。您可以根據需要移動或移除它。
            this.traindata1TableAdapter.Fill(this.adult_dataDataSet.traindata1);
            // TODO: 這行代碼將數據加載到表“adult_dataDataSet.testdata2”中。您可以根據需要移動或移除它。
            this.testdata2TableAdapter.Fill(this.adult_dataDataSet.testdata2);
            // TODO: 這行代碼將數據加載到表“adult_dataDataSet.testdata1”中。您可以根據需要移動或移除它。
            this.testdata1TableAdapter.Fill(this.adult_dataDataSet.testdata1);
           
            attributeSelectionMethod = attributeSelectionMethodType.InformationGain;
            al = new ArrayList();
            attributeList = new ArrayList();

        }



        private void databasetoArray()
        {
            Item testItem;
            int rownum = dataGridView1.RowCount;
            int i;
            al.Clear();
            for (i = 0; i < rownum - 1; i++)
            {
                testItem = new Item();
                testItem.ID = al.Count + 1;
                testItem.age = (ageType)Enum.Parse(typeof(ageType), dataGridView1.Rows[i].Cells[0].Value.ToString());
                testItem.education = (educationType)Enum.Parse(typeof(educationType), dataGridView1.Rows[i].Cells[1].Value.ToString());
                testItem.occupation = (occupationType)Enum.Parse(typeof(occupationType), dataGridView1.Rows[i].Cells[2].Value.ToString());
                testItem.sex = (sexType)Enum.Parse(typeof(sexType), dataGridView1.Rows[i].Cells[3].Value.ToString());
                testItem.native_country = (native_countryType)Enum.Parse(typeof(native_countryType), dataGridView1.Rows[i].Cells[4].Value.ToString());
                testItem.makeover50k = (makeover50kType)Enum.Parse(typeof(makeover50kType), dataGridView1.Rows[i].Cells[5].Value.ToString());
                al.Add(testItem);
            }

        }



        private void infomationGainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.infomationGainToolStripMenuItem.Checked = true;
            this.gainRateToolStripMenuItem.Checked = false;
            this.giniToolStripMenuItem.Checked = false;
            attributeSelectionMethod = attributeSelectionMethodType.InformationGain;
            CreateTree();

        }

        private void gainRateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.infomationGainToolStripMenuItem.Checked = false;
            this.gainRateToolStripMenuItem.Checked = true;
            this.giniToolStripMenuItem.Checked = false;
            attributeSelectionMethod = attributeSelectionMethodType.GainRate;
            CreateTree();
        }

        private void giniToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.infomationGainToolStripMenuItem.Checked = false;
            this.gainRateToolStripMenuItem.Checked = false;
            this.giniToolStripMenuItem.Checked = true;
            attributeSelectionMethod = attributeSelectionMethodType.Gini;
            CreateTree();
        }

        private void CreateTree()
        {
            if (istraindata2 == false ) //確保選擇的是“清理后的訓練數據集”
            {
                MessageBox.Show("請先輸入清理后的訓練數據集,并重新選擇決策樹度量屬性");
                testtextBox.Text = "";

            }
            else
            {
                switch (attributeSelectionMethod)
                {
                    case attributeSelectionMethodType.InformationGain:
                        break;
                    case attributeSelectionMethodType.GainRate:
                        break;
                    case attributeSelectionMethodType.Gini:
                        break;
                    default:
                        MessageBox.Show("請選擇正確的決策樹度量屬性");
                        break;
                }
            
            this.DecisionTree.Nodes.Clear();
            testtextBox.Text = "";

            attributeList.Clear();
            attributeList.Add("age");
            attributeList.Add("education");
            attributeList.Add("occupation");
            attributeList.Add("sex");
            attributeList.Add("native_country");
            this.DecisionTree.Nodes.Add(GenerateDecisionTree(al, attributeList));
            }
           
        }

        
        //算法:Generate_decision_tree。由數據劃分D的訓練元組產生決策樹。
        private TreeNode GenerateDecisionTree(ArrayList d, ArrayList attribute_list)
        {
            //(1)  創建一個節點N
            TreeNode temp = new TreeNode(); 

            //(2)  ifD中的元組都是同一類C then
            string C = FindSameClass(d);
            if (C != null)

            //(3)  返回N作為葉節點,以類C標記
            {
                temp.Text = C;
                return temp;
            }

            //(4)  if attribute_list為空 then
            if (attribute_list.Count == 0)

            //(5)  返回N作為葉子節點,標記為D中的多數類;//多數表決
            {
                temp.Text = FindMoreClass(d);
                return temp;
            }

            //(6)  使用attribute_selection_method(D,attribute_list),找出“最好”的splitting_criterion
            SplitCriterion splittingCriterion = AttributeSelectionMethod(d, attribute_list);

            //(7)  用splitting_criterion標記節點N
            temp.Text = splittingCriterion.attribute;

            //(8)  if splitting_attribute是離散值的并且允許多路劃分 then //不限于二叉樹
            if (true)//假定總是離散的并且允許多路劃分

            //(9)  attribute_list<--attribute_list-splitting_attribute //刪除劃分屬性
            {
                attribute_list.Remove(splittingCriterion.attribute);
            }

            //(10) for splitting_criterion的每個輸出j //劃分元組并對每個劃分產生子樹            
            for (int i = 0; i < splittingCriterion.splitList.Count; i++)
            {
                //(11) 設Dj是D中滿足輸出j的數據元組的集合 //一個劃分
                ArrayList Dj = (ArrayList)splittingCriterion.splitList[i];

                //(12) if Dj為空 then
                if (Dj.Count == 0)

                //(13) 加一個樹葉到節點N,標記為D中的多數類
                {
                    TreeNode leaf = new TreeNode();
                    leaf.Text = FindMoreClass(d);
                    temp.Nodes.Add(leaf);
                }

                //(14) else 加一個由 Generate_decision_tree(Dj,attribute_list)返回的節點到節點N
                else
                {
                    TreeNode leaf = GenerateDecisionTree(Dj, new ArrayList(attribute_list));
                    leaf.Text = splittingCriterion.descriptionList[i].ToString() + "&&" + leaf.Text;
                    temp.Nodes.Add(leaf);
                }

                //     end for
            }

            //(15) 返回N
            return temp;
        }

        //尋找D中的同一類C,找到返回C的名稱,找不到返回NULL。
        private string FindSameClass(ArrayList d)
        {
            Item temp = new Item();
            bool find;

            find = true;
            for (int i = 0; i < d.Count; i++)
            {
                if (i == 0)
                {
                    temp.makeover50k = ((Item)d[i]).makeover50k;
                }
                else
                {
                    if (temp.makeover50k != ((Item)d[i]).makeover50k)
                    {
                        find = false;
                        break;
                    }
                }
            }
            if (find) return " => makeover50k=" + temp.makeover50k.ToString();

            return null;
        }

        //尋找D中的多數類
        private string FindMoreClass(ArrayList d)
        {
            int count = 0;
            string temp = " => makeover50k=";
            for (int i = 0; i < d.Count; i++)
            {
                if (((Item)d[i]).makeover50k == makeover50kType.yes)
                    count++;
            }
            if (2 * count >= d.Count)
                return temp + "yes";
            else
                return temp + "no";

        }

        //找出“最好”的splitting_criterion
        private SplitCriterion AttributeSelectionMethod(ArrayList d, ArrayList attribute_list)
        {
            SplitCriterion splitting_criterion = new SplitCriterion();
            switch (attributeSelectionMethod)
            {
                case attributeSelectionMethodType.InformationGain:
                    //double info;           //按類劃分的期望信息
                    double infoA;          //按A劃分的期望信息
                    //double gainA;           //信息增益

                    //計算info
                    /*
                    info = Info(d);
                    */

                    //計算最小的InfoA和選擇的屬性
                    infoA = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人成网站精品片在线观看| 蜜臀av一区二区在线观看 | 欧美久久久久中文字幕| 国产成人自拍高清视频在线免费播放| 美女一区二区在线观看| 日韩精彩视频在线观看| 日本特黄久久久高潮 | 欧美日韩国产综合久久 | 又紧又大又爽精品一区二区| 国产精品视频麻豆| 国产精品久久久久婷婷二区次| 中文av字幕一区| 亚洲欧美激情在线| 午夜视黄欧洲亚洲| 91蝌蚪国产九色| 91蜜桃婷婷狠狠久久综合9色| 色综合久久久久综合体| 欧美性猛交xxxxxx富婆| 欧美顶级少妇做爰| 精品国产一区二区三区久久久蜜月 | 日本vs亚洲vs韩国一区三区二区| 蜜桃一区二区三区在线| 精品一区二区三区免费观看| 国产精品亚洲午夜一区二区三区| 成人午夜激情视频| 色呦呦国产精品| 69成人精品免费视频| 26uuu精品一区二区三区四区在线| 久久精品一区四区| 亚洲日本韩国一区| 午夜精品123| 狠狠色丁香婷婷综合久久片| www.欧美亚洲| 欧美人xxxx| 久久免费美女视频| 亚洲婷婷综合色高清在线| 亚洲第一成人在线| 国产精品自拍在线| 91视视频在线观看入口直接观看www | 捆绑调教美女网站视频一区| 国产精品一区二区视频| 91福利视频在线| 精品区一区二区| 国产精品国产三级国产aⅴ中文 | 国产精品国模大尺度视频| 亚洲国产日韩精品| 欧美午夜一区二区三区免费大片| 欧美一区二区黄色| 国产精品久久久久久久蜜臀| 丝袜亚洲另类丝袜在线| 国产一区三区三区| 欧美亚洲日本国产| 国产亚洲欧美一级| 亚洲综合成人在线视频| 国产精品一二三四| 欧美日韩国产小视频| 国产精品婷婷午夜在线观看| 午夜免费欧美电影| 99国产精品视频免费观看| 日韩美女视频在线| 一区二区三区免费网站| 国产不卡免费视频| 日韩欧美国产三级电影视频| 一区二区三区四区视频精品免费 | 久久99久久精品| 日本电影欧美片| 国产欧美日韩亚州综合| 视频一区二区不卡| 色哟哟一区二区| 国产女人aaa级久久久级| 日本视频在线一区| 欧洲一区在线电影| 亚洲欧洲色图综合| 国产精品影视在线观看| 日韩一级二级三级| 午夜精品福利一区二区三区蜜桃| 不卡视频一二三| 国产亚洲一区二区在线观看| 看片的网站亚洲| 欧美色图在线观看| 亚洲精品国产第一综合99久久 | 国产亚洲女人久久久久毛片| 首页亚洲欧美制服丝腿| 欧洲国内综合视频| 亚洲狠狠丁香婷婷综合久久久| 成人美女视频在线看| 国产午夜精品久久久久久久| 精品一区二区三区的国产在线播放| 欧美日韩亚洲综合一区| 亚洲激情男女视频| 91免费视频大全| 亚洲精品国产一区二区三区四区在线| 成人毛片老司机大片| 中文在线免费一区三区高中清不卡| 麻豆精品一区二区综合av| 欧美一区日本一区韩国一区| 婷婷亚洲久悠悠色悠在线播放| 欧美体内she精高潮| 亚洲国产裸拍裸体视频在线观看乱了 | 欧美午夜精品久久久| 亚洲男同性恋视频| 色综合天天性综合| 亚洲啪啪综合av一区二区三区| 97久久久精品综合88久久| 日韩毛片在线免费观看| 色婷婷综合五月| 亚洲一线二线三线久久久| 欧美三级蜜桃2在线观看| 亚洲国产成人porn| 91精品综合久久久久久| 男女男精品网站| 欧美变态tickle挠乳网站| 国产毛片一区二区| 国产精品久久久久久久久动漫 | 欧美一级艳片视频免费观看| 美腿丝袜亚洲一区| www一区二区| 国产成人高清在线| 亚洲乱码国产乱码精品精小说| 欧美亚洲日本国产| 免费看黄色91| 久久精品亚洲国产奇米99| www.日韩精品| 亚洲一区二区三区四区五区黄| 777a∨成人精品桃花网| 精品中文字幕一区二区| 亚洲国产高清不卡| 日本高清免费不卡视频| 美国三级日本三级久久99| 2020国产成人综合网| av电影在线观看一区| 亚洲一区二区视频在线| 精品国产露脸精彩对白| 不卡欧美aaaaa| 成+人+亚洲+综合天堂| 亚洲一区精品在线| 欧美电影免费观看高清完整版在线观看| 国产一区二区免费在线| 最新日韩av在线| 555www色欧美视频| 风间由美一区二区av101| 亚洲午夜在线电影| 精品国产乱码久久久久久图片 | 91精品国产黑色紧身裤美女| 国产精品99久久久久久久女警| 亚洲黄一区二区三区| 精品国产伦一区二区三区免费| 91丨porny丨中文| 久久99深爱久久99精品| 一区二区三区在线视频观看| 欧美成人三级在线| 91丨九色porny丨蝌蚪| 免费高清在线一区| 综合av第一页| 久久在线免费观看| 欧美日韩一区久久| 不卡的av在线| 精品一区二区日韩| 亚洲一区在线观看免费| 久久婷婷一区二区三区| 欧美影片第一页| 成人精品电影在线观看| 日本vs亚洲vs韩国一区三区二区| 亚洲天堂精品在线观看| 精品理论电影在线| 欧美性欧美巨大黑白大战| 国产成人精品aa毛片| 青青草国产成人99久久| 亚洲欧洲制服丝袜| 久久精品一区蜜桃臀影院| 欧美福利视频导航| 色婷婷久久综合| 国产精品自在欧美一区| 美女视频黄久久| 亚洲成人精品一区| 自拍偷自拍亚洲精品播放| 久久久av毛片精品| 欧美一区二区在线免费播放| 色婷婷久久久亚洲一区二区三区| 国产一区二区三区观看| 日产精品久久久久久久性色| 一区二区三区四区在线免费观看 | 99久久精品免费看| 精品一二三四区| 首页国产丝袜综合| 亚洲精品ww久久久久久p站 | 黄一区二区三区| 五月天激情综合| 亚洲激情六月丁香| 亚洲少妇屁股交4| 久久久www成人免费无遮挡大片| 日韩精品中文字幕一区二区三区| 欧美日韩一区二区欧美激情| 色综合久久99| 91免费看片在线观看| 91在线porny国产在线看| 成人一区二区视频| 国产成人自拍网| 高清久久久久久| 成人va在线观看|