How to make a prediction through text.

93 views
Skip to first unread message

Breno Brito Cruz

unread,
Jan 14, 2021, 12:09:59 PM1/14/21
to TensorFlow.js Discussion
Hi, Good Afternoon!

I am learning to use TensorFlow.js for machine learning, and I have doubts about one thing.

first, the initial idea is to read a machine learning model already trained, and implement it in a chrome extension.

I will need to receive a text for after I check if it is spam or not, how could I do this?
 
I'm having trouble finding similar examples in tfjs, and I'm currently studying model.predict (), but it seems it only receive tensors as a parameter, and I'm not sure how I could get a result of a prediction with a text.

Jason Mayes

unread,
Jan 14, 2021, 2:08:07 PM1/14/21
to Breno Brito Cruz, TensorFlow.js Discussion
What machine learning model are you trying to use? Please link.

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/1aea5e62-f4a5-4d23-a284-540f97244a05n%40tensorflow.org.


--




     
  •  Jason Mayes
  •  Senior Developer Advocate, TensorFlow.js
  •  Google
     Follow me or get inspired with #MadeWithTFJS demos

   

This email may be confidential and privileged. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.


Mark Strefford

unread,
Jan 15, 2021, 5:04:31 AM1/15/21
to TensorFlow.js Discussion, Jason Mayes, TensorFlow.js Discussion, brenob...@gmail.com

Are you sending a text with the output of the prediction? If so, then you can use any number of SMS or notification services for that. You would take the output of your predict(), which would be a tensor, and convert it to an array using <predict_tensor>.data() or <predict_tensor>.dataSync() where <predict_tensor> is the name of the tensor you get from predict(). The array will have the predictions from your model, and you can then decide what to do with it, for example if the value is <0.5 you could say it's not spam or >=0.5 could be spam. You would then send an appropriate message to the API of the SMS/notification service.
Reply all
Reply to author
Forward
0 new messages