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]: ADSTunner example is broken (due to dependencies) #957

Open
4 tasks done
Zhuoli opened this issue Sep 30, 2024 · 2 comments
Open
4 tasks done

[Bug]: ADSTunner example is broken (due to dependencies) #957

Zhuoli opened this issue Sep 30, 2024 · 2 comments

Comments

@Zhuoli
Copy link

Zhuoli commented Sep 30, 2024

Oracle-ads version used

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of oracle-ads.

  • I have confirmed this bug exists on the main branch of oracle-ads.

  • I agree to follow Code of Conduct.

Description

The example of ADSTuner is broken [here] I ran in multiple issues complaining dependenct methods no longer available even after downgrading sklearn matplot.

Python 3.10.12

How to Reproduce

#https://accelerated-data-science.readthedocs.io/en/latest/user_guide/model_training/ads_tuner.html
! pip install category_encoders 
! pip install lightgbm
! pip install pytest
! pip install scikit-learn==1.1.3
! pip install xgboost
! python3 -m pip install "oracle-ads[opctl]"
! pip install matplotlib==3.6.2

import category_encoders as ce
import lightgbm
import logging
import numpy as np
import os
import pandas as pd
import pytest
import sklearn
import xgboost

from ads.hpo.stopping_criterion import *
from ads.hpo.distributions import *
from ads.hpo.search_cv import ADSTuner

from lightgbm import LGBMClassifier
from sklearn import preprocessing
from sklearn.compose import ColumnTransformer
from sklearn.datasets import load_iris, load_boston
from sklearn.decomposition import PCA
from sklearn.ensemble import AdaBoostRegressor, AdaBoostClassifier
from sklearn.impute import SimpleImputer
from sklearn.linear_model import SGDClassifier, LogisticRegression
from sklearn.metrics import make_scorer, f1_score
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.feature_selection import SelectKBest, f_classif
from xgboost import XGBClassifier
! python -m pip show matplotlib
! python3 -m pip install "oracle-ads[optuna]"
model = SGDClassifier() ##Initialize the model
X, y = load_iris(return_X_y=True)
X_train, X_valid, y_train, y_valid = train_test_split(X, y)
tuner = ADSTuner(model, cv=3) ## cv is cross validation splits
tuner.search_space() ##This is the default search space
tuner.tune(X_train, y_train, exit_criterion=[NTrials(10)])

What was Observed

ERROR - Exception
Traceback (most recent call last):
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_3001602/1993493913.py", line 4, in
tuner = ADSTuner(model, cv=3) ## cv is cross validation splits
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/ads/common/decorator/runtime_dependency.py", line 174, in wrapper
return func(*args, **kwargs)
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/ads/hpo/search_cv.py", line 382, in init
self._study = optuna.study.create_study(
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/optuna/study/study.py", line 1136, in create_study
storage = storages.get_storage(storage)
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/optuna/storages/init.py", line 31, in get_storage
return _CachedStorage(RDBStorage(storage))
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/optuna/storages/_rdb/storage.py", line 187, in init
self._version_manager.check_table_schema_compatibility()
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/optuna/storages/_rdb/storage.py", line 1310, in check_table_schema_compatibility
current_version = self.get_current_version()
File "/home/zhuoli/Projects/github/zhuoli/automlx/.env/lib/python3.10/site-packages/optuna/storages/_rdb/storage.py", line 1337, in get_current_version
assert version is not None
AssertionError
AssertionError:

What was Expected

No error expected

Version

2.11.19

@qiuosier
Copy link
Member

There is breaking change on SQLAlchemy causing the issue. The workaround is to install order version:

pip install "SQLAlchemy<2"

@Zhuoli
Copy link
Author

Zhuoli commented Oct 2, 2024

There is breaking change on SQLAlchemy causing the issue. The workaround is to install order version:

pip install "SQLAlchemy<2"

Good now, thanks for your quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants