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

Tommaso Teofili commented on SOLR-3700:
---------------------------------------

the suggested snippet for calculating the frequency of terms (from the 
'content' field) in docs with a certain class is ok apart that the terms should 
be extracted from the text field instead of the class field and the docFreq 
should be counted on the class field:
{code}
    Terms terms = MultiFields.getTerms(atomicReader, textFieldName);
    long numPostings = terms.getSumDocFreq(); // number of term/doc pairs
    double avgNumberOfUniqueTerms = numPostings / (double) terms.getDocCount(); 
// avg # of unique terms per doc
    int docsWithC = atomicReader.docFreq(classFieldName, new BytesRef(c));
    return avgNumberOfUniqueTerms * docsWithC; // avg # of unique terms in text 
field per doc * # docs with c
{code}
comparing the previous (slow) ranked search giving an output of 92 this gives 
an estimated output of ~98.6 which seems reasonable.
                
> Create a Classification component
> ---------------------------------
>
>                 Key: SOLR-3700
>                 URL: https://issues.apache.org/jira/browse/SOLR-3700
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Tommaso Teofili
>            Assignee: Tommaso Teofili
>            Priority: Minor
>         Attachments: SOLR-3700_2.patch, SOLR-3700.patch
>
>
> Lucene/Solr can host huge sets of documents containing lots of information in 
> fields so that these can be used as training examples (w/ features) in order 
> to very quickly create classifiers algorithms to use on new documents and / 
> or to provide an additional service.
> So the idea is to create a contrib module (called 'classification') to host a 
> ClassificationComponent that will use already seen data (the indexed 
> documents / fields) to classify new documents / text fragments.
> The first version will contain a (simplistic) Lucene based Naive Bayes 
> classifier but more implementations should be added in the future.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to