New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
predict_classes in score_model.py results in AttributeError #64
Comments
@bml1g12 Yeah you'll get this error right now if you're not using the |
I was trying to use talos with a Keras Functional Model too but surprisingly Keras didn't implemented the predict_classes function on them. So I come up with a quick fix using However it seems that it didn't work for everybody, resulting in weird arrays full of zeros. I finally looked up the code of predict_classes in the Keras repo and it kind of uses Therefore I'm waiting for suggestions. |
This is related with #39 and #42. My suggestion is that we add an option for those that want to use the above under a parameter experimental_functional_support=True for Scan() which simply uses the above instead of the one that is being used otherwise. We need to keep in mind it's not tested (as in #42 it becomes apparent how this might not work for all cases). @x94carbone @ackRow what do you think about this approach? |
I think this is ok. Sort of a use-at-your-own-risk kind of option. It weird because I see all over the internet people recommending this fix, but it seems for certain kinds of data input it totally breaks everything. It is kinda crazy that Keras hasn't addressed this issue by now if you ask me. |
|
I think it's a good idea too. I can try to code that and add an error message when using a Functional Model advising you to use the experimental feature. @bml1g12 |
@ackRow that's great, thanks so much. At the moment there are 4 live issues related with this, so it seems like high value target :) |
This is now fixed in the current dev branch. |
[ x] I'm up-to-date with the latest release:
[x ] I've confirmed that my Keras model works outside of Talos.
When I run
h = ta.Scan(X_train, Y_train, params=p, dataset_name="debug", experiment_no="1", model=keras_nn_model_talos, grid_downsample=0.002, talos_log_name="talos.log", reduction_method="spear", reduction_metric="val_fbeta_score_acc")
I get the following error:
Which can seemingly be fixed simply by changing
talos/metrics/score_model.py line 17
from
y_pred = self.keras_model.predict_classes(self.x_val)
to
y_pred = self.keras_model.predict(self.x_val)
My params dictionary and model:
X_train.shape, Y_train.shape, X_dev.shape, Y_dev.shape
((1800, 201, 41), (1800, 47, 1), (400, 201, 41), (400, 47, 1))
The text was updated successfully, but these errors were encountered: