You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Stuart Smith (Created) (JIRA)" <ji...@apache.org> on 2012/01/18 03:57:39 UTC

[jira] [Created] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
-------------------------------------------------------------------------------------

                 Key: MAHOUT-948
                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
             Project: Mahout
          Issue Type: Improvement
          Components: Integration
         Environment: I just pulled the latest from SVN today (01/17/2012)
            Reporter: Stuart Smith
            Priority: Trivial


MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.

In short, this:
<code>
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
    if( type == null ) {
	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
    }		
    switch (type) {
      case NUMERIC:
        result = processNumeric(data);
</code>
Is better than this:
<code>
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
   switch (type) {
      case NUMERIC:
        result = processNumeric(data);
 </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Smith updated MAHOUT-948:
--------------------------------

    Attachment: MapBackedARFFModel.java

Updated file attached
                
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188230#comment-13188230 ] 

Stuart Smith commented on MAHOUT-948:
-------------------------------------

Admittedly, the message still kinda sucks.. maybe something like "Illegal attribute index in arff data line, attribute index was: " + idx   

Any other thoughts welcome. Would be killer if we could dump the line number in the arff file & the line that caused it.
 
                
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188229#comment-13188229 ] 

Stuart Smith commented on MAHOUT-948:
-------------------------------------

Using correct code tags..
{code}
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
    if( type == null ) {
        throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
    }		
    switch (type) {
      case NUMERIC:
        result = processNumeric(data);
        break;
 {code}
                
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204866#comment-13204866 ] 

Hudson commented on MAHOUT-948:
-------------------------------

Integrated in Mahout-Quality #1344 (See [https://builds.apache.org/job/Mahout-Quality/1344/])
    MAHOUT-948 better error for bad type

srowen : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1242333
Files : 
* /mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/arff/MapBackedARFFModel.java

                
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Assignee: Sean Owen
>            Priority: Trivial
>              Labels: patch
>             Fix For: 0.7
>
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188227#comment-13188227 ] 

Stuart Smith commented on MAHOUT-948:
-------------------------------------

<pre>
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
    if( type == null ) {
        throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
    }		
    switch (type) {
      case NUMERIC:
        result = processNumeric(data);
        break;
 </pre>
                
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188226#comment-13188226 ] 

Stuart Smith commented on MAHOUT-948:
-------------------------------------

Eh, description didn't respect the code tags:
<code>
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
    if( type == null ) {
        throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
    }		
    switch (type) {
      case NUMERIC:
        result = processNumeric(data);
        break;
 </code>
                
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Smith updated MAHOUT-948:
--------------------------------

    Comment: was deleted

(was: Eh, description didn't respect the code tags:
<code>
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
    if( type == null ) {
        throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
    }		
    switch (type) {
      case NUMERIC:
        result = processNumeric(data);
        break;
 </code>)
    
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Stuart Smith (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Smith updated MAHOUT-948:
--------------------------------

    Comment: was deleted

(was: <pre>
  public double getValue(String data, int idx) {
    ARFFType type = typeMap.get(idx);
    data = QUOTE_PATTERN.matcher(data).replaceAll("");
    data = data.trim();
    double result;
    if( type == null ) {
        throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
    }		
    switch (type) {
      case NUMERIC:
        result = processNumeric(data);
        break;
 </pre>)
    
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Priority: Trivial
>              Labels: patch
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]

Posted by "Sean Owen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen resolved MAHOUT-948.
------------------------------

       Resolution: Fixed
    Fix Version/s: 0.7
         Assignee: Sean Owen
    
> Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-948
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-948
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>         Environment: I just pulled the latest from SVN today (01/17/2012)
>            Reporter: Stuart Smith
>            Assignee: Sean Owen
>            Priority: Trivial
>              Labels: patch
>             Fix For: 0.7
>
>         Attachments: MapBackedARFFModel.java
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist.
> In short, this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>     if( type == null ) {
> 	throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx );
>     }		
>     switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
> </code>
> Is better than this:
> <code>
>   public double getValue(String data, int idx) {
>     ARFFType type = typeMap.get(idx);
>     data = QUOTE_PATTERN.matcher(data).replaceAll("");
>     data = data.trim();
>     double result;
>    switch (type) {
>       case NUMERIC:
>         result = processNumeric(data);
>  </code>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira