Last active
July 10, 2017 02:36
-
-
Save MikeLing/b3ac41c1bdffac593d9eac0ac96f1e30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loat64_t CQuadraticTimeMMD::compute_statistic() | |
{ | |
... | |
if (self->precompute) | |
{ | |
SGMatrix<float32_t> kernel_matrix=self->get_kernel_matrix(); | |
statistic=self->statistic_job(kernel_matrix); | |
SG_PRINT("kernel_matrix is"); // output is in https://pastebin.mozilla.org/9026733 | |
kernel_matrix.display_matrix(); | |
} | |
else | |
{ | |
... | |
} | |
// statistic before normalization is -0.011932 | |
SG_PRINT("statistic before normalization is %f\n", statistic); | |
statistic=normalize_statistic(statistic); | |
// statistic after normalization is -0.143190 | |
SG_PRINT("statistic after normalization is %f\n", statistic); | |
SG_PRINT("Leaving\n"); | |
return statistic; | |
} | |
... | |
float64_t CHypothesisTest::compute_p_value(float64_t statistic) | |
{ | |
SGVector<float64_t> values=sample_null(); | |
SG_PRINT("vector in values is"); | |
// Note: I guess it is where the problem comes out, all the elemetns from sample null is the same! | |
// vector=[-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492] | |
values.display_vector(); | |
std::sort(values.vector, values.vector + values.vlen); | |
float64_t i=values.find_position_to_insert(statistic); | |
SG_PRINT("values of i is %f\n", i); //it's 0.00000 in here | |
return 1.0-i/values.vlen; | |
} | |
template <class Kernel> // In PermutationMMD | |
SGVector<float32_t> operator()(const Kernel& kernel) | |
{ | |
ASSERT(m_n_x>0 && m_n_y>0); | |
ASSERT(m_num_null_samples>0); | |
precompute_permutation_inds(); | |
... | |
// Note: I guess it is where the problem comes out, all the elemetns from sample null is the same! | |
// vector=[-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492,-0.00157492] | |
null_samples.display_vector(); | |
return null_samples; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment