Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error at getting performance metrics with multiclass classifier #99

Open
statscol opened this issue May 14, 2020 · 1 comment
Open

Error at getting performance metrics with multiclass classifier #99

statscol opened this issue May 14, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@statscol
Copy link

Currently having an issue while trying to replicate one of the sample apps (Sample App scikit-learn - K-fold Cross Validation). Basically everything i did was loading IRIS dataset to Qlik following step by step instructions in the repo, however in the Train & test section i get the following error:

'Exception iterating responses: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'].'

This error comes out due to the scoring metric in GridSearchCV and when trying to compute performance scores like Precision or F1-score over a multiclass classification problem, how can i set the 'average' argument straight from Qlik?

@statscol statscol added the bug Something isn't working label May 14, 2020
@nabeel-oz
Copy link
Owner

Hi @statscol , you can specify the metric arguments when setting up the model. You will need to use the PyTools.sklearn_Setup_Adv function which allows for additional inputs. You can input empty string, i.e. '', for unnecessary parameters like DimReductionArgs.

// Set up a temporary table for the model parameters
[MODEL_INIT]:
LOAD
   [Model Name] as Model_Name,
   '' as EstimatorArgs,
   '' as ScalerArgs,
   'average=micro|str' as MetricArgs,
    '' as DimReductionArgs,
   'overwrite=true,cv=5,calculate_importances=true' as ExecutionArgs    
RESIDENT Estimators
WHERE [Model Name] = '$(vModel)';

[Result-Setup]:
LOAD
   model_name,
   result,
   timestamp
EXTENSION PyTools.sklearn_Setup_Adv(MODEL_INIT{Model_Name, EstimatorArgs, ScalerArgs, MetricArgs, DimReductionArgs, ExecutionArgs}); 

The input specifications for the metrics arguments are described here. If you just want to change the average parameter the argument would be average=micro|str or average=macro|str.

Unfortunately, there is a bit of an oversight in the code and you can't pass average=None at the moment as I thought that would always be the default. I will fix this in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants