'pyspark LinearSVC getting 3 classes of labelcol where there is only 2 classe in my variable

I used to run my models ( LinearSVC+ randomforest + ... ) on a training dataset and it goes well. last time i tried to re-train my model all my models work except for the LinearSVC. its getting the error bellow

IllegalArgumentException: u'requirement failed: LinearSVC only supports binary classification. 3 classes detected in LinearSVC_495a8534f227d203d920__labelCol'

here's my code and the capture that shows that my variable contains only 2 modalities.

fittedscv = scv_model('label').fit(train)
data_scv = fittedscv.transform(test)

where scv_model is a defined function:

def scv_model(lab = 'label'):
    svc =  LinearSVC(featuresCol='features', labelCol=lab, predictionCol='prediction',weightCol = 'poids',standardization =True)
    pipeline = Pipeline(stages=[svc])
    paramGrid = ParamGridBuilder()\
    .addGrid(svc.regParam, [1,5,10])\
    .addGrid(svc.aggregationDepth, [30,60])\
    .addGrid(svc.maxIter, [150])\
    .build()
    crossval = CrossValidator(estimator=pipeline,
                          estimatorParamMaps=paramGrid,
                          
    evaluator=BinaryClassificationEvaluator(rawPredictionCol="prediction"),
                          numFolds=4)

    return crossval

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source