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 0DFF0E4C5 for ; Mon, 14 Jan 2013 21:42:27 +0000 (UTC) Received: (qmail 98180 invoked by uid 500); 14 Jan 2013 21:42:25 -0000 Delivered-To: apmail-mahout-user-archive@mahout.apache.org Received: (qmail 98143 invoked by uid 500); 14 Jan 2013 21:42:25 -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 98131 invoked by uid 99); 14 Jan 2013 21:42:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2013 21:42:25 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.82.45] (HELO mail-wg0-f45.google.com) (74.125.82.45) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2013 21:42:18 +0000 Received: by mail-wg0-f45.google.com with SMTP id dq12so2263749wgb.0 for ; Mon, 14 Jan 2013 13:41:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=gY6skA+FNagDdbn/MZACm3z/uzYov91iFYIQ+2xLMZU=; b=orcwIO3E7tJWC3334zFYmL9Lhisri8v6/fVvQwMcxXpIx3pcrZwvAZDS1TIo2A++cV 38BmmE0HqrPfwz02K7EPyMJD+OV6IgCN0a8zTAiCWgBy0xrOncKfuPyd4mk9xd163lbZ I48D/ttCgT6emD24mlPz7K9z/aYFWuSZJJwqTzxa1/RXXSN2Raa1Mcoae5MSbvYJMcas moym+78xEOnLcBCAlmvCKl4eD2b5pa+SIFs1LeZ3bvIQymVgAgKhm/hfqwRP0SfpMmmm zMMFHub8Oufi8Xtb/zqSFIWZkvGYCTIgmvcBWkkuSzZRLR1hSQ2Ars71e4z4VJ8pajVT YkEw== MIME-Version: 1.0 Received: by 10.194.9.197 with SMTP id c5mr137864723wjb.20.1358199717151; Mon, 14 Jan 2013 13:41:57 -0800 (PST) Received: by 10.217.65.202 with HTTP; Mon, 14 Jan 2013 13:41:57 -0800 (PST) X-Originating-IP: [199.47.72.128] In-Reply-To: References: Date: Mon, 14 Jan 2013 16:41:57 -0500 Message-ID: Subject: Re: understanding vectors From: Koert Kuipers To: user@mahout.apache.org Content-Type: multipart/alternative; boundary=047d7b5d4498acc3f604d3468342 X-Gm-Message-State: ALoCoQl/WglIDSsq8G5ZiX5eGOIvssl1+8knpgjhY8bUTbdtQwC2qNf5KgHoebQgPgRKC0Sxzivd X-Virus-Checked: Checked by ClamAV on apache.org --047d7b5d4498acc3f604d3468342 Content-Type: text/plain; charset=ISO-8859-1 i probably wasn't clear before: i can not reproduce bug in trunk. On Mon, Jan 14, 2013 at 4:40 PM, Koert Kuipers wrote: > ok i can write unit test for trunk, but it will succeed, since this is > fixed in trunk. ok? > > On Mon, Jan 14, 2013 at 4:35 PM, Jake Mannix wrote: > >> We don't have a way to add the code to 0.7, it would just go in trunk. >> >> >> On Mon, Jan 14, 2013 at 1:19 PM, Koert Kuipers wrote: >> >> > since trunk behaves properly, where do you want unit test? in version >> 0.7? >> > >> > On Mon, Jan 14, 2013 at 3:59 PM, Jake Mannix >> > wrote: >> > >> > > I could have sworn we've seen and fixed this bug before, but I guess >> not. >> > > Let's get a (failing) unit test in there, and then it should be an >> easy >> > > fix. >> > > >> > > I think nobody runs into this because it's really rare to want to >> iterate >> > > over all of the entries in a sparse vector - iterateNonZero() is used >> > > almost exclusively for these. >> > > >> > > >> > > On Mon, Jan 14, 2013 at 12:51 PM, Koert Kuipers >> > wrote: >> > > >> > > > not the same behavior in trunk. SequentialAccessVector.iterator >> seems >> > to >> > > > behave properly there. >> > > > >> > > > On Mon, Jan 14, 2013 at 3:07 PM, Koert Kuipers >> > > wrote: >> > > > >> > > > > sorry yes i meant 0.7 >> > > > > >> > > > > On Mon, Jan 14, 2013 at 12:58 PM, Jake Mannix < >> jake.mannix@gmail.com >> > > > >wrote: >> > > > > >> > > > >> I think you mean 0.7, right? Can you see if you get the same >> > behavior >> > > > in >> > > > >> svn trunk? >> > > > >> >> > > > >> >> > > > >> On Mon, Jan 14, 2013 at 9:21 AM, Koert Kuipers < >> koert@tresata.com> >> > > > wrote: >> > > > >> >> > > > >> > i am using version mahout 7.0 >> > > > >> > >> > > > >> > On Mon, Jan 14, 2013 at 10:15 AM, Ted Dunning < >> > > ted.dunning@gmail.com> >> > > > >> > wrote: >> > > > >> > >> > > > >> > > Which version are you using? >> > > > >> > > >> > > > >> > > (this misbehavior sounds familiar) >> > > > >> > > >> > > > >> > > iterator() should return all values. >> > > > >> > > >> > > > >> > > iterateNonZero() is allowed to skip zeros. >> > > > >> > > >> > > > >> > > On Mon, Jan 14, 2013 at 6:11 AM, Koert Kuipers < >> > koert@tresata.com >> > > > >> > > > >> > wrote: >> > > > >> > > >> > > > >> > > > i am looking at the iterators for DenseVector, >> > > > >> > RandomAcccessSparseVector >> > > > >> > > > and SequentialAccessSparseVector. >> > > > >> > > > >> > > > >> > > > for both DenseVector and RandomAcccessSparseVector the >> > iterator >> > > > >> seems >> > > > >> > to >> > > > >> > > > return all values, including the missing zero values. >> > > > >> > > > for SequentialAccessSparseVector the iterator also returns >> all >> > > > >> values, >> > > > >> > > but >> > > > >> > > > only up to the last non-missing value! >> > > > >> > > > >> > > > >> > > > is this by design? what is a vector iterator supposed to >> > return >> > > > >> > exactly? >> > > > >> > > i >> > > > >> > > > can't see a logical pattern/consistency. see examples >> below. >> > > > >> > > > thanks! koert >> > > > >> > > > >> > > > >> > > > scala> val x = new >> > > > >> org.apache.mahout.math.RandomAccessSparseVector(5) >> > > > >> > > > x: org.apache.mahout.math.RandomAccessSparseVector = {} >> > > > >> > > > >> > > > >> > > > scala> x.set(3, 1.0) >> > > > >> > > > >> > > > >> > > > scala> for (item <- x.iterator.asScala) >> println((item.index, >> > > > >> item.get)) >> > > > >> > > > (0,0.0) >> > > > >> > > > (1,0.0) >> > > > >> > > > (2,0.0) >> > > > >> > > > (3,1.0) >> > > > >> > > > (4,0.0) >> > > > >> > > > >> > > > >> > > > scala> val y = new >> > > > >> > org.apache.mahout.math.SequentialAccessSparseVector(5) >> > > > >> > > > y: org.apache.mahout.math.SequentialAccessSparseVector = { >> > > > >> > > > >> > > > >> > > > scala> y.set(3, 1.0) >> > > > >> > > > >> > > > >> > > > scala> for (item <- y.iterator.asScala) >> println((item.index, >> > > > >> item.get)) >> > > > >> > > > (0,0.0) >> > > > >> > > > (1,0.0) >> > > > >> > > > (2,0.0) >> > > > >> > > > (3,1.0) >> > > > >> > > > >> > > > >> > > >> > > > >> > >> > > > >> >> > > > >> >> > > > >> >> > > > >> -- >> > > > >> >> > > > >> -jake >> > > > >> >> > > > > >> > > > > >> > > > >> > > >> > > >> > > >> > > -- >> > > >> > > -jake >> > > >> > >> >> >> >> -- >> >> -jake >> > > --047d7b5d4498acc3f604d3468342--