Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
examples/meta/src/statistical_testing/quadratic_time_mmd.sg
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CSVFile f_features_p("../../data/two_sample_test_gaussian.dat") | ||
CSVFile f_features_q("../../data/two_sample_test_laplace.dat") | ||
|
||
RealFeatures features_p(f_features_p) | ||
RealFeatures features_q(f_features_q) | ||
|
||
GaussianKernel kernel() | ||
|
||
QuadraticTimeMMD mmd() | ||
mmd.set_kernel(kernel) | ||
mmd.set_p(features_p) | ||
mmd.set_q(features_q) | ||
|
||
Real statistic = mmd.compute_statistic() | ||
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) |