Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/12066#discussion_r61579562
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
@@ -62,6 +92,14 @@ abstract class Classifier[
/** @group setParam */
def setRawPredictionCol(value: String): E = set(rawPredictionCol,
value).asInstanceOf[E]
+ override def fit(dataset: Dataset[_]): M = {
+ // This handles a few items such as schema validation.
+ // Developers only need to implement train().
+ transformSchema(dataset.schema, logging = true)
+ copyValues(train(dataset).setParent(this))
+ .setPredictionMetadata(generatePredictionMetadata(dataset.schema))
--- End diff --
It looks like weird to set ```predictionMetadata``` which is a member
variable of the model object with another member variable of this object. Think
more, ```generatePredictionMetadata``` usually was called by
```validateAndTransformSchema```, looking at the API:
```
override protected def validateAndTransformSchema(
schema: StructType,
fitting: Boolean,
featuresDataType: DataType): StructType = {
......
}
```
It transform the old schema to the new one. It's also strange that we pass
in an argument ```numClasses```, or whether we have possibility to add more
metadata and also pass in as arguments in future? I think this should be
further defined and it has exceed the scope of this PR. Let's do it in a
separate one? I'm open to hear your thoughts.
---
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]