| |

Natural Language Processing Machine Learning Algorithm Model Python – NLP

In this guide, we take a look at Natural Language Processing, NLP in Python. Natural Language is a very extensive topic and very powerful machine learning algorithm you can build.

This is very useful in many areas of most industries.

Credits to Jose Portilla, creator of Learning Python for Data Analysis and Visualization course   on Udemy

 

 


 

In [7]:

 

In [8]:

 

In [13]:

 

In [15]:

 

In [16]:

 

Out[16]:
labels message
0 ham Go until jurong point, crazy.. Available only …
1 ham Ok lar… Joking wif u oni…
2 spam Free entry in 2 a wkly comp to win FA Cup fina…
3 ham U dun say so early hor… U c already then say…
4 ham Nah I don’t think he goes to usf, he lives aro…
In [17]:

 

Out[17]:
labels message
count 5572 5572
unique 2 5169
top ham Sorry, I’ll call later
freq 4825 30
In [18]:

 

In [19]:

 

Out[19]:
message
labels
ham count 4825
unique 4516
top Sorry, I’ll call later
freq 30
spam count 747
unique 653
top Please call our customer service representativ…
freq 4
In [20]:

 

In [21]:

 

Out[21]:
labels message length
0 ham Go until jurong point, crazy.. Available only … 111
1 ham Ok lar… Joking wif u oni… 29
2 spam Free entry in 2 a wkly comp to win FA Cup fina… 155
3 ham U dun say so early hor… U c already then say… 49
4 ham Nah I don’t think he goes to usf, he lives aro… 61
In [46]:

 

In [47]:

 

Out[47]:
In [48]:

 

Out[48]:
In [57]:

 

Out[57]:
In [63]:

 

Out[63]:
In [64]:

 

In [65]:

 

Out[65]:
In [67]:

 

Out[67]:
In [68]:

 

Out[68]:
In [72]:

 

Out[72]:
In [73]:

 

Out[73]:
In [76]:

 

Out[76]:
In [92]:

 

In [93]:

 

Out[93]:
labels message length
0 ham Go until jurong point, crazy.. Available only … 111
1 ham Ok lar… Joking wif u oni… 29
2 spam Free entry in 2 a wkly comp to win FA Cup fina… 155
3 ham U dun say so early hor… U c already then say… 49
4 ham Nah I don’t think he goes to usf, he lives aro… 61
In [94]:

 

Out[94]:
In [95]:

 

In [96]:

 

In [97]:

 

Out[97]:
In [98]:

 

Out[98]:
In [99]:

 

In [111]:

 

In [114]:

 

In [118]:

 

In [119]:
In [120]:

 

In [122]:

 

In [123]:

 

In [124]:

 

In [128]:

 

In [132]:

 

In [133]:

 

In [136]:

 

In [138]:
In [139]:

 

In [141]:

 

In [142]:

 

In [143]:

 

Out[143]:
In [144]:

 

In [145]:

 

From the predicitons we had 98% precision and 97% recall and the f1-score is 97%. We seek to improve it more. 🙂

 

Want more information like this?

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *