You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@samoa.apache.org by fobeligi <gi...@git.apache.org> on 2017/05/20 14:41:37 UTC

[GitHub] incubator-samoa pull request #60: Fix bug in DenseInstance toString method a...

GitHub user fobeligi opened a pull request:

    https://github.com/apache/incubator-samoa/pull/60

    Fix bug in DenseInstance toString method and in TextGenerator class

    - Fixed bug in DenseInstance class toString method which resulted in always writing an arff file with class equal to zero.
    
    - Change TextGenerator class to create SparseInstances instead of  DenseInstances.
    
    - Change the Attribute class in order to write the values of the nominal attributes between brackets in the attribute section of the arff file.
    
    - Change SingleLabelInstance classAttribute method in to return the correct attribute that represents the class value.
    
    - Override toString in SparseInstance class in order to write sparse formatted arff files.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/fobeligi/incubator-samoa DenseInstance-bugFix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-samoa/pull/60.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #60
    
----
commit be264f9a94312ec4d9f3040c89ab8e57acaddf22
Author: fobeligi <fa...@gmail.com>
Date:   2017-05-20T14:24:21Z

    Fix bug in DenseInstance toString method which resulted in always writing an arff file with class equal to zero.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-samoa issue #60: Fix bug in DenseInstance toString method and in T...

Posted by fobeligi <gi...@git.apache.org>.
Github user fobeligi commented on the issue:

    https://github.com/apache/incubator-samoa/pull/60
  
    Hello @nicolas-kourtellis, as @gdfm also said, the <code>TextGenerator</code> class was indeed generating dense instances instead of sparse as expected. Moreover, sparse instances could be written in sparse arff file format.  
    
    Regarding the <code>toString</code> method in <code>DenseInstance</code> class, was always appending the weight of an instance at the end of it, something that is not wrong, but it was not taken into consideration when reading the arff file. As a result, the weight(= the last value of each instance) was mistakenly considered to be the class of the instance when reading a file generated by SAMOA.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-samoa pull request #60: Fix bug in DenseInstance toString method a...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-samoa/pull/60


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-samoa issue #60: Fix bug in DenseInstance toString method and in T...

Posted by gdfm <gi...@git.apache.org>.
Github user gdfm commented on the issue:

    https://github.com/apache/incubator-samoa/pull/60
  
    Indeed, the previous version was creating dense instances.
    For sparse instances, we need to write them in sparse format.
    
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-samoa pull request #60: Fix bug in DenseInstance toString method a...

Posted by nicolas-kourtellis <gi...@git.apache.org>.
Github user nicolas-kourtellis commented on a diff in the pull request:

    https://github.com/apache/incubator-samoa/pull/60#discussion_r123262757
  
    --- Diff: samoa-instances/src/main/java/org/apache/samoa/instances/Attribute.java ---
    @@ -199,7 +196,14 @@ public String toString() {
         text.append(ARFF_ATTRIBUTE).append(" ").append(Utils.quote(this.name)).append(" ");
     
         if (isNominal) {
    -      text.append(ARFF_ATTRIBUTE_NOMINAL);
    +      text.append('{');
    +      Enumeration enu =  enumerateValues();
    +      while (enu.hasMoreElements()) {
    +        text.append(Utils.quote((String) enu.nextElement()));
    +        if (enu.hasMoreElements())
    +          text.append(',');
    +      }
    +      text.append('}');
    --- End diff --
    
    Hi @fobeligi,
    Was the previous one not working properly?
    Do we need to construct the arff format explicitly?
    Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-samoa issue #60: Fix bug in DenseInstance toString method and in T...

Posted by gdfm <gi...@git.apache.org>.
Github user gdfm commented on the issue:

    https://github.com/apache/incubator-samoa/pull/60
  
    Created SAMOA-70 to record this change and merged.
    Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-samoa issue #60: Fix bug in DenseInstance toString method and in T...

Posted by nicolas-kourtellis <gi...@git.apache.org>.
Github user nicolas-kourtellis commented on the issue:

    https://github.com/apache/incubator-samoa/pull/60
  
    Ok sounds good. Lets merge this.
    Thanks for the contribution @fobeligi 
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---