| |

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

  • Superset Caravel BI Tool Installation and Visualizations on Heroku

    Superset (formerly called Caravel ) BI Tool by  http://airbnb.io/superset  is a free Data Visualization tool which you can harness its powers for your visualization analytic needs. If you are finding problems installing on your windows PC or you simply want your own online version you can simply sign up FREE with Heroku (at least choosing…

  • |

    Mean Squared Error – Simple Definition, Explanation and Illustration

    Having started my journey in Data Science. I came across Mean Squared Error several times and realised how important that concept is. Then I started working on project and needed to really understand what Mean Squared Error is ? So what is Mean Squared Error ? Simply,  let’s say you are building your model. And…

  • |

    Choosing a Dataset – Data Management and Visualization

    I have gone through all the codebooks and having finished going through all of them I am particularly interested in the GapMinder dataset. From the GapMinder dataset my focus will be on the Life expectancy of a particular country. I have chosen to focus on the country, Ghana. The Life Expectancy of the people of…

  • |

    Superset Heroku Installation – Microsoft SQL Server Database Connection on Windows PC

     Clone this github repository into YOUR OWN repository and Edit the link in the  Readme.md file from https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/dugjason/superset-on-heroku to the link in YOUR OWN CLONED repository eg. https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/benadaba/hrmr Now scroll down and COMMIT (save) the changes ALSO edit the requirements.txt file and include any database requirements you want installed . eg pymssql==2.1.3, pyodbc==4.0.21 (this version was generating an…

  • Matplotlib Pyplot Plt Python Pandas Data Visualization Plotting

      This is some quick notes about graphing or plotting graphs with Matplotlib in Python. Credits to sentdex.  You can check him out on Youtube.

      In [4]:

      In [10]:

      In [14]:

      In [20]:

      In [23]:

      In [30]:

      Out[30]:

    In [48]:

        Want more information like this?

  • |

    Create Batch Dot Bat File to Run Your Python Script With Windows Scheduler

    After writing your script, you might want to schedule it to run periodically, let’s say, Daily, Weekly or Any Time interval you will decide Before you schedule that you want to  simply create a batch file and schedule it run with a Windows Scheduler. Here are simple steps to do that. First of all, if…

Leave a Reply

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