ValueError: continuous is not supported

后端 未结 1 1054
迷失自我
迷失自我 2021-01-16 11:02

I am using GridSearchCV for cross validation of a linear regression (not a classifier nor a logistic regression).

I also use StandardScaler for normalization of X

相关标签:
1条回答
  • 2021-01-16 11:27

    Your error continuous is not supported tells me you're trying to do "something" from regression domain on classification domain.

    At least 1 thing captures my eye as your target is regression:

     scores = ['precision', 'recall']
    

    To start with, both have nothing to do with regression (as @zero323 pointed out in a comment to your question): they are accuracy measures for classification. Try any regression scores that suit your tastes from this sklearn docs page, section "3.3.1.1. Common cases: predefined values"

    As far as the rest of the code is concerned, I would strongly encourage you to rewrite your code from scratch: chunk for Lasso, chunk for Ridge, chunk for ElasticNet and chunk for SVM (why would you run Ridge and Lasso separately from ElasticNet as they are special cases of ElasticNet???). This will take you no more than 10-15 lines of code. Only after you made it sure all of them execute, optimal hyperparameters are found, and desirable regression metrics are calculated I would attempt optimizing the code and putting everything together in a loop.

    PS:

    how are these loops supposed to run:

    for score in scores:
      for model in MODELS.keys():
    

    prior to defining MODELS?

    0 讨论(0)
提交回复
热议问题