• 大小: 189KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-07-25
  • 语言: C#
  • 标签: 决策树  ID3  C#  

资源简介

利用ID3算法构建决策树,对汽车进行评价分类,并对数据进行分析;用c#实现程序开发

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace DecisionTree
{
    /// 
    /// 属性的表示:mValues,属性的取值范围;mName,属性的名称;mClass,最终的分类
    /// 

    public class Attribute
    {
        ArrayList mValues;
        string mName;
        object mClass;

        /// 
        /// 此类的构造函数,mClass为空
        /// 

        /// 属性的名称
        /// 属性的取值范围
        public Attribute(string name string[] values)
        {
            mName = name;
            mValues = new ArrayList(values);
            mValues.Sort();
        }

        public Attribute(object Label)
        {
            mClass = Label;
            mName = string.Empty;
            mValues = null;
        }

        /// 
        /// 返回此属性的名称
        /// 

        public string AttributeName
        {
            get
            {
                return mName;
            }
        }

        /// 
        /// 返回此属性的所有取值
        /// 

        public string[] values
        {
            get
            {
                if (mValues != null)
                    return (string[])mValues.ToArray(typeof(string));
                else
                    return null;
            }
        }

        /// 
        /// 判断某属性值是否属于此属性
        /// 

        /// 
        /// 
        public bool isValidValue(string value)
        {
            return indexValue(value) >= 0;
        }

        /// 
        /// 
        /// 

        /// 
        /// 
        public int indexValue(string value)
        {
            if (mValues != null)
                return mValues.BinarySearch(value);
            else
                return -1;
        }

        /// 
        /// 
        /// 

        /// 
        public override string ToString()
        {
            if (mName != string.Empty)
            {
                return mName;
            }
            else
            {
                return mClass.ToString();
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2521  2008-05-31 15:41  DecisionTree\DecisionTree\Attribute.cs

     文件      32768  2008-06-06 16:36  DecisionTree\DecisionTree\bin\Debug\DecisionTree.exe

     文件      56832  2008-06-06 16:36  DecisionTree\DecisionTree\bin\Debug\DecisionTree.pdb

     文件       5632  2005-11-11 22:25  DecisionTree\DecisionTree\bin\Debug\DecisionTree.vshost.exe

     目录          0  2009-03-20 14:49  DecisionTree\DecisionTree\bin\Debug

     目录          0  2009-03-20 14:49  DecisionTree\DecisionTree\bin

     文件       3389  2008-05-31 20:51  DecisionTree\DecisionTree\DecisionTree.csproj

     文件       2751  2008-06-01 11:23  DecisionTree\DecisionTree\DTreeNode.cs

     文件       9533  2008-06-06 16:24  DecisionTree\DecisionTree\DTree_ID3.cs

     文件       7636  2008-06-06 16:39  DecisionTree\DecisionTree\Entropy.cs

     文件      11163  2008-06-06 16:36  DecisionTree\DecisionTree\Form1.cs

     文件      10665  2008-06-06 11:45  DecisionTree\DecisionTree\Form1.Designer.cs

     文件       6216  2008-06-06 11:45  DecisionTree\DecisionTree\Form1.resx

     文件        842  2008-06-06 11:45  DecisionTree\DecisionTree\obj\Debug\DecisionTree.csproj.GenerateResource.Cache

     文件      32768  2008-06-06 16:36  DecisionTree\DecisionTree\obj\Debug\DecisionTree.exe

     文件        180  2008-06-06 11:45  DecisionTree\DecisionTree\obj\Debug\DecisionTree.ID3_Tree.resources

     文件      56832  2008-06-06 16:36  DecisionTree\DecisionTree\obj\Debug\DecisionTree.pdb

     文件        180  2008-05-31 14:49  DecisionTree\DecisionTree\obj\Debug\DecisionTree.Properties.Resources.resources

     目录          0  2009-03-20 14:49  DecisionTree\DecisionTree\obj\Debug\Refactor

     目录          0  2009-03-20 14:49  DecisionTree\DecisionTree\obj\Debug\TempPE

     目录          0  2009-03-20 14:49  DecisionTree\DecisionTree\obj\Debug

     文件        306  2008-06-06 16:39  DecisionTree\DecisionTree\obj\DecisionTree.csproj.FileList.txt

     文件        938  2008-06-01 11:31  DecisionTree\DecisionTree\obj\DecisionTree.csproj.FileListAbsolute.txt

     目录          0  2009-03-20 14:49  DecisionTree\DecisionTree\obj

     文件        474  2008-05-31 14:44  DecisionTree\DecisionTree\Program.cs

     文件       1196  2008-05-31 14:42  DecisionTree\DecisionTree\Properties\AssemblyInfo.cs

     文件       2879  2008-05-31 14:42  DecisionTree\DecisionTree\Properties\Resources.Designer.cs

     文件       5612  2008-05-31 14:42  DecisionTree\DecisionTree\Properties\Resources.resx

     文件       1096  2008-05-31 14:42  DecisionTree\DecisionTree\Properties\Settings.Designer.cs

     文件        249  2008-05-31 14:42  DecisionTree\DecisionTree\Properties\Settings.settings

............此处省略10个文件信息

评论

共有 条评论