hyperas icon indicating copy to clipboard operation
hyperas copied to clipboard

The TypeError: object of type 'NoneType' has no len()

Open geeeekDing opened this issue 6 years ago • 6 comments

When I used the hyperas to adjust the paraments of ANN, It returns the" TypeError: object of type 'NoneType' has no len()", I don't know the cause of this problem. The train data and test data can be used in kreas.

......... Hyperas search space:

def get_space(): return { 'Dense': hp.choice('Dense', [40, 80, 150]), 'Dense_1': hp.choice('Dense_1', [40, 80, 150]), 'Dense_2': hp.choice('Dense_2', [40, 80, 150]), 'Dense_3': hp.choice('Dense_3', [40, 80, 150]), 'Dense_4': hp.choice('Dense_4', [40, 80, 150]), 'Dense_5': hp.choice('Dense_5', [40, 80, 150]), 'Dense_6': hp.choice('Dense_6', [40, 80, 150]), 'epochs': hp.choice('epochs', [25, 50, 75, 100]), 'batch_size': hp.choice('batch_size', [100, 300, 500 ,700]), }

Traceback (most recent call last):

File "", line 1, in runfile('F:/Project/machine learning assistes detecing coherence/data/datahighfideCl1/demo/Superadjustpara.py', wdir='F:/Project/machine learning assistes detecing coherence/data/datahighfideCl1/demo')

File "C:\Users\Ding\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile execfile(filename, namespace)

File "C:\Users\Ding\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "F:/Project/machine learning assistes detecing coherence/data/datahighfideCl1/demo/Superadjustpara.py", line 70, in trials=Trials())

File "C:\Users\Ding\Anaconda3\lib\site-packages\hyperas\optim.py", line 69, in minimize keep_temp=keep_temp)

File "C:\Users\Ding\Anaconda3\lib\site-packages\hyperas\optim.py", line 98, in base_minimizer model_str = get_hyperopt_model_string(model, data, functions, notebook_name, verbose, stack)

File "C:\Users\Ding\Anaconda3\lib\site-packages\hyperas\optim.py", line 215, in get_hyperopt_model_string data_string = retrieve_data_string(data, verbose)

File "C:\Users\Ding\Anaconda3\lib\site-packages\hyperas\optim.py", line 175, in retrieve_data_string indent_length = len(determine_indent(data_string))

TypeError: object of type 'NoneType' has no len()

geeeekDing avatar May 16 '19 09:05 geeeekDing

Thank you

geeeekDing avatar May 16 '19 09:05 geeeekDing

Hello everyone, when I run a program that can be executed successfully, I found that :len(determine_indent(data_string))=4, the type of "determine_indent(data_string)" is "str",and I run my program ,it returns error,and the type of "determine_indent(data_string)" is NoneType

geeeekDing avatar May 16 '19 11:05 geeeekDing

I made a change that I set len(determine_indent(data_string)) =4, because of my the length of the indent of function "data()" is 4, My program is already running, but where is the original question of its

geeeekDing avatar May 16 '19 11:05 geeeekDing

Hi did you solve this error ?

sarmadm avatar Jul 23 '19 20:07 sarmadm

Hi did you solve this error ?

Yes, I already solved it, please see the last comment.

geeeekDing avatar Aug 06 '19 08:08 geeeekDing

https://github.com/maxpumperla/hyperas/issues/57#issuecomment-571884491

ileadall42 avatar Jan 08 '20 04:01 ileadall42