Skip to content

Commit

Permalink
add all test types
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnapf authored and lambday committed Jul 13, 2016
1 parent 5879e7c commit 80a9b52
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions examples/meta/src/statistical_testing/quadratic_time_mmd.sg
Expand Up @@ -12,16 +12,38 @@ GaussianKernel kernel()
mmd.set_kernel(kernel)
mmd.set_p(features_p)
mmd.set_q(features_q)
Real alpha = 0.05
#![create_instance]

#![estimate_mmd]
Real statistic = mmd.compute_statistic()
#![estimate_mmd]
#![estimate_mmd_unbiased]
mmd.set_statistic_type(enum EStatisticType.UNBIASED_FULL)
Real statistic_unbiased = mmd.compute_statistic()
#![estimate_mmd_unbiased]

#![perform_test]
Real alpha = 0.05
Real threshold = mmd.compute_threshold(alpha)
Real p_value = mmd.compute_p_value(alpha)
Real h0_rejected = mmd.perform_test(alpha)
#![perform_test]
#![estimate_mmd_biased]
mmd.set_statistic_type(enum EStatisticType.BIASED_FULL)
Real statistic_biased = mmd.compute_statistic()
#![estimate_mmd_biased]

#![perform_test_permutation]
mmd.set_null_approximation_method(enum ENullApproximationMethod.PERMUTATION)
mmd.set_num_null_samples(200)
Real threshold_permutation = mmd.compute_threshold(alpha)
Real p_value_permutation = mmd.compute_p_value(statistic_biased)
Real h0_rejected_permutation = mmd.perform_test(alpha)
#![perform_test_permutation]

#![perform_test_spectrum]
mmd.set_null_approximation_method(enum ENullApproximationMethod.MMD2_SPECTRUM)
mmd.set_num_null_samples(200)
Real threshold_spectrum = mmd.compute_threshold(alpha)
Real p_value_spectrum = mmd.compute_p_value(statistic_biased)
Real h0_rejected_spectrum = mmd.perform_test(alpha)
#![perform_test_spectrum]

#![perform_test_gamma]
mmd.set_null_approximation_method(enum ENullApproximationMethod.MMD2_GAMMA)
Real threshold_gamma = mmd.compute_threshold(alpha)
Real p_value_gamma = mmd.compute_p_value(statistic_biased)
Real h0_rejected_gamma = mmd.perform_test(alpha)
#![perform_test_gamma]

0 comments on commit 80a9b52

Please sign in to comment.