Posted on Leave a comment

African? Trust Artificial Intelligence at your own risk!

I came across an interesting article on TechCrunch (see last picture below) that I had to share with you. It’s about artificial intelligence and social justice. You might wonder what these 2 have in common. Take a look at the picture below which I took at a conference in 2016. Notice how the algorithm captures 2 faces around me including an invisible face next to my left shoulder BUT IT DOES NOT SEE MY FACE. That day, I did quite a few moves including putting my head right next to my friends heads, but it did not work. The poor demonstrator at the stand just resolved to say “go talk to the Python people. We are only using their code.”

Why make such a big deal of facial recognition anyway?

As you have probably heard, artificial intelligence is getting into everything including our phones, TVs, cars, planes, factories, etc. What this means is that a car that normally recognizes pedestrians might have a harder time recognizing me because I am black and it may result in me being hit. A firefighting robot designed to save people from fire may save all my white friends but leave me to burn because it could not recognize me. While these examples might seem extreme, note that Tesla cars already incorporate autopilots based on this technology.

So why is it so hard to recognize black people?

To understand this, you have to understand the basic principle behind how artificial intelligence works. Essentially, AI is a program that’s written to learn from its environment and use that information to make inference. For example, AI code that is “trained” with a majority of white faces will have a hard time detecting black people faces. The same goes for everything else. For this reason, the data foundation being built as the foundation for tomorrow’s world where planes, cars and other things operate autonomously is being created with less representation from the black community.

What can we do about it?

Get involved. Learn about machine learning and AI then start building your own models bases on our realities in Africa. Let’s not be caught sleeping again. Let’s wake up now and create our own path with this next revolution. Most of the learning is free and accessible. If you have not done anything in this area, start with our free Python course at TekZone Academy: http://tek.zone/academy/.

Images from https://techcrunch.com/2020/09/21/twitter-and-zoom-algorithmic-bias-issues/

Posted on Leave a comment

Analyze text sentiment with Python in 5 lines

It’s no secret that machines can now detect and measure and study our emotions from parsing text. One of ways this is achieved is through sentiment analysis. Just ask Siri, Google or Alexa. Here is how Wikipedia defines sentiment analysis: “Sentiment analysis (also known as opinion mining or emotion AI) refers to the use of natural language processingtext analysiscomputational linguistics, and biometrics to systematically identify, extract, quantify, and study affective states and subjective information. Sentiment analysis is widely applied to voice of the customer materials such as reviews and survey responses, online and social media, and healthcare materials for applications that range from marketing to customer service to clinical medicine.” – https://en.wikipedia.org/wiki/Sentiment_analysis

With the surge of social media platform, sentiment analysis has really gained in popularity with businesses. Imagine for example being able to comb through comments on a product page, a Facebook page or a YouTube video and understanding if the comments are positive, neutral or negative. Imagine being able to identify within the comments which aspects people view as positive or negative. Equipped with this information, businesses can make improvement. Pre-Natural Text Analysis with machine learning, this would have hours of reading and categorizing by people. Now, a computer program can quickly comb through the text and within a few minutes, output the result. That’s the true power behind sentiment analysis.

How does Python do sentiment analysis?

We have released a series of Python courses to help young people pick up this much needed skill. If you have completed our Python 101, that’s enough skill to do what we are about to show you here. Don’t be intimidated. But first, let’s understand how sentiment analysis works.

For this code, we will use the TextBlob Python module. You can learn about this module here: https://textblob.readthedocs.io/en/dev/index.html. This module has abstracted a lot of the hard work so you can do sentiment analysis with just a couple lines of code. For sentiment, this module outputs 2 values:

  1. Polarity: this is a number between -1.0 and 1.0 which indicates on a scale whether the text expresses a negative sentiment (negative number) or a positive sentiment (positive number). The closer the number is to -1.0 or 1.0, the more negative or positive the text is respectively.
  2. Subjectivity: this is a number between 0.0 and 1.0 where 0.0 is very objective (facts) and 1.0 is very subjective (opinion)

Write your first sentiment analysis in Python

Your ready? Here is the code:

from textblob import TextBlob
text = "I have been taking some Python courses at TekZone Academy and I really like it"
blob = TextBlob(text)
print(blob.sentiment)

#output should give you something like: "Sentiment(polarity=0.2, subjectivity=0.2)"

If you get some errors, just make sure the textblob module is installed. You can easily do this by typing the command “pip3 install textblob” or “pip install textblob.” That’s it. You can play around with various text and see how the output changes. You can explore more functionality of the TextBlob by reading the page provided above.

Now you can start analysis emails and text from your friends. In a future post, we will look at how to use another nice plugin to automatically grab text from web pages. Those two modules combined can be quite powerful.

I’ll leave you with this article where you can find a bit more about applications of sentiment analysis: https://medium.com/manishmshiva/a-complete-guide-to-sentiment-analysis-and-its-applications-72adb3b057f5

Posted on Leave a comment

Getting Started with Artificial Intelligence – Resources

Courses

The Machine Learning course offered by Standford through Coursera is a great way to start. It provides details behind the Machine Learning concepts and provide everything needed to practice it. The course goes through the math behind AI and ML. You can access it for Free here: https://www.coursera.org/learn/machine-learning . Millions of people already have.

Another very interesting course for a newby is Udemy’s Pyton for Data Science and Machine Learning Bootcamp. This course does 2 things: teach you Python and how to apply the language to Machine Learning concepts. This course is not free, but it’s well worth the $10 I paid for it. You can access it here: https://www.udemy.com/course/python-for-data-science-and-machine-learning-bootcamp/

Podcasts

The Machine Learning Guide podcast is a great one for a newbie. While it covers some of the technical details of ML, the main objective of this podcast is to cover the forest that is ML. It covers they why behind each concept including when it should be used and why. You can access it for free a the following link or on your favorite podcast app. http://ocdevel.com/mlg

The Emerj AI in Industry podcast helps connect typical industry challenges with corresponding AI fields. I recommend it whether you’re starting or are deep into your AI journey. https://emerj.com/

Books

The book Machines of Loving Grace presents a very good history of AI from the early 1900s to the recent boom in this field. It helps understand current trends. I highly recommend it.