資源簡介
自己寫了個Apriori算法,方法應該和網(wǎng)上的不同,有興趣的同學,供大家免費學習參考一下。不知道為什么不能發(fā)到博客上。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Collections.Generic;
namespace?Apriori算法
{
????class?Program
????{
????????public?static?int?support?=?2;???????//支持度???????2???????????????2
????????public?static?float?confidence?=?0.4f;???//置信度??????0.7f??????????????0.4
????????static?void?Main(string[]?args)
????????{
????????????
????????????
??????????//**********第一組數(shù)據(jù)
????????????/*
????????????String[]?T1?=?{?“z_1“?“z_2“?“z_5“?};
????????????String[]?T2?=?{?“z_2“?“z_4“?};
????????????String[]?T3?=?{?“z_2“?“z_3“?};
????????????String[]?T4?=?{?“z_1“?“z_2“?“z_4“?};
????????????String[]?T5?=?{?“z_1“?“z_3“?};
????????????String[]?T6?=?{?“z_2“?“z_3“?};
????????????String[]?T7?=?{?“z_1“?“z_3“?};
????????????String[]?T8?=?{?“z_1“?“z_2“?“z_3“?“z_5“?};
????????????String[]?T9?=?{?“z_1“?“z_2“?“z_3“?};?????????????????????
??????????????List?list?=?new?List{T1T2T3T4T5T6T7T8T9};
?????????????*/
????????????
????????????//*******第二組數(shù)據(jù)
????????????String[]?T1?=?{?“z_1“?“z_3“?“z_4“?};
????????????String[]?T2?=?{?“z_2“?“z_3“?“z_5“?};
????????????String[]?T3?=?{?“z_1“?“z_2“?“z_3“?“z_5“?};
????????????String[]?T4?=?{?“z_2“?“z_5“?};
????????????List?list?=?new?List?{?T1?T2?T3?T4?};
????????????
????????????string[]?everyId?=?getEveryId(list);
????????????Dictionary?gather?=?getGather(everyId?list);???//第一次存取,?項集為?1個元素
????????????Dictionary?second_gather?=?getGather_Sceond(gather?list);???//第二次存取,?項集為?2個元素
????????????Dictionary?third_gather?=?getGather_Third(second_gather?list);???//第三次存取,?項集為?3個元素
????????????????while?(true)?
????????????????{
????????????????????if?(third_gather.Count?!=?0)
????????????????????{
????????????????????????if?(isUser(third_gather?second_gather?list))
????????????????????????{
????????????????????????????second_gather?=?null;
????????????????????????????second_gather?=?third_gather;
????????????????????????????third_gather?=?null;
????????????????????????????third_gather?=?getGather_Third(second_gather?list);
????????????????????????}
????????????????????????else
????????????????????????{
????????????????????????????second_gather?=?third_gather;
????????????????????????????break;
????????????????????????}
????????????????????}
????????????????????else?{
????????????????????????break;
????????????????????}
??????????????}
???????????????Dictionary?Result_start?=?Out_Result(second_gather?list);??//未篩選?????????*******未顯示
???????????????Dictionary?Result_over?=?Result_start;??????????????????????//已經(jīng)篩選完成的???*********顯示
???????????????for?(int?i?=?0;?i????????????????{
???????????????????string?a?=?Result_over.Keys.ElementAt(i);
???????????????????float?b?=?Result_over.Values.ElementAt(i);
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-05-07?09:28??Apriori算法\
?????文件?????????189??2017-04-28?14:11??Apriori算法\App.config
?????文件????????2569??2017-04-28?15:04??Apriori算法\Apriori算法.csproj
?????目錄???????????0??2017-05-07?09:28??Apriori算法\bin\
?????目錄???????????0??2017-05-07?09:28??Apriori算法\bin\Debug\
?????文件???????11264??2017-05-03?17:06??Apriori算法\bin\Debug\Apriori算法.exe
?????文件?????????189??2017-04-28?14:11??Apriori算法\bin\Debug\Apriori算法.exe.config
?????文件???????30208??2017-05-03?17:06??Apriori算法\bin\Debug\Apriori算法.pdb
?????文件???????22984??2017-05-07?09:23??Apriori算法\bin\Debug\Apriori算法.vshost.exe
?????文件?????????189??2017-04-28?14:11??Apriori算法\bin\Debug\Apriori算法.vshost.exe.config
?????文件?????????490??2016-07-16?19:44??Apriori算法\bin\Debug\Apriori算法.vshost.exe.manifest
?????目錄???????????0??2017-05-07?09:28??Apriori算法\obj\
?????目錄???????????0??2017-05-07?09:28??Apriori算法\obj\Debug\
?????文件?????????448??2017-05-07?09:23??Apriori算法\obj\Debug\Apriori算法.csproj.FileListAbsolute.txt
?????文件????????1769??2017-04-28?15:04??Apriori算法\obj\Debug\Apriori算法.csprojResolveAssemblyReference.cache
?????文件???????11264??2017-05-03?17:06??Apriori算法\obj\Debug\Apriori算法.exe
?????文件???????30208??2017-05-03?17:06??Apriori算法\obj\Debug\Apriori算法.pdb
?????文件????????6588??2017-05-02?08:22??Apriori算法\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????????0??2017-04-28?14:11??Apriori算法\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2017-04-28?14:11??Apriori算法\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件???????????0??2017-04-28?14:11??Apriori算法\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????目錄???????????0??2017-04-28?14:11??Apriori算法\obj\Debug\TempPE\
?????文件???????22412??2017-05-04?19:25??Apriori算法\Program.cs
?????目錄???????????0??2017-05-07?09:28??Apriori算法\Properties\
?????文件????????1346??2017-04-28?14:11??Apriori算法\Properties\AssemblyInfo.cs
評論
共有 條評論