Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Problem with Quanteda Classifiers #31

Open
pmacclay opened this issue Mar 13, 2023 · 1 comment
Open

Problem with Quanteda Classifiers #31

pmacclay opened this issue Mar 13, 2023 · 1 comment

Comments

@pmacclay
Copy link

I am having a problem when running a Convolutional Neural Network using Quanteda Classifiers. I try to replicate the analysis from the vignette, and I get the following result after running pred <- predict(tmod, newdata = newdata):

Error: AttributeError: 'Sequential' object has no attribute 'predict_classes'
In addition: Warning message:
In predict_classes(object$clefitted, x = data$matrix) :
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")

However, when I try to use model %>% predict(x) %>% k_argmax() or model %>% predict(x) %>% >(0.5) %>% k_cast("int32") I get the same result.

I know this is related to the version of TensorFlow, but I don't know how to fix it to get the code running.

@kbenoit kbenoit transferred this issue from quanteda/quanteda Mar 30, 2023
@yeokcmark
Copy link

I have the same problem. Did you manage to find a way around it?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants