You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Andre-Philippe Paquet (Created) (JIRA)" <ji...@apache.org> on 2011/10/03 21:10:34 UTC

[jira] [Created] (MAHOUT-826) Bayes/CBayes classification on a non-existing feature

Bayes/CBayes classification on a non-existing feature
-----------------------------------------------------

                 Key: MAHOUT-826
                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
             Project: Mahout
          Issue Type: Bug
          Components: Classification
    Affects Versions: 0.5
            Reporter: Andre-Philippe Paquet
            Priority: Minor


(see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)

Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).

As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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

        

Re: [jira] [Updated] (MAHOUT-826) Bayes/CBayes classification on a non-existing feature

Posted by Robin Anil <ro...@gmail.com>.
Those are inconclusive as its testing only a few strings. Slight change in
weights can throw off things. I put it as a sanity check to ensure noone
changes the code drastically without others knowing about it.

 Can you run the 20newsgroups example and print the confusion matrix. If
that didnt change, I dont think we need to look too much into the test. We
can stuff more words and change the weight.


On Thu, Oct 6, 2011 at 1:50 AM, Isabel Drost (Updated) (JIRA) <
jira@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/MAHOUT-826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Isabel Drost updated MAHOUT-826:
> --------------------------------
>
>    Attachment: mahout-826.patch
>
> I've taken a quick look at the patch - technically looks good. Added a test
> case for each modification and reformatted slightly.
>
> Concerning the test failure: I see the same. The change seems to cause a
> different output when testing the "BayesAlgorithm" - output remains the same
> for the "CBayesAlgorithm".
>
> Robin, do you have any quick explanation for that? Otherwise we might have
> to dig a bit deeper.
>
> > Bayes/CBayes classification on a non-existing feature
> > -----------------------------------------------------
> >
> >                 Key: MAHOUT-826
> >                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
> >             Project: Mahout
> >          Issue Type: Bug
> >          Components: Classification
> >            Reporter: Andre-Philippe Paquet
> >            Priority: Minor
> >         Attachments: mahout-826.patch, mahout-826.patch
> >
> >
> > (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> > Using CBayes or Bayes, when trying to classify a feature/word that
> doesn't exist in the model, instead of returning the default/unknown label,
> the algorithm returns all labels with a constant score (ex:
> 12.386649147018964). After a quick look in CBayesAlgorithm, I found the
> problem in the featureWeight function that returns the theta normalized
> weight even if the feature didn't have any match (result=0).
> > As a fix, I overrided the function in a subclass and return 0 if the
> weight of the current feature in the current label is 0.
>
> --
> 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-826) Bayes/CBayes classification on a non-existing feature

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

Andre-Philippe Paquet updated MAHOUT-826:
-----------------------------------------

    Status: Open  (was: Patch Available)
    
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Andre-Philippe Paquet commented on MAHOUT-826:
----------------------------------------------

See attached patch (against trunk). I'm using CBayesAlgorithm in my project, so I didn't test with BayesAlgorithm.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>         Attachments: mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Andre-Philippe Paquet updated MAHOUT-826:
-----------------------------------------

    Attachment: mahout-826.patch
    
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>         Attachments: mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen commented on MAHOUT-826:
----------------------------------

I have no idea, was just trying to pitch in. This is really Robin's to answer. Is Bayes even supported anymore? I haven't heard much of anything on it.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Assignee: Robin Anil
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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] [Issue Comment Edited] (MAHOUT-826) Bayes/CBayes classification on a non-existing feature

Posted by "Jeff Eastman (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13183013#comment-13183013 ] 

Jeff Eastman edited comment on MAHOUT-826 at 1/10/12 2:23 AM:
--------------------------------------------------------------

Sean, Isabel, Andre-Philippe, Robin: Is this issue going to be resolved pretty soon? It is really the long pole in the 0.6 tent right now.
                
      was (Author: jeastman):
    Sean, Isabel, Andre-Philippe: Is this issue going to be resolved pretty soon? It is really the long pole in the 0.6 tent right now.
                  
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Assignee: Robin Anil
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen updated MAHOUT-826:
-----------------------------

    Comment: was deleted

(was: Great is there a patch available? Or can you describe the simple change specifically?)
    
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>         Attachments: mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Isabel Drost commented on MAHOUT-826:
-------------------------------------

Re-ran the 20newsgroups example. Confusion matrices look the same. So I think we should modify the input data of the failing test as proposed by Robin on-list.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen updated MAHOUT-826:
-----------------------------

    Affects Version/s: 0.5
        Fix Version/s: 0.6
             Assignee: Robin Anil
    
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Assignee: Robin Anil
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen commented on MAHOUT-826:
----------------------------------

I dunno. The classifier test result now seems completely wrong. *Every* doc is mis-classified now in that test. Something's not quite right. I don't think this change is quite right.

I don't know a lot about this, but I think the behavior you describe is what it's trying to do. I don't see a notion of unknown or default feature in the data store. An unknown feature is equally likely to correspond to any class.

Robin, I think you should really look at this more -- what's the intended behavior in this case?
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sebastian Schelter resolved MAHOUT-826.
---------------------------------------

    Resolution: Won't Fix

The old naive bayes implementation got removed from the codebase, therefore this issue became obnoxious.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Assignee: Robin Anil
>            Priority: Minor
>             Fix For: 0.7
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen commented on MAHOUT-826:
----------------------------------

Great is there a patch available? Or can you describe the simple change specifically?
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Jeff Eastman updated MAHOUT-826:
--------------------------------

    Fix Version/s:     (was: 0.6)
                   0.7

Moving this issue to 0.7 as there has been no activity in some time and it is not clearly relevant any more. Happy to move it back if it can  be resolved this week.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Assignee: Robin Anil
>            Priority: Minor
>             Fix For: 0.7
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen commented on MAHOUT-826:
----------------------------------

Great is there a patch available? Or can you describe the simple change specifically?
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Sean Owen commented on MAHOUT-826:
----------------------------------

This makes the test BayesClassifierSelfTest fail. The first text snippet, which is a description of Mahout from the web page, is classified as "lucene" rather than "mahout". I don't know why the change would have done this since it seems sensible. Could you have a look?
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>         Attachments: mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Isabel Drost updated MAHOUT-826:
--------------------------------

    Attachment: mahout-826.patch

I've taken a quick look at the patch - technically looks good. Added a test case for each modification and reformatted slightly.

Concerning the test failure: I see the same. The change seems to cause a different output when testing the "BayesAlgorithm" - output remains the same for the "CBayesAlgorithm".

Robin, do you have any quick explanation for that? Otherwise we might have to dig a bit deeper.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Andre-Philippe Paquet updated MAHOUT-826:
-----------------------------------------

    Affects Version/s:     (was: 0.5)
               Status: Patch Available  (was: Open)
    
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>            Reporter: Andre-Philippe Paquet
>            Priority: Minor
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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-826) Bayes/CBayes classification on a non-existing feature

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

Jeff Eastman commented on MAHOUT-826:
-------------------------------------

Sean, Isabel, Andre-Philippe: Is this issue going to be resolved pretty soon? It is really the long pole in the 0.6 tent right now.
                
> Bayes/CBayes classification on a non-existing feature
> -----------------------------------------------------
>
>                 Key: MAHOUT-826
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-826
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.5
>            Reporter: Andre-Philippe Paquet
>            Assignee: Robin Anil
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: mahout-826.patch, mahout-826.patch
>
>
> (see http://comments.gmane.org/gmane.comp.apache.mahout.user/9597)
> Using CBayes or Bayes, when trying to classify a feature/word that doesn't exist in the model, instead of returning the default/unknown label, the algorithm returns all labels with a constant score (ex: 12.386649147018964). After a quick look in CBayesAlgorithm, I found the problem in the featureWeight function that returns the theta normalized weight even if the feature didn't have any match (result=0).
> As a fix, I overrided the function in a subclass and return 0 if the weight of the current feature in the current label is 0. 

--
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