[ 
https://issues.apache.org/jira/browse/MAHOUT-1638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14386079#comment-14386079
 ] 

Andrew Palumbo commented on MAHOUT-1638:
----------------------------------------

Current status:

{code}
Map<String,Integer> map = m.getRowLabelBindings();
    if (map != null) {
      // label vector must be similarly partitioned like the Frame
      byte []typeArr = {Vec.T_STR};
      labels = frame.lastVec().makeCons(1, frame.numRows(), null , typeArr)[0];
      Vec.Writer writer = labels.open();

      Map<Integer,String> rmap = reverseMap(map);
      for (int r = 0; r < m.rowSize(); r++){    
         writer.set(r, rmap.get(r).toString());
      }
      writer.close(closer);
    }

{code}
When I run tests i can verify that 
{code}
labels.isString() == true
labels.chunkForRow(r).getClass().getSimpleName() == "C0LChunk"
{code}

As far as I can tell, we need a {{CStrChunk}} or a {{NewChunk}} to be able to 
set a String Value.

still getting the exception:
{code}
Not a String
java.lang.IllegalArgumentException: Not a String
        at water.fvec.Chunk.set_impl(Chunk.java:494)
        at water.fvec.Chunk.set(Chunk.java:456)
        at water.fvec.Chunk.set_abs(Chunk.java:358)
        at water.fvec.Vec$Writer.set(Vec.java:821)
{code}


> H2O bindings fail at drmParallelizeWithRowLabels(...)
> -----------------------------------------------------
>
>                 Key: MAHOUT-1638
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1638
>             Project: Mahout
>          Issue Type: Bug
>    Affects Versions: 0.10.0
>            Reporter: Andrew Palumbo
>            Assignee: Andrew Palumbo
>            Priority: Blocker
>              Labels: DSL, h2o, scala
>             Fix For: 0.10.0
>
>
> The H2OHelper.drmFromMatrix(...) function fails when trying to write row 
> label String keys to a water.fvec.Vec.:
> {code:java}
>  java.lang.IllegalArgumentException: Not a String
>   at water.fvec.Chunk.set_impl(Chunk.java:507)
>   at water.fvec.Chunk.set0(Chunk.java:469)
>   at water.fvec.Chunk.set(Chunk.java:371)
>   at water.fvec.Vec$Writer.set(Vec.java:803)
>   at org.apache.mahout.h2obindings.H2OHelper.drmFromMatrix(H2OHelper.java:331)
>   at 
> org.apache.mahout.h2obindings.H2OEngine$.drmParallelizeWithRowLabels(H2OEngine.scala:83)
>                                                                    
>   at 
> org.apache.mahout.math.drm.package$.drmParallelizeWithRowLabels(package.scala:67)
> {code} 
> This causes an exception when calling drm.drmParallelizeWithRowLabels(...)
> To reproduce, apply [PR#72: Enable Naive Bayes Tests in h2o 
> Module|https://github.com/apache/mahout/pull/72] and run:
> {code} $ mvn test 
> {code}
> from the h2o module:
> {code:java}
> - NB Aggregator *** FAILED ***
>   java.lang.IllegalArgumentException: Not a String
>   at water.fvec.Chunk.set_impl(Chunk.java:507)
>   at water.fvec.Chunk.set0(Chunk.java:469)
>   at water.fvec.Chunk.set(Chunk.java:371)
>   at water.fvec.Vec$Writer.set(Vec.java:803)
>   at org.apache.mahout.h2obindings.H2OHelper.drmFromMatrix(H2OHelper.java:331)
>   at 
> org.apache.mahout.h2obindings.H2OEngine$.drmParallelizeWithRowLabels(H2OEngine.scala:83)
>                                                                    
>   at 
> org.apache.mahout.math.drm.package$.drmParallelizeWithRowLabels(package.scala:67)
>                                                                           
>   at 
> org.apache.mahout.classifier.naivebayes.NBTestBase$$anonfun$2.apply$mcV$sp(NBTestBase.scala:91)
>                                                             
>   at 
> org.apache.mahout.classifier.naivebayes.NBTestBase$$anonfun$2.apply(NBTestBase.scala:70)
>                                                                    
>   at 
> org.apache.mahout.classifier.naivebayes.NBTestBase$$anonfun$2.apply(NBTestBase.scala:70)
>                                                                    
>   ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to