Github user yanboliang commented on the pull request:
https://github.com/apache/spark/pull/11486#issuecomment-192089154
It's a good question! It's possible that the label of input dataset is not
0 based or not continuous. So we should use ```StringIndexer``` to index label
in [0, numLabels), and after training we use ```IndexToString``` to map index
label to the original ones. We have already store the label map in the metadata
of label column.
All the models under ML package will follow this rule. For examples, if you
train ```LogisticRegression``` with the input label ```"-1, +1"``` will produce
erroneous results, you should use ```StringIndexer``` to transform labels to
```"0, 1"``` firstly.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]