Open nbucklin opened 7 years ago
@nbucklin hmm, can you maybe provide your full experiment as a gist along with dummy data for me to reproduce this?
Sure thing. Below is the gist link. The code I've provided generates dummy data and compiles it into X and Y training and test sets (X_train, X_test, y_train, y_test). Each of these are float64 3d arrays. For example, X_train is (1511,100,2) for 1511 samples, 100 timesteps, and two features. The model itself is a LSTM regression model that predicts two continuous variables. I am able to reproduce the same error I mentioned above using this code.
Please let me know if you need anything else.
https://gist.github.com/nbucklin/912505e7c4eca355472dcf53647e402f
Hey, I've been receiving the same exact error. I attached my output in the gist below. Could it be the format of the data that is being passed it? It seems like it wants an ndarray, but is is something else?
https://gist.github.com/sdzharkov/069453c9092a8eae76551ecb6dbe67e8
Got same error. Any tips or workarounds so far?
Have the same error as well... Just tagging-in in the hopes we find an answer...
The error is being thrown in the getfile() def in the inspect.py file.
def getfile(object):
"""Work out which source or compiled file an object was defined in."""
if ismodule(object):
if hasattr(object, '__file__'):
return object.__file__
raise TypeError('{!r} is a built-in module'.format(object))
if isclass(object):
if hasattr(object, '__module__'):
object = sys.modules.get(object.__module__)
if hasattr(object, '__file__'):
return object.__file__
raise TypeError('{!r} is a built-in class'.format(object))
if ismethod(object):
object = object.__func__
if isfunction(object):
object = object.__code__
if istraceback(object):
object = object.tb_frame
if isframe(object):
object = object.f_code
if iscode(object):
return object.co_filename
raise TypeError('{!r} is not a module, class, method, '
'function, traceback, frame, or code object'.format(object))
Hello all - I've figured out the issue here; at least from my standpoint...
I thought the wrapper was a bit more flexible in terms of its parameter inputs when you call optim.minimize. It's not flexible. I believe the majority of you are likely either trying to pass in your X_train, y_train, X_test, y_test, and/or the model directly. Simply put, you can't use this wrapper in this fashion. You must pass in a "module, class, method, function, traceback, frame, or code object", no exceptions.
So, when Max suggests using the following code:
best_run, best_model = optim.minimize(model = create_model,
data = data,
algo = tpe.suggest,
max_evals = 5,
trials = Trials(),
notebook_name = None)
You literally need to pass in the parameters as such. You must make a data() function that returns the four data series and you must make a self-contained function that creates and returns the model i.e. create_model().
I suppose this is written explicitly in the instructions/setup and the error thrown also suggests this is the case as well... I'm a little ashamed that I didn't read it thoroughly enough. This feels like a Zoolander moment ("the files are in the computer"). lol!
Thank you Max and team for putting hyperas together. It's much less frustrating once you read the instructions... ;)
@loewenm thanks for your time and efforts, nothing to be ashamed for. A lot of people seem to struggle with this, indicating that I did a poor job documenting the project.
If any of you have ideas how to make clear how exactly to use this project (wiki, more examples, more concise readme etc.), please let me know. Also, feel free to send PRs for that matter. For various reasons I have close to 0 time to do such rather non-critical tasks, which I hope is understandable.
Thanks!
@loewenm Corrct Dude !! I think this hyperas documentation needs some more explaination on how to pass arguments !!
Is there any way to have a parameterised data
function?
Edit fixed this in #254
Hey, guys! I'm having the same problem... I'm running my code on a Jupyter Notebook. Is that a problem? Here's the error:
TypeError Traceback (most recent call last)
Hi @maxpumperla, thanks for all your help with this. I'm having an issue with using a 3d array for my X values. My training X values are in an array as float64 with the dimensions (926, 100, 1). These values are feed into a LSTM model. The 3d array is to fulfill the Keras format of n=926, timesteps=100, features=1. My model works when I do not use it with Hyperas. When I try to run it with Hyperas, I get this error:
Below is my model for reference:
Any ideas? Thanks!