Index out of range.
See original GitHub issueI am trying to implement this for my predictive neural network but it returns the following error:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-21-66686af6d687> in <module>()
5 max_evals=5,
6 notebook_name='gridsearch',
----> 7 trials=Trials())
8 x_train, y_train, x_val, y_val = data()
9 print("Evalutation of best performing model:")
~/anaconda3/envs/poc/lib/python3.6/site-packages/hyperas/optim.py in minimize(model, data, algo, max_evals, trials, functions, rseed, notebook_name, verbose, eval_space, return_space)
65 full_model_string=None,
66 notebook_name=notebook_name,
---> 67 verbose=verbose)
68
69 best_model = None
~/anaconda3/envs/poc/lib/python3.6/site-packages/hyperas/optim.py in base_minimizer(model, data, functions, algo, max_evals, trials, rseed, full_model_string, notebook_name, verbose, stack)
94 model_str = full_model_string
95 else:
---> 96 model_str = get_hyperopt_model_string(model, data, functions, notebook_name, verbose, stack)
97 temp_file = './temp_model.py'
98 write_temp_files(model_str, temp_file)
~/anaconda3/envs/poc/lib/python3.6/site-packages/hyperas/optim.py in get_hyperopt_model_string(model, data, functions, notebook_name, verbose, stack)
182 imports = extract_imports(cleaned_source, verbose)
183
--> 184 parts = hyperparameter_names(model_string)
185 aug_parts = augmented_names(parts)
186
~/anaconda3/envs/poc/lib/python3.6/site-packages/hyperas/optim.py in hyperparameter_names(model_string)
249 parts.append(name[0])
250 else:
--> 251 parts.append(parts[-1])
252 part_dict = {}
253 for i, part in enumerate(parts):
IndexError: list index out of range
The code used can be found: <script src="https://gist.github.com/GijsVermarien/105a15bc47ff970af5679f4e73d030ee.js"></script>
Id be glad to provide more information if needed.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >Python IndexError: List Index Out of Range Error Explained
We can break down the text a little bit. We can see here that the message tells us that the index is out...
Read more >Python IndexError: List Index Out of Range [Easy Fix]
The error “list index out of range” arises if you access invalid indices in your Python list. For example, if you try to...
Read more >What is an "index out of range" exception, and how do I fix it?
Why does this error occur? ... Because you tried to access an element in a collection, using a numeric index that exceeds the...
Read more >What does the error 'list index out of range' mean?
Generally, list index out of range means means that you are providing an index for which a list element does not exist. Now,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have eliminated all the parameters and dumbed it down to just varying the layer size, depth, learning rate and early stopping. Yet it still doesn’t seem to work. See the code attached in this gist: https://gist.github.com/GijsVermarien/c544ab23b9aaffad13c7f4283cff3e8d The error given is still:
My fix for this error was to simply move my parameters into an assigned variable. So replace code like this:
With this: