zero323 commented on issue #26033: [SPARK-29363][MLLIB] Make 
o.a.s.regression.Regressor public
URL: https://github.com/apache/spark/pull/26033#issuecomment-538723282
 
 
   > Beside consistency, is there any benefit?
   
   @viirya  I believe there is (I tried to make this point in the linked JIRA, 
as well as somewhat related 
[SPARK-29212](https://issues.apache.org/jira/browse/SPARK-29212)), though I 
guess I am not that good in pointing that out. 
   
   `Regressor` and similarly positioned traits have very little purely 
technical value - from the point of view of simple composition they can be 
simply replaced by `Prediction` / `PredictionModel`, however, they provide very 
useful information about *meaning* of the types, that extend them.
   
   Let's imagine for a moment I want to build ensemble learners. Clearly one 
for regression problem will expect different type of partial learners than one 
for classification problems:
   
   ```scala
   class EnsembleRegressor extends Estimator[EnsembleRegressor] with ... {
     def setModels(learners: Array[Regressor]: this.type
     ...
   }
   
   class EnsembleClassifier extends Estimator[EnsembleClassifier] with ...  {
     def setModels(learners: Array[Classifier]): this.type
     ...
   }
   ```
   
   So having these traits public, allows users to write more precise code, 
without hacks, like putting 3rd party code in `o.a.s`. 
   
   Obviously benefits rather limited, as dynamic nature of `DataFrame` leaks 
all over the place, but at the same time there is no harm giving users more 
precise tools to express their intentions.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to