How to Create AI Software?

Artificial intelligence software

Wondering how to create an AI solution?

AI is set to become one of the leading software development growth markets.  

According to Statista, the global market for AI is set to reach $126 billion by 2025.

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”.

Source: Wikipedia

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.

how to create ai

The Problem
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 is 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:

p(A|B) 

’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)

p(B|A)

This is the probability of the evidence turning up, given the outcome obtained.

p(A)

This is the probability of the outcome occurring, without the knowledge of the new evidence.

p(B)

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:

Training Data

 

·         100 emails in total

·         60 of those 100 emails are spam

·         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 a 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 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.

  • 60% of those emails are spam.
  • 80% of those emails that are spam have the word “buy”.
  • 20% of those emails that are spam don’t have the word “buy”.
  • 40% of those emails aren’t spam.
  • 10% of those emails that aren’t spam have the word “buy”.
  •  90% of those emails that aren’t spam don’t have the word “buy”.

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:

  • P(spam) = the probability that an email is spam.
  • P(not spam) = the probability that an email isn’t spam.
  • P(“buy”|spam) = the probability that an email that is spam has the word “buy”.
  • P(“buy”|not spam) = the probability that an email that isn’t spam has the word “buy”.
  • P(spam|”buy”) = the probability that an email that has the word “buy” is spam.

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”.
P(“buy”|not spam) * P(not spam) counts all the emails that aren’t spam and have the word “buy”.
Summing the previous two P(“buy”|spam) * P(spam) + P(“buy”|not spam) * P(not spam) we count all the emails that 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!

Training Data
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

  how to create ai

APIs
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 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:

An illustration of topic detection

Note how the API has detected the Language, Key Topics, and Sentiment.  In this screenshot, you can see the underlying JSON:

how to create ai

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.

Crime prediction
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. 

Driverless Cars
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 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.

If you are looking to create an AI system, then contact DevTeam.Space to find expert AI and ML developers via this quick form.

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. 

Further Reading

Here are a few articles that might also interest you:

How to Build a Blockchain for the Music Industry? I DevTeam.Space

https://www.devteam.space/blog/how-to-build-a-blockchain-for-music-industry/

How to Build a Beer App I DevTeam.Space

How to Build a Beer App

How To Avoid A DX Software Implementation Failure? – DevTeam.Space

How To Avoid A DX Software Implementation Failure?

How To Automate Your Supply Chain? – DevTeam.Space

How To Automate Your Supply Chain?

Frequently Asked Questions on how to create AI Software

What are the advantages of artificial intelligence?

• 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.

Where has artificial intelligence helped society?

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.

Where has artificial intelligence caused harm to society?

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.

Tell us about your challenge & get a free strategy session

Hire Expert Developers
clients
banner-img

DevTeam.Space is a vetted community of expert dev teams supported by an AI-powered agile process.

Companies like Samsung, Airbus, NEC, and startups rely on us to build great online products. We can help you too, by enabling you to hire and effortlessly manage expert developers.

LinkedIn LinkedIn Facebook Facebook Twitter Twitter Facebook Messenger Facebook Messenger Whatsapp Whatsapp Skype Skype Telegram Telegram