17 using namespace shogun;
32 SG_ERROR(
"CQuadraticTimeMMD: Only features with equal number of vectors "
33 "are currently possible\n");
44 SG_ERROR(
"CQuadraticTimeMMD: Only features with equal number of vectors "
45 "are currently possible\n");
60 void CQuadraticTimeMMD::init()
63 " for spectrum method null-distribution approximation",
66 " Eigenvalues for spectrum method null-distribution approximation",
113 return first+second-third;
151 return first+second-third;
169 SG_ERROR(
"CQuadraticTimeMMD::compute_statistic(): Unknown statistic "
189 null_samples.
qsort();
193 SG_ERROR(
"CQuadraticTimeMMD::compute_p_value(): Only possible if "
194 "shogun is compiled with LAPACK enabled\n");
195 #endif // HAVE_LAPACK
216 bool multiple_kernels)
219 if (!multiple_kernels)
228 "%s::compute_statistic: multiple kernels specified,"
229 "but underlying kernel is not of type K_COMBINED\n",
get_name());
240 CKernel* current=combined->get_kernel(i);
268 null_samples.
qsort();
271 SG_ERROR(
"CQuadraticTimeMMD::compute_threshold(): Only possible if "
272 "shogun is compiled with LAPACK enabled\n");
273 #endif // HAVE_LAPACK
299 REQUIRE(
m_kernel,
"%s::sample_null_spectrum(%d, %d): No kernel set!\n",
300 get_name(), num_samples, num_eigenvalues);
302 "%s::sample_null_spectrum(%d, %d): No features set and no custom "
303 "kernel in use!\n",
get_name(), num_samples, num_eigenvalues);
313 SG_ERROR(
"%s::sample_null_spectrum(): Currently, only equal "
314 "sample sizes are supported\n",
get_name());
319 SG_ERROR(
"%s::sample_null_spectrum(): Number of samples has to be at"
320 " least 2, better in the hundreds",
get_name());
323 if (num_eigenvalues>2*
m_m-1)
325 SG_ERROR(
"%s::sample_null_spectrum(): Number of Eigenvalues too large\n",
329 if (num_eigenvalues<1)
331 SG_ERROR(
"%s::sample_null_spectrum(): Number of Eigenvalues too small\n",
338 SG_WARNING(
"%s::sample_null_spectrum(): Note: provided statistic has "
339 "to be BIASED. Please ensure that! To get rid of warning,"
340 "call %s::set_statistic_type(BIASED)\n",
get_name(),
359 for (
index_t i=0; i<num_eigenvalues; ++i)
361 1.0/2/
m_m*eigenvalues[eigenvalues.
vlen-1-i]);
365 for (
index_t i=0; i<num_samples; ++i)
377 #endif // HAVE_LAPACK
383 "%s::fit_null_gamma(): No features set and no custom kernel in"
394 SG_ERROR(
"%s::compute_p_value_gamma(): Currently, only equal "
395 "sample sizes are supported\n",
get_name());
401 SG_WARNING(
"%s::compute_p_value(): Note: provided statistic has "
402 "to be BIASED. Please ensure that! To get rid of warning,"
403 "call %s::set_statistic_type(BIASED)\n",
get_name(),
423 mean_mmd=2.0/m_m*(1.0-1.0/m_m*mean_mmd);
434 if (i==j || m_m+i==j || m_m+j==i)
444 var_mmd*=2.0/m_m/(m_m-1)*1.0/m_m/(m_m-1);
458 num_samples_spectrum)
464 index_t num_eigenvalues_spectrum)