Hi Manoj,
I think one solution is to:
* roll the features axis to be first: coef = np.rollaxis(coef, 1)
* reshape so that the last two axes become one: coef =
coef.reshape(len(coef.shape[0]), -1)
* perform out = safe_sparse_dot(X_test, coef)
* for sample i, target index j, alpha index k, the result is in out[i, j *
n_alphas + k], which is not especially user-friendly, but is fine for
internal use...
* where the result is sparse, it may be efficiently stored with BSR sparse
format, but I don't think you can coerce it to that format before or during
the sparse dot if the coef is dense
Cheers,
Joel
On Sun, Dec 15, 2013 at 3:51 AM, Manoj Kumar <[email protected]
> wrote:
> Hello,
>
> I have been trying to implement MultiTaskElasticNetCV in this PR,
> https://github.com/scikit-learn/scikit-learn/pull/2598
>
> I have got a number of test failures, one of them which include
> ValueError: Could Not interpret dimensions.
>
> I traced this to L924 in the PR. safe_sparse_dot(X_test, coef). This is
> because I have stored coef as a 3-D numpy array,
> a] First dimension - order/tasks
> b] Second dimension - features
> c] Third dimension - alpha.
> Hence if X_test is a sparse matrix doing X_test*coef would raise a
> ValueError.
>
> The only alternative, I can think of is using a 'for' loop across the
> order or tasks, which seems a 'non-numpy way' of doing it. Is there a
> better way of doing this?
>
> Awaiting a reply.
> Thanks.
> --
> Regards,
> Manoj Kumar,
> Mech Undergrad
> http://manojbits.wordpress.com
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general