mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jake Mannix <jake.man...@gmail.com>
Subject Re: does anyone use the "row label bindings" stuff in Vector / Matrix?
Date Wed, 02 Nov 2011 14:58:43 GMT
On Wed, Nov 2, 2011 at 7:34 AM, Grant Ingersoll <gsingers@apache.org> wrote:

> What functionality, specifically, are you proposing to remove?


I'm suggesting we kill, from Matrix.java and descendents, all of the
following methods:

  Map<String, Integer> getColumnLabelBindings();
  Map<String, Integer> getRowLabelBindings();
  void setColumnLabelBindings(Map<String, Integer> bindings);
  void setRowLabelBindings(Map<String, Integer> bindings);
  double get(String rowLabel, String columnLabel);
  void set(String rowLabel, String columnLabel, double value);
  void set(String rowLabel, String columnLabel, int row, int column, double
value);
  void set(String rowLabel, double[] rowData);
  void set(String rowLabel, int row, double[] rowData);


> I know we had a lot of discussion around some of this stuff way back when
> as to how best to do it, but of course, that doesn't mean it has uptake.
>  If it's on the Matrix, then doesn't it more easily get shipped around via
> the Writables vs. requiring the user to do that?   Not sure it is an issue,
> but it's one less piece of code someone else has to write.


MatrixWritable does not, in fact, serialize the labels along with the
matrix, it turns out.  There are two methods for (de-)serializing them
separately:

  public static void readLabels(DataInput in,
                                Map<String, Integer> columnLabelBindings,
                                Map<String, Integer> rowLabelBindings)
throws IOException;

  public static void writeLabelBindings(DataOutput out,
                                        Map<String, Integer>
columnLabelBindings,
                                        Map<String, Integer>
rowLabelBindings) throws IOException;

but neither of these are used anywhere in the codebase (even in tests).

  -jake


> On Nov 2, 2011, at 5:17 AM, Jake Mannix wrote:
>
> > Doesn't look like they're used anywhere but tests.
> >
> > In the spirit of removing clutter, I suggest we rip that stuff out!  It's
> > really not that unreasonable to carry around BiMap<String, Integer>
> > dictionary to translate between feature labels and featureIds outside a
> > Matrix rather than "set" it on the matrix itself.
> >
> >  -jake
>
>
>

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