In spark mllib there are some classifers algorithm like Random Forest, Gradient-Boosted Trees, etc. I try to general before and after process then only change algorithm class for each time.
train(ProbabilisticClassifier<Vector, ? extends Predictor, ? extends Transformer> classifier) {
...
classifier.setLabelCol(myLabel).setFeaturesCol(myFeatures)
...
}
which then I can pass
GBTClassifier gbtClassifier = new GBTClassifier()
train(gbtClassifier)
I need to custom paramenters for setLabelCol() and setFeaturesCol(). Predictor abstact class contains these 2 function. That why I have to use:
ProbabilisticClassifier<Vector, ? extends Predictor, ? extends Transformer> classifier
But keyword Predictor show the message "Raw use of parameterized class". Predictor require some castings and also self casting.
I can still run code well but I guess there some potential issue with that.
Predictor class from spark java doc here