You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Nick Pentreath (JIRA)" <ji...@apache.org> on 2017/07/05 08:22:00 UTC
[jira] [Commented] (SPARK-21306) OneVsRest Conceals Columns That
May Be Relevant To Underlying Classifier
[ https://issues.apache.org/jira/browse/SPARK-21306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16074404#comment-16074404 ]
Nick Pentreath commented on SPARK-21306:
----------------------------------------
This is definitely an issue. I don't think it is an issue with columns other than {{weight}}, right?
The easy fix would be to simply use the entire dataset in the {{fit}} logic, though that would probably result in caching unnecessary data. If it is only the weight col that is really impacted, we could just add a check for that param on the classifier and if present, select the weight column also.
> OneVsRest Conceals Columns That May Be Relevant To Underlying Classifier
> ------------------------------------------------------------------------
>
> Key: SPARK-21306
> URL: https://issues.apache.org/jira/browse/SPARK-21306
> Project: Spark
> Issue Type: Improvement
> Components: ML
> Affects Versions: 2.1.1
> Reporter: Cathal Garvey
> Priority: Minor
> Labels: classification, ml
>
> Hi folks, thanks for Spark! :)
> I've been learning to use `ml` and `mllib`, and I've encountered a block while trying to use `ml.classification.OneVsRest` with `ml.classification.LogisticRegression`. Basically, [here in the code|https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala#L320], only two columns are being extracted and fed to the underlying classifiers.. however with some configurations, more than two columns are required.
> Specifically: I want to do multiclass learning with Logistic Regression, on a very imbalanced dataset. In my dataset, I have lots of imbalances, so I was planning to use weights. I set a column, `"weight"`, as the inverse frequency of each field, and I configured my `LogisticRegression` class to use this column, then put it in a `OneVsRest` wrapper.
> However, `OneVsRest` strips all but two columns out of a dataset before training, so I get an error from within `LogisticRegression` that it can't find the `"weight"` column.
> It would be nice to have this fixed! I can see a few ways, but a very conservative fix would be to include a parameter in `OneVsRest.fit` for additional columns to `select` before passing to the underlying model.
> Thanks!
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org