{"action":"created","issue":{"url":"https://api.github.com/repos/madeleineudell/LowRankModels.jl/issues/7","labels_url":"https://api.github.com/repos/madeleineudell/LowRankModels.jl/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/madeleineudell/LowRankModels.jl/issues/7/comments","events_url":"https://api.github.com/repos/madeleineudell/LowRankModels.jl/issues/7/events","html_url":"https://github.com/madeleineudell/LowRankModels.jl/issues/7","id":82214243,"number":7,"title":"svd warm start is not working","user":{"login":"alejandroschuler","id":7213095,"avatar_url":"https://avatars.githubusercontent.com/u/7213095?v=3","gravatar_id":"","url":"https://api.github.com/users/alejandroschuler","html_url":"https://github.com/alejandroschuler","followers_url":"https://api.github.com/users/alejandroschuler/followers","following_url":"https://api.github.com/users/alejandroschuler/following{/other_user}","gists_url":"https://api.github.com/users/alejandroschuler/gists{/gist_id}","starred_url":"https://api.github.com/users/alejandroschuler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejandroschuler/subscriptions","organizations_url":"https://api.github.com/users/alejandroschuler/orgs","repos_url":"https://api.github.com/users/alejandroschuler/repos","events_url":"https://api.github.com/users/alejandroschuler/events{/privacy}","received_events_url":"https://api.github.com/users/alejandroschuler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-29T02:06:11Z","updated_at":"2015-05-29T02:30:37Z","closed_at":null,"body":"I have a glrm model that runs fine by itself and also with kmeans++, but breaks when I try to initialize it with svd:\r\n\r\n```\r\nERROR: BoundsError()\r\n in checkbounds at abstractarray.jl:65\r\n in setindex! at multidimensional.jl:61\r\n in setindex! at sharedarray.jl:216\r\n in init_svd! at /home/aschuler/.julia/v0.3/LowRankModels/src/initialize.jl:70\r\n in include at ./boot.jl:245\r\n in include_from_node1 at loading.jl:128\r\n in process_options at ./client.jl:285\r\n in _start at ./client.jl:354\r\nwhile loading /home/aschuler/LatentSyndromes/src/run.jl, in expression starting on line 56\r\n```\r\n\r\nProblem persists even when I use a simple glrm:\r\n```\r\nusing LowRankModels\r\nimport StatsBase: sample\r\n\r\nsrand(1)\r\n\tm,n,k,s = 1000, 1000, 5, 50000\r\n\tA = randn(m,k)*randn(k,n)\r\n\tlosses = fill(quadratic(),n)\r\n\tr = quadreg(.1)\r\n\tobsx = [sample(1:int(m/4),int(s/2)), sample(int(m/4)+1:m,s-int(s/2))] \r\n\tobsy = sample(1:n,s)\r\n\tobs = [(obsx[i],obsy[i]) for i=1:s]\r\n\tglrm = GLRM(A,obs,losses,r,r,k)\r\n        @time init_svd!(glrm)\r\nERROR: BoundsError()\r\n in checkbounds at abstractarray.jl:65\r\n in setindex! at multidimensional.jl:61\r\n in setindex! at sharedarray.jl:216\r\n in init_svd! at /home/aschuler/.julia/v0.3/LowRankModels/src/initialize.jl:70\r\n```\r\n**However, it works fine using the serial implementation.**\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/madeleineudell/LowRankModels.jl/issues/comments/106661188","html_url":"https://github.com/madeleineudell/LowRankModels.jl/issues/7#issuecomment-106661188","issue_url":"https://api.github.com/repos/madeleineudell/LowRankModels.jl/issues/7","id":106661188,"user":{"login":"madeleineudell","id":829940,"avatar_url":"https://avatars.githubusercontent.com/u/829940?v=3","gravatar_id":"","url":"https://api.github.com/users/madeleineudell","html_url":"https://github.com/madeleineudell","followers_url":"https://api.github.com/users/madeleineudell/followers","following_url":"https://api.github.com/users/madeleineudell/following{/other_user}","gists_url":"https://api.github.com/users/madeleineudell/gists{/gist_id}","starred_url":"https://api.github.com/users/madeleineudell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madeleineudell/subscriptions","organizations_url":"https://api.github.com/users/madeleineudell/orgs","repos_url":"https://api.github.com/users/madeleineudell/repos","events_url":"https://api.github.com/users/madeleineudell/events{/privacy}","received_events_url":"https://api.github.com/users/madeleineudell/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T02:30:37Z","updated_at":"2015-05-29T02:30:37Z","body":"The reason `shareglrm` uses the transposed X format is because Julia stores\nmatrices in column-major order, so iterating over entries in the same\ncolumn is faster than entries in the same row. Since the fitting procedure\ndeals with columns of Y and rows of X, here we store the rows of X as\ncolumns for increased efficiency, which becomes increasingly important in\nthe kinds of large models we expect to be input to `shareglrm`.\n\nOr at least, that's the theory behind the madness. I haven't tested\nextensively to find out if it makes a big difference. (And as long as we\ndon't know why we're seeing such high GC levels, I remain open to all\nhypotheses.)\n\nSo I'd propose option 2, perhaps, unless it turns out upon testing that\nit's substantially slower to fit, in which case I'd propose option 1. I\nagree option 3 is silly, although it is in some sense the status quo.\n\nOn Thu, May 28, 2015 at 7:22 PM, Alejandro Schuler <notifications@github.com\n> wrote:\n\n> I think this is the offending line:\n>\n> glrm.X[1:m,1:k] = u[:,1:k]*diagm(sqrt(s[1:k]))\n>\n> Which I suspect doesn't like:\n>\n>     # make sure that we've oriented the factors as shareglrm expects\n>     if size(glrm.Y,1)!==size(glrm.X,1)\n>         glrm.X = glrm.X'\n>     end\n>\n> which is in the shareglrm code.\n>\n> So the three options are:\n> 1. Change all the code to accept the transposed X format that shareglrm\n> uses.\n> 2. Change shareglrm to use a non-transposed version of X\n> 3. Change all the code to check whether or not shareglrm is being used and\n> act accordingly.\n>\n> I think option #2\n> <https://github.com/madeleineudell/LowRankModels.jl/issues/2> seems the\n> most reasonable, but then again I'm not sure why shareglrm is implemented\n> with that transposition in the first place, so presumably there's a good\n> reason. Barring that, option #3\n> <https://github.com/madeleineudell/LowRankModels.jl/pull/3> is a bit\n> silly and would be harder to maintain, so option #1\n> <https://github.com/madeleineudell/LowRankModels.jl/pull/1> is the best\n> bet?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/madeleineudell/LowRankModels.jl/issues/7#issuecomment-106659265>\n> .\n>\n\n\n\n-- \nMadeleine Udell\nPhD Candidate in Computational and Mathematical Engineering\nStanford University\nwww.stanford.edu/~udell\n"}}