SMS Text Classifier predict_message function

So I recently completed the Health Cost challenge, now I’m doing the spam classifier. I’ve built a very accurate model. My only problem is I don’t know how to make the predict_message function, that takes a string input, and returns a value(how likely it is to be spam) and a label(‘spam’ or ‘ham’)

any help?

Challenge: Neural Network SMS Text Classifier

Link to the challenge:

The model has a predict() method that takes a message (in a numpy array I believe) and returns its score (in another numpy array I believe). Just take the score and decide when to return ham or spam.

So as I was writing the response to this, I realized that after my if/else statement to determine the point i decide if its ham or spam, I set my prediction variable INSIDE my else statement. Which was giving me a very puzzling “referenced before call” error. Appreciate the responses as always :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.