Re: [Scikit-learn-general] Data reconstruction after SparsePCA

2014-10-17 Thread Vlad Niculae
To clarify, it is *not* the case that `x.dot(spca.components_.T) ` is equivalent to `spca.transform(x)`. The latter performs a solve. Best, Vlad On Fri, Oct 17, 2014 at 12:03 PM, Vlad Niculae wrote: > Hi Luca > >> x_3_dimensional = x.dot(spca.components_.T) # this is equivalent to >> spca.trans

Re: [Scikit-learn-general] Data reconstruction after SparsePCA

2014-10-17 Thread Vlad Niculae
Hi Luca > x_3_dimensional = x.dot(spca.components_.T) # this is equivalent to > spca.transform(x) This part is specific to PCA. In general, the transform part of such a decomposition is `X * components ^ -1`. In PCA, because `components` is orthogonal, `components ^ -1` is `components.T`. The r

Re: [Scikit-learn-general] Data reconstruction after SparsePCA

2014-10-16 Thread Vlad Niculae
Hi Luca, The other part of the decomposition that you're missing is available in `spca.components_` and has shape `(n_components, n_features)`. The approximation of X is therefore `np.dot(x_3_dimensional, spca.components_)`. Best, Vlad On Thu, Oct 16, 2014 at 6:07 PM, Luca Puggini wrote: > Hi,