Corrected a mistake in CHI2 kernel in line 354 and line 362 svm.cpp

Added new kernels to documentation
This commit is contained in:
Markus Schoeler
2013-02-22 15:41:57 +01:00
parent ddb0afbc44
commit 5484a41960
3 changed files with 11 additions and 3 deletions

View File

@@ -351,7 +351,7 @@ void CvSVMKernel::calc_chi2( int vcount, int var_count, const float** vecs,
double chi2 = 0;
for(k = 0 ; k < var_count; k++ )
{
double d = sample[k]*another[k];
double d = sample[k]-another[k];
double devisor = sample[k]+another[k];
/// if devisor == 0, the Chi2 distance would be zero, but calculation would rise an error because of deviding by zero
if (devisor != 0)
@@ -359,7 +359,7 @@ void CvSVMKernel::calc_chi2( int vcount, int var_count, const float** vecs,
chi2 += d*d/devisor;
}
}
results[j] = (Qfloat) (gamma*(1.0-2*chi2));
results[j] = (Qfloat) (gamma*chi2);
}
if( vcount > 0 )
cvExp( &R, &R );