• 大小: 16.44MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-19
  • 语言: 其他
  • 标签: 数据挖掘  

资源简介

《数据挖掘算法原理与实现》王振武书中源代码及测试数据,出版社提供版本

资源截图

代码片段和文件信息


#include 
#include 
#include 
#include 
#include 

#define InputlayerNum 35
#define OutputlayerRow 8
#define OutputlayerColumn 12
#define total_iteration_Num 80//10000//80//100//1000
#define error_limit 0.0000000000008//0.1//0.0000000000008//0.000000000000008//0.0001
#define efficiency 0.9//0.3//0.9//0.3//0.9


int ijklmn;
int inputMode[26][7][5];
double weight[OutputlayerRow*OutputlayerColumn][InputlayerNum];
int current_iteration_num=0;
double study_efficiency=efficiency;
long double distance[OutputlayerRow*OutputlayerColumn];
int neighbor_width=OutputlayerColumn;
int neighbor_height=OutputlayerRow;
int row[OutputlayerRow]column[OutputlayerColumn];
int flag[OutputlayerRow][OutputlayerColumn];
int temp_rowtemp_column;
int winner_rowwinner_column;
long double min_distance=1000.0;



/****************************************************************/
//该函数初始化距离变量为0初始化保存胜出节点的位置的变量
/****************************************************************/
void init_distance()
{
for(i=0;iyerRow;i++)
for(j=0;jyerColumn;j++)
distance[i*OutputlayerColumn+j]=0.0;
 }
/****************************************************************/
//该函数用于计算欧氏距离并找到获胜神经元
/****************************************************************/
void eula_distance()
{
int ttLowttUpppLowppUp;
ttLow=winner_column-neighbor_width/2;
ttUp=winner_column+neighbor_width/2;
ppLow=winner_row-neighbor_height/2;
ppUp=winner_row+neighbor_height/2;
if(ttLow<0)
ttLow=0;
if(ttUp>=OutputlayerColumn)
ttUp=OutputlayerColumn-1;
if(ppLow<0)
ppLow=0;
if(ppUp>=OutputlayerRow)
ppUp=OutputlayerRow-1;
for(i=ppLow;i<=ppUp;i++)
for(j=ttLow;j<=ttUp;j++)
{
if(!(flag[i][j]==100))
{
for(m=0;m<7;m++)
for(n=0;n<5;n++)
distance[i*OutputlayerColumn+j]+=
pow((inputMode[l][m][n]-weight[i*OutputlayerColumn+j][m*5+n])2);
if(distance[i*OutputlayerColumn+j] {
min_distance=distance[i*OutputlayerColumn+j];
temp_row=i;
temp_column=j;
}
}

}
if(current_iteration_num>0)
{
if(min_distance<=error_limit)
{
row[temp_row]=temp_row;
column[temp_column]=temp_column;
flag[temp_row][temp_column]=100;
}

}
}
/****************************************************************/
//调整权值
/****************************************************************/
void weight_change()
{
int ttLowttUpppLowppUp;
winner_row=temp_row;
winner_column=temp_column;
ttLow=winner_column-neighbor_width/2;
ttUp=winner_column+neighbor_width/2;
ppLow=winner_row-neighbor_height/2;
ppUp=winner_row+neighbor_height/2;
if(ttLow<0)
ttLow=0;
if(ttUp>=OutputlayerColumn)
ttUp=OutputlayerColumn-1;
if(ppLow<0)
ppLow=0;
if(ppUp>=OutputlayerRow)
ppUp=OutputlayerRow-1;
for(i=ppLow;i<=ppUp;i++)
for(j=ttLow;j<=ttUp;j++)
{
if(!(flag[i][j]==100))
{
for(m=0;m<7;m++)
for(

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

     文件      25483  2013-12-24 20:47  MyProjects\10_4_SOM\1.png

     文件       4303  2013-12-24 20:46  MyProjects\10_4_SOM\10_4_SOM.dsp

     文件        524  2013-12-24 20:36  MyProjects\10_4_SOM\10_4_SOM.dsw

     文件      50176  2013-12-24 20:50  MyProjects\10_4_SOM\10_4_SOM.ncb

     文件      48640  2013-12-24 20:50  MyProjects\10_4_SOM\10_4_SOM.opt

     文件        900  2013-12-24 20:49  MyProjects\10_4_SOM\10_4_SOM.plg

     文件      26674  2013-12-24 20:47  MyProjects\10_4_SOM\2.png

     文件      22987  2013-12-24 20:54  MyProjects\10_4_SOM\3.png

     文件     270432  2013-12-24 20:49  MyProjects\10_4_SOM\Debug\10_4_SOM.exe

     文件     300184  2013-12-24 20:49  MyProjects\10_4_SOM\Debug\10_4_SOM.ilk

     文件     333928  2013-12-24 20:49  MyProjects\10_4_SOM\Debug\10_4_SOM.pch

     文件     623616  2013-12-24 20:49  MyProjects\10_4_SOM\Debug\10_4_SOM.pdb

     文件      43171  2013-12-24 20:49  MyProjects\10_4_SOM\Debug\SOM.obj

     文件      91136  2013-12-24 20:50  MyProjects\10_4_SOM\Debug\vc60.idb

     文件     118784  2013-12-24 20:49  MyProjects\10_4_SOM\Debug\vc60.pdb

     文件      10963  2013-12-24 20:49  MyProjects\10_4_SOM\SOM.cpp

     文件     214908  2013-12-24 20:43  MyProjects\10_4_SOM\SOM.txt

     文件       2922  2005-12-28 15:33  MyProjects\10_4_SOM\相关数据\输入数据\input.txt

     文件       2920  2005-12-30 21:10  MyProjects\10_4_SOM\相关数据\输入数据\非标准数据测试.txt

     文件      50712  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\初始的权值.txt

     文件       2470  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\向量模式.txt

     文件        737  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\标准测试.txt

     文件        321  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\获胜节点.txt

     文件      56856  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\训练后所有权值.txt

     文件      15401  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\训练后胜出权值.txt

     文件        445  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\迭代次数.txt

     文件        737  2013-12-24 20:50  MyProjects\10_4_SOM\相关数据\输出数据\非标准测试.txt

     文件       4340  2013-12-24 15:47  MyProjects\3_4_Apriori\3_4_Apriori.dsp

     文件        530  2013-12-24 15:15  MyProjects\3_4_Apriori\3_4_Apriori.dsw

     文件      33792  2013-12-24 15:47  MyProjects\3_4_Apriori\3_4_Apriori.ncb

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

评论

共有 条评论