Saturday, October 30, 2021

Artificial Intelligence: Getting Started

What is Artificial Intelligence?

As humans, we perceive the real world around us. We then process that perceived information, make decisions, and take certain actions. When we take this process of perceiving and acting and program it to a machine, we call that artificial intelligence. 


People and computers are good at different things. Computers are great at recognizing and measuring patterns based on large sets of data, like weather patterns, for example. Humans are good at more complicated tasks that involve context, or emotion, like identifying the age of a person based on looking at them in a particular environment. The goal of artificial intelligence is to figure out how to be as human as possible.


ornelladotcom_1-1635536631471.jpeg weather.gif

The idea of intelligence is controversial. Do you think cats are intelligent? Because we don't know what intelligence is, we created a test to check if we made something intelligent, called the Turing test. The goal of the Turing test is to figure out whether or not a computer is capable of thinking like a human being. So, how can we even start about thinking about making something that is as intelligent as a human?


What makes us intelligent?

To be able to program intelligence into a machine, we need to understand how our own process of decision-making works. If you do a bit of introspection, you may realize that there are some processes that happen subconsciously – for example, we can distinguish a cat from a dog without thinking about it – while some others involve more in-depth reasoning. Because we can follow our thoughts while we reason, we can try to formalize this process and program it to a computer. This is called symbolic reasoning, or a top-down approach to AI.


Alternatively, we can try to model the simplest elements inside our brain – neurons. We can construct an artificial neural network inside a computer, and then try to teach it to solve problems by giving it examples. This process is similar to how a newborn child learns about the world around them through observations. This approach is also called the bottom-up approach.


A Brief History of AI

The field of Artificial Intelligence was created in the 1950s. Initially, symbolic reasoning was the predominant approach, and this led to a number of important successes, such as expert systems – computer programs that were able to act as an expert in some limited problem domain. However, it soon became obvious that this approach did not scale well. Extracting the knowledge from an expert, representing it in a computer, and keeping that knowledge base accurate turned out to be a very complex task, and too expensive to be practical in many cases. This led to the AI Winter in the 1970s – a period of lessened interest in the field.



As time passed, computing resources became cheaper and more data became available. The neural network approach started demonstrating great performance, and could compete with human beings in many areas, such as computer vision and speech understanding. In the last decade, the term Artificial Intelligence has been mostly used as a synonym for Neural Networks, because most of the AI successes that we hear about are based on them.

We can observe how the approaches changed, for example, in creating a chess playing program:

  • Early chess programs were based on search – a program explicitly tried to estimate possible moves of an opponent for the few next moves, and selected an optimal move based on the optimal position that could be achieved in a few moves. This led to the development of the alpha-beta pruning search algorithm.
  • Search strategies worked well towards the end of the game, where search space is limited by a small number of possible moves. However, in the beginning of the game, the search space is huge, and the algorithm can be improved by learning from existing matches between human players. This strategy employs case-based reasoning, where we are looking for cases in the knowledge base that are very similar to the current position in the game.
  • Modern programs that win over human players are based on neural networks and reinforcement learning, where the program learns to play solely by playing for a long time with itself and learning from its own mistakes – much like human beings do when learning to play chess. However, a computer program can play many more games in much less time, and thus can learn much faster.

Similarly, we can see how the approach towards creating “talking programs” (that might pass the Turing test) changed:

  • An early program of this kind, Eliza, was based on very simple grammatical rules and the re-formulation of the input sentence into a question.
  • Modern assistants, such as Cortana, Siri or Google Assistant, are all hybrid systems that use neural networks to convert speech into text, recognize our intent, and then employ some reasoning or explicit algorithms to perform required actions.
  • In the future, we may expect complete neural-based models that handle dialogue by themselves. Recently, the GPT family of neural networks has shown great success in this.


Hybrid approach

We mentioned the term ‘hybrid system’, which refers to the fact that a complex intelligent system nowadays can be constructed from different components, some of which may be neural-based, while others may be explicitly programmed or be based on knowledge and reasoning.


For example, check out the Astronaut Robotic Pillow below, which was developed jointly by Mechanium and the MAILabs laboratory at the Moscow Aviation Institute. This pillow greets people when they enter the exhibition, and then starts a dialogue with them based on the age, gender, and emotions of a visitor. It is based on pre-trained neural networks available in Microsoft Azure, and a proprietary knowledge reasoning engine to support the dialogue.




Artificial Intelligence and Machine Learning on Azure

If that sounds complicated, don’t worry. You don’t have to train all of the models yourself — you can use cognitive services, which are pre-trained models that are trained on Microsoft data. You also don’t have to buy your own datacenter to train the models — you can do it all in the cloud. If you’re solving a common problem, you have a set of pretrained models to choose from. Here’s a menu of the services available to you on Azure, Microsoft’s cloud computing platform. You can access pretrained models, use data science tools, experiment with popular frameworks and services, and have access to computing power in the cloud.




Let’s dive a little deeper on the domain specific pretrained models, also known as cognitive services. There are pre-trained models for vision, speech, language, and knowledge. Let’s go through a few examples of what that looks like.


Using the Face API, you can get face detection, a description, and person identification. Here’s a photo of Ornella with some identification markers, like age, gender, what kind of glasses I’m wearing, and my emotion.




Another thing you can do with cognitive services is something called Sentiment Analysis – we can analyze a bit of text to tell you the sentiment of the sentences, and even parts of the words. This example uses natural language processing (NLP) to read a restaurant review and determine that the feedback is 86% positive and 14% negative, and it can tell you the key phrases that led to that analysis.




Instagram Investigation Project

To give you another example of how cognitive services can be used, let’s talk about Instagram. I’ve always wondered why some of my Instagram posts that I do not personally consider interesting get a high number of likes, while some other pictures that I love do not get appreciated.




The best way to find out what makes Instagram posts popular is to use data science, and you can do it all without knowing how to code! For more details about this project, check out the blog post How to Learn Data Science without Coding.


To get started, you may want to check if the text of the Instagram post has any effect on the number of likes. You can download your own Instagram archive from the site, and it will contain a special JSON file with all of your posts. To find out the relationship between the post text and the number of likes, you will need to run the text of the post through sentiment analysis (available as part of the Text Analytics cognitive service).




To process all of your posts without writing a single line of code, we can use a technology called Power Automate. It allows us to visually define a flow – for each post found in the JSON file, we’ll call Text Analytics, and save the result into a CSV text file, which we will be able to open later in Excel. To call Text Analytics, you’ll need to create a Cognitive Services resource in your Azure Subscription, and provide the endpoint URL and key to the corresponding box in your Power Automate flow.



Once you open your CSV file in Excel, you can plot the graphical relation between sentiment and number of likes, which in my example looks like this:




You can see that there is some correlation, but not a large one. The correlation coefficient turned out to be 0.13, which is indeed low.

To dive even further into this experiment, we could check for a relationship between the visual features of the photograph and the number of likes. To do this, we would need to run individual pictures through the  Computer Vision cognitive service. You can read more about this process in a separate blog post, but here’s one graph to get you interested:




AI and Art

AI can be applied in many fields, but one of the most interesting is the intersection of AI and art. It is especially interesting because it allows us to explore whether AI can in fact be creative. If you want to experiment with AI and art yourself, and you know a bit of Python – try creating your own cognitive portrait. It is a technique I invented where you use the Face API to align several portrait photographs on top of each other to create an interesting blurred effect like this:




To learn how to create your own picture like this, check out this blog post: PeopleBlending: Science Art Using Cognitive Services and a Bit of Creativity, and feel free to experiment with the code in this GitHub repository.


This technique used AI as a tool to extract facial landmarks from a picture. However, AI models can also be trained to produce images like this:


To learn more about how these images are produced using Generative Adversarial Networks, check out the following blog post: Creating Generative Art using GANs on Azure ML.


Ethical AI

When working with Artificial Intelligence, it’s extremely important to consider potential ethical implications. Here at Microsoft, we use the FATE model to highlight questions we should be asking ourselves when implementing AI.


The decision-making process in AI is based on data, and it’s very easy to get the data wrong. We need to work to understand why certain decisions were made – for example, in a medical diagnosis, it’s highly important for humans to be able to identify the reasoning behind that diagnosis. It’s also never a good idea to hide that something is an AI, for example, when dealing with chatbots. Consider AI to be the trusted advisor to a human decision-maker. To learn more about responsible AI, check out this list of Responsible AI resources.

 Screen Shot 2021-10-29 at 1.20.16 PM.png


Start learning Artificial Intelligence

We have several free resources available for you to get started learning Artificial Intelligence and Machine Learning.


To work through Microsoft Learn modules alongside Cloud Advocates Ornella Altunyan and Chloe Condon, check out the show Beep Boop. There are eight videos available that cover all sorts of topics from how to create an AI chatbot to how to create an AI-enabled web app. There are also accompanying blog posts that summarize what was covered in each episode.


To get started with machine learning, you can try out Azure virtual machines. In this Microsoft Learn module, you’ll create, connect to, and share data among users on a Data Science Virtual Machine that's preloaded with data science and machine learning tools.


If you’re a student, you have access to a free Azure account with $100 of credits per year.


Here are some other links to continue learning topics we’ve covered in this blog post:


AI for Beginners Learning Group



This blog post is a gentle introduction to AI. If you want to go deeper into the area of Neural Networks and Deep Learning, we are preparing a special curriculum for you right now: AI for Beginners. The curriculum should go live in December, so you can take a look at it over the holidays, or you can learn together in AI for Beginners Learning Group. Read this post to find out what you need to do to be among the first folks to learn AI with us!


Posted at