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

Bug with LinearSVC training #154

Open
prabhant opened this issue Jun 8, 2022 · 2 comments
Open

Bug with LinearSVC training #154

prabhant opened this issue Jun 8, 2022 · 2 comments

Comments

@prabhant
Copy link

prabhant commented Jun 8, 2022

This bug makes sense because LinearSVC does not support probabilities by default I think
reference here: https://stackoverflow.com/questions/47312432/attributeerrorlinearsvc-object-has-no-attribute-predict-proba

Traceback (most recent call last):
  File "/home/singhp/metalearning_experiments/gama/gama-warm-pretraining.py", line 35, in <module>
    probability_predictions = automl.predict_proba(X_test)
  File "/home/singhp/metalearning_experiments/gama/gama/GamaClassifier.py", line 94, in predict_proba
    return self._predict_proba(x)
  File "/home/singhp/metalearning_experiments/gama/gama/GamaClassifier.py", line 75, in _predict_proba
    return self.model.predict_proba(x)  # type: ignore
  File "/home/singhp/miniconda3/envs/imbalance/lib/python3.9/site-packages/sklearn/utils/metaestimators.py", line 114, in __get__
    getattr(delegate, self.attribute_name)
AttributeError: 'LinearSVC' object has no attribute 'predict_proba'

Maybe an IF Condition if GAMA outputs linear SVC can be inserted with extra arguments.

@PGijsbers
Copy link
Member

PGijsbers commented Jun 13, 2022

LinearSVC should have been excluded from the search space if you optimized towards a metric that requires probabilities. Is it the case that you optimized towards a metric that requires only labels (e.g., accuracy) and then call predict_proba? I guess the desired behavior would be to either fall back on the next-best model which supports probabilities or give a better error (probably the former, with a warning).

Maybe an IF Condition if GAMA outputs linear SVC can be inserted with extra arguments.

I am not sure what you mean with that

@PGijsbers
Copy link
Member

Can you confirm this happened when you optimized for a metric which requires predictions rather than probabilities?

@PGijsbers PGijsbers added this to the v22.1 milestone Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants