Hi Hello im trying to create an email classification model that takes in a user inputted email text or file and tells them whether if its a spam message or not spam message but as I’m testing it I ran into this issue ValueError: dtype=‘numeric’ is not compatible with arrays of bytes/strings.Convert your data to numeric values explicitly instead.
Heres the link to the github repository below:
If anyone can provide any pointers on how to fix this error or what in my code caused this error that will be greatly appreciated
Hi @Zahid . The problem is that you are not converting your text to vector. Since I have seen your jupyter notebook where you have used tfidf for converting the text to vector right. So you need save the preprocessing as preprocessing.pkl before passing the text to model. So the pipeline should be as follows:-
text input
|
Transform Method of TFIDF for converting text to vector
|
Pass the vector to models predict function
thank you for your response it worked, but now my issue when i run the same if statement on my file uploader version to check if the text file is also classified as spam or not it’s producing this error
‘UploadedFile’ object has no attribute ‘lower’
the updated code is in the github repository if you would like to check it out and help me tackle this bug it’ll be greatly appreciative
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.