Fix RemoveMean with axis=1
Opened this issue · 5 comments
Reported first in gh-1260.
Test case to be added:
import pylearn2.datasets.preprocessing
import pylearn2.datasets.cifar10
ds = pylearn2.datasets.cifar10.CIFAR10(which_set="train")
pp = pylearn2.datasets.preprocessing.RemoveMean(axis=1)
ds.apply_preprocessor(pp, can_fit=True)
Fix: in https://github.com/lisa-lab/pylearn2/blob/master/pylearn2/datasets/preprocessing.py#L668, replace self._mean = ...
by self._mean = X.mean(axis=self._axis, keepdims=True)
. This means that self._mean
will be a column or a row, depending on the value of self._axis
, instead of a vector, so it can be applied on the correct dimension of X.
@lamblin Is this issue still up for grabs? And where should we add the test case you pointed above?
@akshayah3 Sure, thanks for volunteering!
The test can be added in pylearn2/datasets/tests/test_preprocessing.py
. It would be better to use a different class than CIFAR10 in the test itself, for instance pylearn2.testing.datasets.random_dense_design_matrix
.
can i work on this?