Same questions here.

GBTClassifier and MultilayerPerceptronClassifier extend Predictor[_,_]
rather than Classifier[_,_]. However, both are classifiers. It looks like
the class inheritance hierarchy is not strictly followed.

I wonder if the community considers it an issue, and has a plan for the fix?

Thanks!
Guo-Xun







On Thu, Oct 20, 2016 at 11:54 PM, Nick Pentreath <nick.pentre...@gmail.com>
wrote:

> Currently no - GBT implements the predictors, not the classifier
> interface. It might be possible to wrap it in a wrapper that extends the
> Classifier trait.
>
> Hopefully GBT will support multi-class at some point. But you can use
> RandomForest which does support multi-class.
>
> On Fri, 21 Oct 2016 at 02:12 ansari <hiday...@gmail.com> wrote:
>
>> It appears as if the inheritance hierarchy doesn't allow GBTClassifiers
>> to be
>> used as the binary classifier in a OneVsRest trainer. Is there a simple
>> way
>> to use gradient-boosted trees for multiclass (not binary) problems?
>>
>> Specifically, it complains that GBTClassifier doesn't inherit from
>> Classifier[_, _, _].
>>
>> I'm using Spark 2.0.1:
>>
>> val gbt = new GBTClassifier()
>>   .setLabelCol("indexedLabel")
>>   .setFeaturesCol("features")
>>   .setMaxIter(10)
>>   .setMaxDepth(10)
>>
>> val ovr = new OneVsRest().
>>     setClassifier(gbt)
>>
>> fails saying
>>
>> error: type mismatch;
>>  found   : org.apache.spark.ml.classification.GBTClassifier
>>  required: org.apache.spark.ml.classification.Classifier[_, _, _]
>>            setClassifier(gbt)
>>
>>
>>
>> --
>> View this message in context: http://apache-spark-user-list.
>> 1001560.n3.nabble.com/Spark-ML-Using-GBTClassifier-in-
>> OneVsRest-tp27933.html
>> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe e-mail: user-unsubscr...@spark.apache.org
>>
>>

Reply via email to