资源简介

数据挖掘的课程作业实现,两种算法的实现,包括测试数据,可执行程序和源代码,及两个算法实现的对比截图。

资源截图

代码片段和文件信息

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace FPTree// FPTree获取频繁模式
{
    public partial class FormFPTree : Form
    {
        static int MinSupCount = 1000;// 最小支持度计数
        static int MinSupPercent = 8;// 最小支持度
        static int TotalItems = 0;// 事务数据库中的所有事务总数
        static string _testSet = ““;// 测试集的文件名
        public FormFPTree()
        {
            InitializeComponent();
        }
        private void DoAnalysis(string _dataSetFileName)// 分析数据
        {
            //FPTree
            FPTree _fpTree = new FPTree();
            //FPTree挖掘
            FPGrowthFacade _fpGrowthFacade = new FPGrowthFacade();    

            DateTime _dateTimeStart = DateTime.Now; 
            //读取数据集并遍历取得频繁一项集
            ReadFile(_dataSetFileName _fpTree);

            _fpTree.InitializeFPTree();
          
            _fpGrowthFacade.FPGrowth(_fpTree null);

            _content.Text = ““;

            if (_fpGrowthFacade.FrequentPattern.Count > 0)
            {
                DateTime _dateTimeEnd = DateTime.Now;
                TimeSpan _span = (_dateTimeEnd - _dateTimeStart);               

                _content.Text += “程序分析总时间:“ + _span.TotalSeconds.ToString() + “\r\n“ +“\r\n\r\n“;              

                foreach (DictionaryEntry _entry in _fpGrowthFacade.FrequentPattern)
                {
                    List _tmpItemSetList = (List)_fpGrowthFacade.FrequentPattern[_entry.Key];
                    _content.Text += “频繁“ + _entry.Key + “项集“ + _tmpItemSetList.Count+ “个\r\n“;
                    
                    foreach (ItemSet _itemSet in _tmpItemSetList)
                    {
                        string[] _contents = new string[_itemSet.Content.Count];
                        _itemSet.Content.CopyTo(_contents);
                        _content.Text += ShowInOrder(_fpTree _contents) + “————“ + _itemSet.Count + “\r\n“;
                    }
                }
                _content.Text += “频繁一项集“ + _fpTree.FrequentItemCount + “个:\r\n“;
                foreach (DictionaryEntry _entry in _fpTree.HashFrequentItemTable)
                {
                    _content.Text += _entry.Key + “————“ + _entry.Value.ToString() + “\r\n“;
                }
            }
            _fpTree.DisposeAll();
            _fpGrowthFacade.DisposeAll();
        }

        private string ShowInOrder(FPTree _fpTree string[] _contents)//按顺序显示字符
        {
            int[] _indexs = new int[_contents.Length];
            for (int i = 0; i < _indexs.Length; i++)
            {
                _indexs[i] = _fpTree.GetSupCountByID(_contents[i]);
            }
            int count = _indexs.Length;
            for (int bubble = 0; bubble < count; bubble++)
            {
                fo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       58750  2012-04-12 19:41  0.07.PNG
     目录           0  2012-04-12 18:46  可执行的程序\
     文件       24064  2012-04-16 20:35  可执行的程序\FPTree.exe
     文件       17408  2012-04-12 18:36  可执行的程序\MyApriori.exe
     文件       53508  2012-04-12 19:20  图1.PNG
     目录           0  2012-04-16 21:13  测试数据\
     文件      345490  2012-04-11 21:20  测试数据\chess.dat
     文件          53  2012-03-27 22:29  测试数据\chess1.dat
     文件     4167490  2012-03-14 12:32  测试数据\retail.dat
     目录           0  2012-09-09 10:58  源代码\
     目录           0  2012-04-16 21:10  源代码\FP__Tree\
     目录           0  2008-01-06 09:44  源代码\FP__Tree\FPTree\
     文件         908  2012-04-12 13:08  源代码\FP__Tree\FPTree.sln
     文件       32256  2012-09-09 10:58  源代码\FP__Tree\FPTree.suo
     目录           0  2008-01-06 09:44  源代码\FP__Tree\FPTree\bin\
     目录           0  2012-04-16 20:23  源代码\FP__Tree\FPTree\bin\Debug\
     文件       24064  2012-04-16 20:35  源代码\FP__Tree\FPTree\bin\Debug\FPTree.exe
     文件       83456  2012-04-16 20:35  源代码\FP__Tree\FPTree\bin\Debug\FPTree.pdb
     文件       11608  2012-09-09 10:58  源代码\FP__Tree\FPTree\bin\Debug\FPTree.vshost.exe
     文件         490  2010-03-18 14:39  源代码\FP__Tree\FPTree\bin\Debug\FPTree.vshost.exe.manifest
     文件        8110  2012-04-16 21:09  源代码\FP__Tree\FPTree\FormFPTree.cs
     文件        6636  2012-04-16 21:09  源代码\FP__Tree\FPTree\FormFPTree.Designer.cs
     文件        6191  2012-04-16 21:09  源代码\FP__Tree\FPTree\FormFPTree.resx
     文件       11435  2012-04-16 21:01  源代码\FP__Tree\FPTree\FPGrowthFacade.cs
     文件       14532  2012-04-16 21:04  源代码\FP__Tree\FPTree\FPTree.cs
     文件        3980  2012-04-12 13:08  源代码\FP__Tree\FPTree\FPTree.csproj
     文件         374  2012-04-12 13:08  源代码\FP__Tree\FPTree\FPTree.csproj.user
     文件        1276  2008-01-02 19:50  源代码\FP__Tree\FPTree\FrequentItem.cs
     文件         661  2012-04-16 21:05  源代码\FP__Tree\FPTree\FrequentlinkItem.cs
     文件         779  2012-04-16 21:05  源代码\FP__Tree\FPTree\ItemInfo.cs
     文件        1053  2012-04-16 21:06  源代码\FP__Tree\FPTree\ItemSet.cs
............此处省略68个文件信息

评论

共有 条评论