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

Seth Hendrickson edited comment on SPARK-17163 at 8/25/16 7:07 PM:
-------------------------------------------------------------------

All, I'm working on this now. I think we still need to decide how we want to 
handle representing coefficients and intercept in the model. AFAIK we still 
have to provide

{code:java}
def coefficients: Vector
def intercept: Double
{code}

in the model. Changing the signature would break API compatibility. One 
possible solution would be an interface like:

{code:java}
val coefficientMatrix: Matrix
val interceptVector: Vector
def coefficients: Vector = if (!isMultinomial) {
  Vectors.dense(coefficientMatrix.toArray)
} else {
  throw new Exception
}
private val _intercept = if (!isMultinomial) interceptVector.toArray.head else 
0.0
def intercept: Double = {
    if (isMultinomial) {
      throw new Exception
    }
    _intercept
  }
{code}

(The names are open for changing, obviously). DB suggested throwing an 
exception, though, but I'm not sure if we are ok breaking old models like that? 
I appreciate the feedback, thanks!


was (Author: sethah):
All, I'm working on this now. I think we still need to decide how we want to 
handle representing coefficients and intercept in the model. AFAIK we still 
have to provide

{code:java}
def coefficients: Vector
def intercept: Double
{code}

in the model. Changing the signature would break API compatibility. One 
possible solution would be an interface like:

{code:java}
val coefficientsMatrix: Matrix
val interceptVector: Vector
val coefficients: Vector = Vectors.dense(coefficientMatrix.toArray) // flattened
private val _intercept = if (!isMultinomial) interceptVector.toArray.head else 
0.0
def intercept: Double = {
    if (isMultinomial) {
      logWarning("Multiclass model contains a vector of intercepts, use 
interceptVector instead." +
        "Returning 0.0 as placeholder.")
    }
    _intercept
  }
{code}

(The names are open for changing, obviously). DB suggested throwing an 
exception, though, but I'm not sure if we are ok breaking old models like that? 
I appreciate the feedback, thanks!

> Merge MLOR into a single LOR interface
> --------------------------------------
>
>                 Key: SPARK-17163
>                 URL: https://issues.apache.org/jira/browse/SPARK-17163
>             Project: Spark
>          Issue Type: Sub-task
>          Components: ML, MLlib
>            Reporter: Seth Hendrickson
>
> Before the 2.1 release, we should finalize the API for logistic regression. 
> After SPARK-7159, we have both LogisticRegression and 
> MultinomialLogisticRegression models. This may be confusing to users and, is 
> a bit superfluous since MLOR can do basically all of what BLOR does. We 
> should decide if it needs to be changed and implement those changes before 2.1
> *Update*: Seems we have decided to merge the two estimators. I changed the 
> title to reflect that.



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

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

Reply via email to