mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koert Kuipers <ko...@tresata.com>
Subject Re: understanding vectors
Date Mon, 14 Jan 2013 17:21:29 GMT
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)
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message