Definition at line 101 of file BayesCondProb.h. References Impala::Core::Table::Bayes::DumpMatrix(), Impala::Core::Table::Bayes::mAnnoTableSize, Impala::Core::Table::Bayes::mConceptNum, Impala::Core::Table::Bayes::mGenreNum, mProb_g_c, Impala::Core::Table::Bayes::tabConcept, and Impala::Core::Table::Bayes::tabGenre. Referenced by CalcBayes(). 00102 { 00103 //mProb_g_c = new double* [mGenreNum]; 00104 //for (int j=0; j<mGenreNum; j++) mProb_g_c[j] = new double [mConceptNum]; 00105 00106 for (int j=0; j<mGenreNum; j++) 00107 memset(mProb_g_c[j],0,sizeof(double)*mConceptNum); 00108 00109 for (int j=0; j<mGenreNum; j++) 00110 { 00111 for (int k=0; k<mConceptNum; k++) 00112 { 00113 int countConcept = 0; 00114 int countGenre = 0; 00115 00116 // loop for all the keyframes 00117 for (int idx=0; idx<mAnnoTableSize; idx++) 00118 { 00119 if (tabConcept[k]->IsPositive(idx)) 00120 { 00121 countConcept ++; 00122 if (tabGenre[j]->IsPositive(idx)) 00123 { 00124 countGenre++; 00125 } 00126 } 00127 } 00128 00129 // compute the conditional probability based on counting. 00130 if (0 == countConcept) 00131 mProb_g_c[j][k] = 0; 00132 else 00133 mProb_g_c[j][k] = countGenre*1.0/countConcept; 00134 } 00135 } 00136 DumpMatrix("mProb_g_c[j][k]", mProb_g_c, mGenreNum, mConceptNum); 00137 }
Here is the call graph for this function:
|