Skip to content
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

Update keras code #596

Closed
topepo opened this issue Nov 10, 2021 · 6 comments · Fixed by #639
Closed

Update keras code #596

topepo opened this issue Nov 10, 2021 · 6 comments · Fixed by #639
Labels
next release 🚀 upkeep maintenance, infrastructure, and similar

Comments

@topepo
Copy link
Member

topepo commented Nov 10, 2021

We are getting these warnings:

── Warning (test_logistic_reg_keras.R:186:3): classification probabilities ─────
`predict_proba()` is deprecated and was removed from tensorflow in version 2.6, please use `predict()` instead
Backtrace:
 1. stats::predict(plrfit, te_dat[, -1], type = "prob") test_logistic_reg_keras.R:186:2
 6. keras::predict_proba(object = object$fit, x = as.matrix(new_data))

-- Warning (test_multinom_reg_keras.R:124:3): classification prediction --------
`predict_classes()` is deprecated and and was removed from tensorflow in version 2.6.
Please update your code:
  * If your model does multi-class classification:
    (e.g. if it uses a `softmax` last-layer activation).

      model %>% predict(x) %>% k_argmax()

  * if your model does binary classification
    (e.g. if it uses a `sigmoid` last-layer activation).

      model %>% predict(x) %>% `>`(0.5) %>% k_cast("int32")
@topepo topepo added the upkeep maintenance, infrastructure, and similar label Nov 10, 2021
@juliasilge
Copy link
Member

Looks like these are removed in TensorFlow 2.6, as reported in tidymodels/tidymodels#71

@nickryd
Copy link

nickryd commented Jan 2, 2022

Hello, Im wondering if there was any resolution of this issue. Currently Im getting an error when running models with Keras and not just a warning. Looks like this issue is tagged to be resolved with the next release, just curious if you could provide the solution so I could get this running in the meantime. Thanks!

@juliasilge
Copy link
Member

In the meantime @nickryd you would need to install back to an earlier version of Tensorflow (the Python software, not the R package), pre-2.6.

@topepo
Copy link
Member Author

topepo commented Jan 5, 2022

@nickryd I'm working on it this week.

@siegfried
Copy link

This also breaks tune_grid and tune_bayes. Here is what I grab from .notes.

 [1] "preprocessor 1/4, model 1/2 (predictions): `predict_proba()` is deprecated and was removed from tensorflow in version 2.6, please use `predict()` instead"  
 [2] "preprocessor 1/4, model 1/2 (predictions): Error in py_get_attr_impl(x, name, silent): AttributeError: 'Sequential' object has no attribute 'predict_proba'"

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
next release 🚀 upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants