Skip to content

Cannot import VWClassifier (sklearn compatability) #4715

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

Open
fantauzzi opened this issue May 2, 2025 · 0 comments
Open

Cannot import VWClassifier (sklearn compatability) #4715

fantauzzi opened this issue May 2, 2025 · 0 comments
Labels
Bug Bug in learning semantics, critical by default

Comments

@fantauzzi
Copy link

Describe the bug

Trying to import the VWClassifier from vowpalwabbit.sklearn raises an ImportError cannot import name 'log_logistic' from 'sklearn.utils.extmath'

How to reproduce

Copy the example usage from the documentation and run it: https://vowpalwabbit.org/docs/vowpal_wabbit/python/latest/reference/vowpalwabbit.sklearn.html#

By running it, I get this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[2], line 4
      2 from sklearn import datasets
      3 from sklearn.model_selection import train_test_split
----> 4 from vowpalwabbit.sklearn import VWClassifier
      5     # generate some data
      6 X, y = datasets.make_hastie_10_2(n_samples=10000, random_state=1)

File ~/.pyenv/versions/default3.10/lib/python3.10/site-packages/vowpalwabbit/sklearn.py:16
     14 from sklearn.exceptions import NotFittedError
     15 from sklearn.base import BaseEstimator, RegressorMixin
---> 16 from sklearn.utils.extmath import log_logistic
     17 from sklearn.linear_model import LogisticRegression
     18 from sklearn.datasets import dump_svmlight_file

ImportError: cannot import name 'log_logistic' from 'sklearn.utils.extmath' (/home/fanta/.pyenv/versions/default3.10/lib/python3.10/site-packages/sklearn/utils/extmath.py)

One can see, from the scikit-learn documentation, that a module log_logistic does not in fact exist in sklearn.utils.extmath.

Version

9.10.0

OS

Ubuntu 24.0.4.2

Language

Python 3.10.4

Additional context

Package vowpalwabbit 9.10.0 installed with pip.

Here the list of all Python the packages currently installed

⮕ pip list
Package                            Version
---------------------------------- --------------
alembic                            1.15.2
annotated-types                    0.7.0
antlr4-python3-runtime             4.9.3
anyio                              4.9.0
argon2-cffi                        23.1.0
argon2-cffi-bindings               21.2.0
arrow                              1.3.0
asttokens                          3.0.0
async-lru                          2.0.5
attrs                              25.3.0
babel                              2.17.0
beautifulsoup4                     4.13.4
bleach                             6.2.0
blinker                            1.9.0
cachetools                         5.5.2
certifi                            2025.4.26
cffi                               1.17.1
charset-normalizer                 3.4.2
click                              8.1.8
cloudpickle                        3.1.1
colorlog                           6.9.0
comm                               0.2.2
contourpy                          1.3.2
cryptography                       44.0.2
cycler                             0.12.1
databricks-sdk                     0.52.0
debugpy                            1.8.14
decorator                          5.2.1
defusedxml                         0.7.1
Deprecated                         1.2.18
docker                             7.1.0
exceptiongroup                     1.2.2
executing                          2.2.0
fastapi                            0.115.12
fastjsonschema                     2.21.1
Flask                              3.1.0
fonttools                          4.57.0
fqdn                               1.5.1
ga4mp                              2.0.4
gitdb                              4.0.12
GitPython                          3.1.44
google-auth                        2.39.0
graphene                           3.4.3
graphql-core                       3.2.6
graphql-relay                      3.2.0
greenlet                           3.2.1
gunicorn                           23.0.0
h11                                0.16.0
httpcore                           1.0.9
httpx                              0.28.1
idna                               3.10
importlib_metadata                 8.6.1
ipykernel                          6.29.5
ipython                            8.36.0
isoduration                        20.11.0
itsdangerous                       2.2.0
jedi                               0.19.2
Jinja2                             3.1.6
joblib                             1.4.2
json5                              0.12.0
jsonpointer                        3.0.0
jsonschema                         4.23.0
jsonschema-specifications          2025.4.1
jupyter_client                     8.6.3
jupyter_core                       5.7.2
jupyter-events                     0.12.0
jupyter-lsp                        2.2.5
jupyter_server                     2.15.0
jupyter_server_terminals           0.5.3
jupyterlab                         4.4.1
jupyterlab_pygments                0.3.0
jupyterlab_server                  2.27.3
kiwisolver                         1.4.8
Mako                               1.3.10
Markdown                           3.8
MarkupSafe                         3.0.2
matplotlib                         3.10.1
matplotlib-inline                  0.1.7
mistune                            3.1.3
mlflow                             2.22.0
mlflow-skinny                      2.22.0
nbclient                           0.10.2
nbconvert                          7.16.6
nbformat                           5.10.4
nest-asyncio                       1.6.0
notebook_shim                      0.2.4
numpy                              2.2.5
nvidia-nccl-cu12                   2.26.2.post1
omegaconf                          2.3.0
opentelemetry-api                  1.32.1
opentelemetry-sdk                  1.32.1
opentelemetry-semantic-conventions 0.53b1
optuna                             4.3.0
optunahub                          0.2.0
overrides                          7.7.0
packaging                          24.2
pandas                             2.2.3
pandocfilters                      1.5.1
parso                              0.8.4
pexpect                            4.9.0
pillow                             11.2.1
pip                                25.1
platformdirs                       4.3.7
prometheus_client                  0.21.1
prompt_toolkit                     3.0.51
protobuf                           6.30.2
psutil                             7.0.0
ptyprocess                         0.7.0
pure_eval                          0.2.3
pyarrow                            19.0.1
pyasn1                             0.6.1
pyasn1_modules                     0.4.2
pycparser                          2.22
pydantic                           2.11.4
pydantic_core                      2.33.2
PyGithub                           2.6.1
Pygments                           2.19.1
PyJWT                              2.10.1
PyNaCl                             1.5.0
pyparsing                          3.2.3
python-dateutil                    2.9.0.post0
python-json-logger                 3.3.0
pytz                               2025.2
PyYAML                             6.0.2
pyzmq                              26.4.0
referencing                        0.36.2
requests                           2.32.3
rfc3339-validator                  0.1.4
rfc3986-validator                  0.1.1
rpds-py                            0.24.0
rsa                                4.9.1
scikit-learn                       1.6.1
scipy                              1.15.2
seaborn                            0.13.2
Send2Trash                         1.8.3
setuptools                         65.5.0
six                                1.17.0
smmap                              5.0.2
sniffio                            1.3.1
soupsieve                          2.7
SQLAlchemy                         2.0.40
sqlparse                           0.5.3
stack-data                         0.6.3
starlette                          0.46.2
terminado                          0.18.1
threadpoolctl                      3.6.0
tinycss2                           1.4.0
tomli                              2.2.1
tornado                            6.4.2
tqdm                               4.67.1
traitlets                          5.14.3
types-python-dateutil              2.9.0.20241206
typing_extensions                  4.13.2
typing-inspection                  0.4.0
tzdata                             2025.2
uri-template                       1.3.0
urllib3                            2.4.0
uvicorn                            0.34.2
vowpalwabbit                       9.10.0
wcwidth                            0.2.13
webcolors                          24.11.1
webencodings                       0.5.1
websocket-client                   1.8.0
Werkzeug                           3.1.3
wrapt                              1.17.2
xgboost                            3.0.0
zipp                               3.21.0

@fantauzzi fantauzzi added the Bug Bug in learning semantics, critical by default label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug in learning semantics, critical by default
Projects
None yet
Development

No branches or pull requests

1 participant