Return-Path: X-Original-To: apmail-mahout-user-archive@www.apache.org Delivered-To: apmail-mahout-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB84ED01D for ; Thu, 7 Mar 2013 20:53:53 +0000 (UTC) Received: (qmail 1474 invoked by uid 500); 7 Mar 2013 20:53:52 -0000 Delivered-To: apmail-mahout-user-archive@mahout.apache.org Received: (qmail 1372 invoked by uid 500); 7 Mar 2013 20:53:52 -0000 Mailing-List: contact user-help@mahout.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@mahout.apache.org Delivered-To: mailing list user@mahout.apache.org Received: (qmail 1364 invoked by uid 99); 7 Mar 2013 20:53:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Mar 2013 20:53:51 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of joshdevins@gmail.com designates 209.85.219.53 as permitted sender) Received: from [209.85.219.53] (HELO mail-oa0-f53.google.com) (209.85.219.53) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Mar 2013 20:53:45 +0000 Received: by mail-oa0-f53.google.com with SMTP id m1so1159919oag.26 for ; Thu, 07 Mar 2013 12:53:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=+E1aG0v2f9a1oFIE2P92u+vwNB/LHwILOfjh97+5wbY=; b=ameqmAaBC3QjYKULaK4RNDSH4sOmXlBL2XWoFErWFkSkr9nbwYYSVceY2eABlis5Xc GnwB4Ry7SWSy9sWvzuvCFpxbu/3TMSmBGIAHNZm8Dbnij/4acAp4EH9p7EGHmh7F4aiY t+ONQfp8Q3cuVMA8HlkAbz0WSLyr4a9bOgFi73WVh2U6cBwiOgmaTZyxyu9Fp6uwRVhh f3f9BxeLUPikX2VCcEvMGeJ12y7nCtoxdBDYVxZYmvnhxsx+GtZltQwv+KV32oZWk2mI YuPfW2CsEx3JLUxcgx9M1PYjb2TxJNqJH5ty5bUcjmq/DAyW+11h1/X3jX/AME9Gzaf2 uC4A== X-Received: by 10.60.21.104 with SMTP id u8mr26405973oee.99.1362689604491; Thu, 07 Mar 2013 12:53:24 -0800 (PST) MIME-Version: 1.0 Sender: joshdevins@gmail.com Received: by 10.76.166.229 with HTTP; Thu, 7 Mar 2013 12:53:04 -0800 (PST) In-Reply-To: <5138FA8E.8010508@apache.org> References: <71EEBFD7-22E4-499B-BA44-1932274445E3@gmail.com> <513769CB.6050509@apache.org> <5138AAA9.5030203@apache.org> <5138FA8E.8010508@apache.org> From: Josh Devins Date: Thu, 7 Mar 2013 21:53:04 +0100 X-Google-Sender-Auth: _PlGzn_KPIt25enP7Gv5pqq9FS4 Message-ID: Subject: Re: Top-N recommendations from SVD To: user@mahout.apache.org Content-Type: multipart/alternative; boundary=e89a8ff1c6d6d0eede04d75be587 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8ff1c6d6d0eede04d75be587 Content-Type: text/plain; charset=UTF-8 I'm running a job right now that uses your static `dot` method from your previous post, ontop of v0.7 (nothing from trunk). This has cut the time down by about 1/3 but it's still around 500ms per user. I'll give your latest patch a go hopefully tomorrow and report back. We're working on another approach too. Will email you off thread if it proves fruitful, perhaps whip up a patch as well. Josh On 7 March 2013 21:37, Sebastian Schelter wrote: > Hi Josh, > > I made another attempt today. It directly computes the dot products, > introduces a mutable version of RecommendedItem and uses Lucene's > PriorityQueue to keep the top k. > > I hope this gives you some improvements. > > Here's the patch (must be applied against trunk): > > > https://issues.apache.org/jira/secure/attachment/12572605/MAHOUT-1151-2.patch > > Best, > Sebastian > > On 07.03.2013 16:00, Josh Devins wrote: > > I ran from what's in trunk as of this morning. I didn't dig in further to > > see where that extra time was coming from but can do so when I get some > > time soon. > > > > > > On 7 March 2013 15:56, Sebastian Schelter wrote: > > > >> Hi Josh, > >> > >> Did you run the patch from the jira issue or did you run the trunk? I > >> made some follow up changes after uploading the patch. I can't imagine > >> why those small changes would lead to an increase of 50% in the runtime. > >> > >> /s > >> > >> > >> > >> On 07.03.2013 15:02, Josh Devins wrote: > >>> So the good news is that the patch runs ;) The bad news is that it's > >>> slower, going from 1600-1800ms to ~2500ms to calculate a single users' > >> topK > >>> recommendations. For kicks, I ran a couple other experiments, > >> progressively > >>> removing code to isolate the problem area. Results are detailed here: > >>> https://gist.github.com/joshdevins/5106930 > >>> > >>> Conclusions thus far: > >>> * the patch is not helpful (for performance) and should be reverted or > >>> fixed again (sorry Sebastian) > >>> * the dot product operation in `Vector` is not efficient enough for > >> large > >>> vectors/matrices, when used as it is in the ALS `RecommenderJob`, > inside > >> a > >>> loop over `M` > >>> > >>> I've tried a few other experiments with Colt (for example) but there > was > >> no > >>> noticeable gain. Parallelizing inside the map task (manually or with > >>> Parallel Colt) is possible but obviously is not ideal in an environment > >>> like Hadoop -- this would save memory since you only need a few map > tasks > >>> loading the matrices, but isn't playing very nicely within a shared > >> cluster > >>> :) > >>> > >>> Next step at this point is to look at either reducing the number of > items > >>> to recommend over, LSH or a third secret plan that "the PhD's" are > >> thinking > >>> about. Paper forthcoming, no doubt :D > >>> > >>> @Sebastian, happy to run any patches on our cluster/dataset before > making > >>> more commits. > >>> > >>> > >>> > >>> On 6 March 2013 20:58, Josh Devins wrote: > >>> > >>>> Got sidetracked today but I'll run Sebastian's version in trunk > tomorrow > >>>> and report back. > >>>> > >>>> > >>>> On 6 March 2013 17:07, Sebastian Schelter wrote: > >>>> > >>>>> I already committed a fix in that direction. I modified our > >>>>> FixedSizePriorityQueue to allow inspection of its head for direct > >>>>> comparison. This obviates the need to instantiate a Comparable and > >> offer > >>>>> it to the queue. > >>>>> > >>>>> /s > >>>>> > >>>>> > >>>>> On 06.03.2013 17:01, Ted Dunning wrote: > >>>>>> I would recommend against a mutable object on maintenance grounds. > >>>>>> > >>>>>> Better is to keep the threshold that a new score must meet and only > >>>>>> construct the object on need. That cuts the allocation down to > >>>>> negligible > >>>>>> levels. > >>>>>> > >>>>>> On Wed, Mar 6, 2013 at 6:11 AM, Sean Owen wrote: > >>>>>> > >>>>>>> OK, that's reasonable on 35 machines. (You can turn up to 70 > >> reducers, > >>>>>>> probably, as most machines can handle 2 reducers at once). > >>>>>>> I think the recommendation step loads one whole matrix into memory. > >>>>> You're > >>>>>>> not running out of memory but if you're turning up the heap size to > >>>>>>> accommodate, you might be hitting swapping, yes. I think (?) the > >>>>>>> conventional wisdom is to turn off swap for Hadoop. > >>>>>>> > >>>>>>> Sebastian yes that is probably a good optimization; I've had good > >>>>> results > >>>>>>> reusing a mutable object in this context. > >>>>>>> > >>>>>>> > >>>>>>> On Wed, Mar 6, 2013 at 10:54 AM, Josh Devins > >>>>> wrote: > >>>>>>> > >>>>>>>> The factorization at 2-hours is kind of a non-issue (certainly > fast > >>>>>>>> enough). It was run with (if I recall correctly) 30 reducers > across > >> a > >>>>> 35 > >>>>>>>> node cluster, with 10 iterations. > >>>>>>>> > >>>>>>>> I was a bit shocked at how long the recommendation step took and > >> will > >>>>>>> throw > >>>>>>>> some timing debug in to see where the problem lies exactly. There > >>>>> were no > >>>>>>>> other jobs running on the cluster during these attempts, but it's > >>>>>>> certainly > >>>>>>>> possible that something is swapping or the like. I'll be looking > >> more > >>>>>>>> closely today before I start to consider other options for > >> calculating > >>>>>>> the > >>>>>>>> recommendations. > >>>>>>>> > >>>>>>>> > >>>>>>> > >>>>>> > >>>>> > >>>>> > >>>> > >>> > >> > >> > > > > --e89a8ff1c6d6d0eede04d75be587--