shogun-toolbox/shogun — pull request #2309 by lambday (2014-06-15 13:10:10+00:00)
Title: [WIP] Fixed covariance computation in CStreamingMMD and some other changes

@karlnapf While trying to fix the covariance computation b/w multiple kernels in streaming mmd, I also noticed that the whole process is a lot slower than it earlier was since instead of streaming a large number of features in each burst, I was streaming one block (of default blocksize 4 for linear time mmd) at a time and performing the computation per block. So I thought of doing it this way

- streaming a number of such blocks for a given block-size in each burst, `stream_data_blocks()` method returns a merged feature of `B_x*num_blocks` samples from `p` followed by `B_y*num_blocks` samples from `q` in each burst. `num_blocks` is number of blocks of block-size `B` in each burst.

- performing computation for each block in `compute_blockwise_statistic()` methods. We init the kernel just once per burst and then inside a loop that runs for all the blocks within current burst it uses the block-wise sum methods in `CKernel`. This method then returns a vector of mmd estimates for all the blocks in the current burst and the callee keeps on computing runtime mean and variance, then proceeds to stream some more blocks of samples in the next burst

- in the `compute_blockwise_statistic_variance()` method (which is used for within-block direct estimate), I achieved this by subsets. Inside a loop for that runs for all blocks within current burst, I add a subset that focus only on the current block, then init kernel with this, get kernel matrix, compute the rest as before, remove the subset, move onto the next block. The reason I did it this way is because if I precomputed the whole kernel matrix for all the blocks in the current burst, it might get way larger to be kept inside memory, plus many many entries in that matrix won't be used at all.

This way the computation speeded up a lot and became a bit more compatible to what we had before. The unit-tests work as before (except for the Q-matrix because we're now shuffling the features for computing that) but integration tests are giving weird results which is completely counter-intuitive. For example, statistics_linear_time_mmd.py the test fails to detect that p!=q with alpha=0.05 even when the null-samples are pretty close to Gaussian. p-value-boot and p-value-gaussian are >= 0.5 I am stuck with this for quite a long time now but can't understand what's so different now! I'm still going through this but if you get some time could you please check if there is something obvious I'm missing here?