spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mina Aslani <aslanim...@gmail.com>
Subject Re: 'requirement failed: OneHotEncoderModel expected x categorical values for input column label, but the input column had metadata specifying n values.'
Date Wed, 06 Nov 2019 04:13:39 GMT
Hi,

The metadata for both LogisticRegression and MultilayerPerceptronClassifier
follows:


{'ml_attr': {'vals': ['bad', 'good', '__unknown'], 'type': 'nominal',
'name': 'label'}}


And, the label values are

+-----+

|label|

+-----+

|  0.0|

|  1.0|

+-----+


How come it throws *java.lang.IllegalArgumentException*:*requirement
failed: OneHotEncoderModel expected 2 categorical values for input column
label, but the input column had metadata specifying 3 values.'* in
MultilayerPerceptronClassifier
and not LogisticRegression. How can I resolve this?


Regards,

Mina


On Tue, Nov 5, 2019 at 3:55 PM Mina Aslani <aslanimina@gmail.com> wrote:

> Hi,
>
> I am getting the following exception when I am
> using OneHotEncoderEstimator with MultilayerPerceptronClassifier in
> Pyspark. (using version 2.4.4)
>
> *'requirement failed: OneHotEncoderModel expected x categorical values for
> input column label, but the input column had metadata specifying n values.'*
>
> Using LogisticRegression, RandomForestClassifier or LinearRegression works
> fine for the same data and OneHotEncoderEstimator.
>
> Any insight on how to resolve this?
>
> Regards,
> Mina
>
>
>
>

Mime
View raw message