# 'Sequential' object has no attribute 'predict\_classes'

**URL:** <https://discuss.ai.google.dev/t/sequential-object-has-no-attribute-predict-classes/19265>\
**Category:** General Discussion\
**Tags:** keras, models, help\_request\
**Created:** [June 13, 2022, 2:29am UTC](https://discuss.ai.google.dev/t/sequential-object-has-no-attribute-predict-classes/19265 "2022-06-13T02:29:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Munir](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/munir/32/8866_2.png) [@Munir](https://discuss.ai.google.dev/u/Munir)\
**Post date:** [June 13, 2022, 2:29am UTC](https://discuss.ai.google.dev/t/sequential-object-has-no-attribute-predict-classes/19265/1 "2022-06-13T02:29:49Z")

</div>

Hello All,

I’m trying to run my model but facing "‘Sequential’ object has no attribute ‘predict\_classes’ " I have  
Name: tensorflow Version: 2.9.1 Name: keras Version: 2.9.0. Is deprecated? If not then please help me to resolve it. If yes, then help me alternate. I have searched but no luck.

Thank you.

---

<div class="post-metadata">

**Author:** ![Tina\_Sabri](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/tina_sabri/32/7783_2.png) [@Tina\_Sabri](https://discuss.ai.google.dev/u/Tina_Sabri)\
**Post date:** [June 15, 2022, 5:38am UTC](https://discuss.ai.google.dev/t/sequential-object-has-no-attribute-predict-classes/19265/3 "2022-06-15T05:38:09Z")

</div>

This function were removed in TensorFlow version 2.6. According to the keras in rstudio reference update to.

---

<div class="post-metadata">

**Author:** ![rcauvin](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/rcauvin/32/10360_2.png) [@rcauvin](https://discuss.ai.google.dev/u/rcauvin)\
**Post date:** [June 15, 2022, 1:09pm UTC](https://discuss.ai.google.dev/t/sequential-object-has-no-attribute-predict-classes/19265/5 "2022-06-15T13:09:26Z")

</div>

It appears @Tina_Sabri was going to cite the [Keras RStudio reference](https://keras.rstudio.com/reference/predict_proba.html#details):

> 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")`

The equivalents in Python would be:

**Multi-class Classification**  
`predictions = np.argmax(model.predict(x_test), axis=-1)`

**Binary Classification**  
`predictions = (model.predict(x_test) > 0.5).astype("int32")`

[Additional Source](https://stackoverflow.com/questions/68836551/keras-attributeerror-sequential-object-has-no-attribute-predict-classes)

---

<div class="post-metadata">

**Author:** ![chunduriv](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chunduriv](https://discuss.ai.google.dev/u/chunduriv)\
**Post date:** [October 19, 2022, 3:43pm UTC](https://discuss.ai.google.dev/t/sequential-object-has-no-attribute-predict-classes/19265/7 "2022-10-19T15:43:28Z")

</div>

Updated Keras RStudio Reference - [TensorFlow for R – predict\_proba](https://tensorflow.rstudio.com/reference/keras/predict_proba.html#)
