Latest posts by Jamie Maguire (see all)
- How to Create AI Software? - 11 Aug, 2022
- 5 Ways AI in the automotive industry is making an impact - 11 Aug, 2022
- How to Make a Digital Marketing Dashboard Template? - 10 Aug, 2022
Wondering how to create an AI solution?
AI is set to become one of the leading software development growth markets.
Before we get into what‘s involved in building software that leverages artificial intelligence and data science, let‘s start with a definition of what the term “artificial intelligence” means:
Artificial intelligence (AI) is intelligence exhibited by machines. In computer science, the field of AI research defines itself as the study of “intelligent agents”: any device that perceives its environment and takes actions that maximize its chance of success at some goal.
Colloquially, the term “artificial intelligence” is applied when a machine mimics “cognitive” functions that humans associate with other human brain functions such as “learning” and “problem-solving”.
How to create AI software?
If you‘re thinking of exploring artificial intelligence or machine learning, you need to ask yourself the question:
Do I really need to implement artificial intelligence in my software solution?
This raises another question:
How do you know if you need to create an AI solution!?
Here are some guidelines:
- Do you deal with vast quantities of data?
- Is the data in various formats?
- Are you dealing with frequently changing parameters?
- Is the data arriving at every increasing velocity?
If you have answered yes to most of these points, then you might want to consider integrating artificial intelligence and machine learning into your tech stack.
In order to have a better insight into this topic, check out the pros and cons of artificial intelligence.
An example: Managing Email Spam
Consider our email spam problem from earlier on, remember the problems you‘d encounter by implementing this application using traditional programming techniques? Well, most of this can be alleviated by implementing an AI/ML approach.
Email spam detection is ultimately a text classification problem.
Fortunately, this is a well-studied area and several techniques can be employed by the machine to determine to which Category the new incoming email belongs.
Algorithm and approach
Before we delve into the technicalities of which API to use when you create AI software, it can be helpful to further understand the background of how such a solution can be approached by using Supervised Learning.
If you‘re unfamiliar with this, Supervised Learning is a technique that involves the construction of a “Classifier”. The Classifier neural networks are responsible for categorizing text into a Category (sometimes known as a Label).
Some classification techniques include:
- Naïve Bayes
- Maximum Entropy
- Support Vector Machines (SVM)
Naïve Bayes is a relatively simple and accurate way for the machine to identify which category an email belongs to.
Bayesian Theorem is a probability theory used to arrive at predictions considering recent evidence. The theorem was discovered by an English Presbyterian and mathematician called Thomas Bayes and published posthumously in 1763.
The rule is written like this:
p(A|B) = p(B|A) p(A) / p(B)
To deconstruct the rule, here are descriptions of each component that form it:
’The probability of A given B‘. This basically means the probability of finding observation A, given that some part of evidence B is there. This is what we want to find out. (Boone)
This is the probability of the evidence turning up, given the outcome obtained.
This is the probability of the outcome occurring, without the knowledge of the new evidence.
This is the probability of the evidence arising, without regard to the outcome.
We can apply this rule to our email spam problem and plug in the parameters:
P(spam |words) = P(words/spam)P(spam) / P(words)
This is all fine and well but it may be hard to visualize without data and values. So, taking the above into consideration, imagine we had a database of 100 emails.
We also believe that emails that contain the word “buy” are spam emails. We can now apply the Bayes Rule:
· 100 emails in total
· 60 of those 100 emails are spam
Hire expert developers for your next project
62 Expert dev teams,
1,200 top developers
300+ Businesses trusted
us since 2016
· 48 of those 60 emails that are spam have the word “buy”
· 12 of those 60 emails that are spam don’t have the word “buy”
· 40 of those 100 emails aren’t spam
· 4 of those 40 emails that aren’t spam have the word “buy”
· 36 of those 40 emails that aren’t spam don’t have the word “buy”
What is the probability that an email is spam if it has the word “buy” in the content?
The answer to the above is as follows:
There are 48 emails that are spam and have the word “buy”.
And there are 52 emails that have the word “buy”: 48 that are spam plus 4 that aren’t spam.
So the probability that an email is a spam if it has the word “buy” is 48/52 = 0.92
As mentioned previously, the rule and notation are based on probabilities, so we can redefine the problem to use probabilities rather than quantities. Using the same database of emails.
What is the probability that an email is a spam if it has the word “buy”? The notation to arrive at the answer looks like this:
So P(spam|”buy”) is the answer we are looking for
P(“buy”|spam) * P(spam) counts all the emails that are spam and have the word “buy”.
Meaning the resulting equation looks like this: (This is Bayesian Theorem)
P(spam|”buy”) = P(“buy”|spam) * P(spam) / (P(“buy”|spam) * P(spam) + P(“buy”|not spam) * P(not spam))
Or , to inject the numbers: 0.8 * 0.6 / (0.8*0.6 + 0.1*0.4) = 0.48 / 0.52
The result of the simulation was: 0.922248596074798
In Plain English
After running incoming emails through this classification model, we can safely assume that with a probability of 92%, if emails contain the word “buy”, they should be placed in the spam folder!
The classifier must be “trained” with sample datasets prior to determining future text classifications, in our email example, we had 100 emails, some contained the word “buy” and others didn‘t. Without accurate training data, the machine cannot accurately make reliable predictions on future events
With the theory and example out of the way, you now have an appreciation for how probabilities can be determined by the machine. Rather than code up numerous combinations of string patterns and complex business rules, spam identification can be determined using maths. This is a use case the machine will excel in!
The great news is that you don‘t need to code up theorems such as the Bayes Rule when you create AI software, the heavy lifting is now being done for you by the likes of Microsoft and IBM!
You can create an account on Microsoft Azure and using graphical user interfaces leverage artificial intelligence APIs that get exposed as REST endpoints. You simply pass in the parameters and the APIs return JSON with your results.
For example, Azure offers a Topic Detection API. This returns the detected topics for a list of submitted text records. A topic is identified with a key phrase, which can be one or more related words.
This is ideal for mining short, human-written text such as reviews and user feedback. Introducing an API like this into your stack could help your business gain actionable insights from existing datasets.
You can see an example of the Topic Detection API in action in the following screenshot:
Note how the API has detected the Language, Key Topics, and Sentiment. In this screenshot, you can see the underlying JSON:
Imagine you had to manually code classes and custom APIs to determine these data points. Whilst these APIs do attract a cost, the tricky thinking has already been done, thereby freeing you up to solve the business problem.
Additional Applications of Artificial Intelligence
We‘ve covered email classification and explained how one can mine data to glean actionable insights, other potential areas where artificial intelligence is starting to be applied include:
AdTech and Sentiment Analysis
The UK start-up SocialOpinion leverages artificial intelligence to identify the current sentiment of brands, products, and services on social media. In addition to this, Microsoft Cognitive Services LUIS is also used to try and determine sales leads.
The company Pred Pol built a software product that leverages big data, machine learning algorithms, and analytics. The vision was to see if the software could use historical data sets to anticipate crime locations and times and allow officers to pre-emptively prevent these crimes from occurring.
The software used the following to help achieve this:
- Past type of crime;
- Crime location;
- Date/time of the crime.
Research has shown that additional crimes tend to occur close to the original crime spot. At the start of each shift, officers examine Google maps which are overlaid with boxes that indicate potential criminal hotspots. Provided the metrics are right, the model accuracy should dramatically help to reduce crime.
NVidia, a firm over two decades old with a history in computer graphics partnered with Audi to build the next generation of autonomous vehicles, or the “AI Car” as it‘s being dubbed, powered by NVIDIA DRIVE PX.
This computer vision technology can understand in real-time what‘s happening around the vehicle, the location of itself on a map, and plan safe paths ahead.
The Future of Artificial Intelligence
At the time of writing, Facebook developed an AI system that created its own language. The system had developed a more refined vocabulary to communicate with itself. Programmers at Facebook shut down the system when they realized it was no longer communicating in readable English.
The system was originally trained in English but soon diverged from this when it realized there were more efficient ways to communicate with each “AI agent”. Matrix anyone?!
Final thoughts on how to create AI software
We‘ve covered a lot in this blog post, from the origins of AI, to how you can implement it (and if you should) as well as explore some of the current APIs out there that shield you from the complex deep learning algorithms and model training tasks that are often involved.
As much as we‘d like to be able to, it can be hard to predict the future of artificial intelligence. Cognitive computing is an evolving space, if only we had AI for the AI.
Our community of developers is an expert in all the latest tech stacks and programming languages, from Python to Keras and PyTorch, and has already built a range of AI solutions for everything from iOS apps to large in-house business systems.
Here are a few articles that might also interest you:
How To Avoid A DX Software Implementation Failure? – DevTeam.Space
How To Automate Your Supply Chain? – DevTeam.Space
Frequently Asked Questions On How To Create AI software
• Reduce human errors;
• AI-powered systems work 24×7;
• AI-powered digital assistants help with common day-to-day tasks;
• Systems using AI make decisions based on data and evidence;
• AI offers intelligent automation.
An example is the growing use of AI-powered tools for cybersecurity. Cyber-attacks are increasingly sophisticated and data breaches put the sensitive personal information of many people at risk. AI is helping organizations in fighting cyber criminals by analyzing massive volumes of data to detect potential suspicious behavior online.
Unfortunately, authoritarian states are using AI to conduct intrusive surveillance. AI capabilities like facial recognition have become useful tools in the hands of these states to suppress and marginalize minorities.