资源简介
由c语言实现的最大相关最下冗余的特征选择算法源码部分。
代码片段和文件信息
void mRMR()
{
TrainInitmrmr();
Trainmrmr();
Testmrmr();
}
void TrainInitmrmr()
{
int i j k;
// FILE *fpa; //fang 0111
// fpa=fopen(“c:\\fang\\evidenceinit.txt““w“);
// printf(“numfeatures = %d\n“numfeatures); //fang 0107 numfeatures == 5
for (i=0; i {
svalues[i] = 0;
// printf(“svalues[%d] = %d\n“i *(svalues+i)); //fang 0107 svalues[i] == {0 0 0 0 0}
}
for (i=0; i {
stotal[i] = 0;
prior[i] = (double) 0.0;
// printf(“numsensors = %d\n“ numsensors); //fang 0107 numsensors == 10 see ReadHeader
for (j=0; j for (k=0; k {
evidencemrmr[i][j][k] = 0;
// fang 0107 the two lines below are same
// printf(“evidence[%d][%d][%d] = %d\n“ i j k *(*(*(evidence+i)+j)+k)); //fang 0107
// printf(“evidence[%d][%d][%d] = %d\n“ i j k evidence[i][j][k]); //fang 0107
// fprintf(fpa“evidence[%d][%d][%d] = %d\n“ i j k evidence[i][j][k]); //fang 0111
}
}
// fclose(fpa); // fang 011
}
void TrainInit1mrmr()
{
int i jkm;
for (i=0; i {
svalues[i] = 0;
for(k=0;k {
for (j=0; j {
for(m=0;m {
mutevidence[i][k][j][m] = 0;
}
}
}
}
}
void TestInitmrmr()
{
int i j;
for (i=0; i {
svalues[i] = 0;
for (j=0; j {
testevidencemrmr[i][j] = 0;
// printf(“********\n“);
}
}
}
//void Calculate(int weeks int sizeint previousint endsint startsint duringsint variancesint endtint starttint duringt)
//void Calculate(int weeks int sizeint previous int next int endsint startsint duringsint variancesint endtint starttint duringt)//tp1115
//void Calculate(int weeks int sizeint previous int next int endsint startsint duringsint variancesint endtint starttint duringt int modet)//tp1121
//void Calculate(int weeks int sizeint previous int next int endsint startsint duringsint variancesint endtint starttint duringt int modet int mediant)//tp1125
void Calculate(int variancesint endtint duringsint size int modet int nextint previous int ends int mediantint duringtint startsint startt int weeks)//tp1129
{
//svalues[SENSOR] = event[SENSOR]; //fang 0117 mapsensorid (0-9)
//svalues[TIME] = event[TIME]; //fang 0117 tnum (0-4)
svalues[SENVARIANCE]=variances;
svalues[TIMEEND]=endt;
svalues[SENDURING]=durings;
svalues[LENGTH] = size; //fang 0117 size (0-2)
svalues[MODE]=modet;//tp1121
svalues[NEXT] = next;//tp1115
svalue
- 上一篇:图像内容识别缩放 源代码 C++
- 下一篇:有限元C++程序
评论
共有 条评论