Skip to content

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

Open
@Zhuoli

Description

@Zhuoli

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions