blobcity / autoai

Python based framework for Automatic AI for Regression and Classification over numerical data. Performs model search, hyper-parameter tuning, and high-quality Jupyter Notebook code generation.
Apache License 2.0
175 stars 43 forks source link

AttributeError: module 'blobcity.main.modelSelection' has no attribute 'getKFold' #242

Open NicolasMICAUX opened 2 years ago

NicolasMICAUX commented 2 years ago

I have really simple code model = bc.train(df=df, target='score', features=['brand', 'category', 'source']) Fails with following error

[/usr/local/lib/python3.7/dist-packages/blobcity/main/driver.py](https://localhost:8080/#) in train(file, df, target, features, model_types, accuracy_criteria, disable_colinearity, epochs, max_neural_search)
     76 
     77     accuracy_criteria= accuracy_criteria if accuracy_criteria<=1.0 else (accuracy_criteria/100)
---> 78     modelClass = model_search(dataframe=CleanedDF,target=target,DictClass=dict_class,disable_colinearity=disable_colinearity,model_types=model_types,accuracy_criteria=accuracy_criteria,epochs=epochs,max_neural_search=max_neural_search)
     79     modelClass.yamldata=dict_class.getdict()
     80     modelClass.feature_importance_=dict_class.feature_importance if(features==None) else calculate_feature_importance(CleanedDF.drop(target,axis=1),CleanedDF[target],dict_class)

[/usr/local/lib/python3.7/dist-packages/blobcity/main/modelSelection.py](https://localhost:8080/#) in model_search(dataframe, target, DictClass, disable_colinearity, model_types, accuracy_criteria, epochs, max_neural_search)
    289 
    290     elif model_types=='all':
--> 291         modelResult=classic_model(ptype,dataframe,target,X,Y,DictClass,modelsList,accuracy_criteria,4)
    292         if modelResult[2]<accuracy_criteria:
    293             gpu_num=tf.config.list_physical_devices('GPU')

[/usr/local/lib/python3.7/dist-packages/blobcity/main/modelSelection.py](https://localhost:8080/#) in classic_model(ptype, dataframe, target, X, Y, DictClass, modelsList, accuracy_criteria, stages)
    206         print("Quick Search(Stage 1 of {}) is skipped".format(stages))
    207         best=train_on_full_data(X,Y,modelsList,modelsList,DictClass,stages)
--> 208     modelResult = Tuner.tune_model(dataframe,target,best,modelsList,ptype,accuracy_criteria,DictClass,stages)
    209     return modelResult
    210 

[/usr/local/lib/python3.7/dist-packages/blobcity/config/tuner.py](https://localhost:8080/#) in tune_model(dataframe, target, modelkey, modelList, ptype, accuracy, DictionaryClass, stages)
    203     prog=Progress()
    204     X,Y=dataframe.drop(target,axis=1),dataframe[target]
--> 205     cv=modelSelection.getKFold(X)
    206     get_param_list(modelkey,modelList)
    207     EarlyStopper.criterion=accuracy

AttributeError: module 'blobcity.main.modelSelection' has no attribute 'getKFold'

I use Google Colab, python3.7.13, latest version of all libs installed with :

!pip install git+https://github.com/keras-team/keras-tuner.git
!pip install autokeras
!pip install blobcity

My df consists of 3 categorical features (source, brand, category) used to predict float score

NicolasMICAUX commented 2 years ago

On my personal CPU, with python3.10 and same libs config, it does not fail at this step.

Thilakraj1998 commented 2 years ago

@NicolasMICAUX we tried to reproduce the issue on Colab for multiple similar datasets but didn't encounter the same issue.

for the installation procedure on colab, we did only

!pip install autokeras
!pip install blobcity

can you try only installing these two dependencies?

if the issue still exists, if possible do share your Colab notebook over here.