lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joel Bernstein (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-8492) Add LogisticRegressionQuery and LogitStream
Date Sat, 13 Feb 2016 17:22:18 GMT

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

Joel Bernstein commented on SOLR-8492:
--------------------------------------

[~caomanhdat], I've been testing out the algorithm by comparing it to R. I've attached the
data set I'm using to the ticket. I'm attempting make sense of the results but they don't
seem to match up.

I ran the following LogitStream call:
{code}
logit(collection3, q="*:*", features="married_i", outcome="buy_i", maxIterations=100)
{code}
And got this for the final weights:
{code}
{"features":["married_i"],"weights":[-0.5048080969966502],"error":0.3808560947044004}
{code}

In R, here is the output for the same data set. *Note* that *Is.Married* is the same field
as *married_i* in Solr and same for *Buy* and *buy_i*

{code}
Call:
glm(formula = Buy ~ Is.Married, family = "binomial", data = mydata)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.9687  -0.4201  -0.4201  -0.4201   2.2232  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -2.3830     0.1718 -13.870   <2e-16 ***
Is.Married    1.8699     0.2184   8.563   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 646.05  on 672  degrees of freedom
Residual deviance: 564.47  on 671  degrees of freedom
AIC: 568.47

Number of Fisher Scoring iterations: 5

{code}

It appears that they are giving different results. Am I performing the test correctly?




> Add LogisticRegressionQuery and LogitStream
> -------------------------------------------
>
>                 Key: SOLR-8492
>                 URL: https://issues.apache.org/jira/browse/SOLR-8492
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Joel Bernstein
>         Attachments: SOLR-8492.patch, SOLR-8492.patch, SOLR-8492.patch, SOLR-8492.patch,
SOLR-8492.patch, SOLR-8492.patch
>
>
> This ticket is to add a new query called a LogisticRegressionQuery (LRQ).
> The LRQ extends AnalyticsQuery (http://joelsolr.blogspot.com/2015/12/understanding-solrs-analyticsquery.html)
and returns a DelegatingCollector that implements a Stochastic Gradient Descent (SGD) optimizer
for Logistic Regression.
> This ticket also adds the LogitStream which leverages Streaming Expressions to provide
iteration over the shards. Each call to LogitStream.read() calls down to the shards and executes
the LogisticRegressionQuery. The model data is collected from the shards and the weights are
averaged and sent back to the shards with the next iteration. Each call to read() returns
a Tuple with the averaged weights and error from the shards. With this approach the LogitStream
streams the changing model back to the client after each iteration.
> The LogitStream will return the EOF Tuple when it reaches the defined maxIterations.
When sent as a Streaming Expression to the Stream handler this provides parallel iterative
behavior. This same approach can be used to implement other parallel iterative algorithms.
> The initial patch has  a test which simply tests the mechanics of the iteration. More
work will need to be done to ensure the SGD is properly implemented. The distributed approach
of the SGD will also need to be reviewed.  
> This implementation is designed for use cases with a small number of features because
each feature is it's own discreet field.
> An implementation which supports a higher number of features would be possible by packing
features into a byte array and storing as binary DocValues.
> This implementation is designed to support a large sample set. With a large number of
shards, a sample set into the billions may be possible.
> sample Streaming Expression Syntax:
> {code}
> logit(collection1, features="a,b,c,d,e,f" outcome="x" maxIterations="80")
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message