Getting started with Azure Cognitive Services
Tags: azure, machinelearning, showdev, azurecognitiveservices
Published: 2019-07-10 21:20:55

---
title: Getting started with Azure Cognitive Services
published: true
description: You have definitely heard of these different abbreviations: AI, ML, ANN,… But you might not know the exact meaning of each of these abbreviations or how they relate to each other. In this article we will go through each of them and find out how they relate to each other in the bigger picture.
tags: #azure, #machinelearning, #showdev, #Azure cognitive Services
---

#The beginning
![Robot](https://thepracticaldev.s3.amazonaws.com/i/ehs6kq2ldbcfhzm6hbda.png)
You have definitely heard of these different abbreviations: AI, ML, ANN,… But you might not know the exact meaning of each of these abbreviations or how they relate to each other. In this article we will go through each of them and find out how they relate to each other in the bigger picture.

#AI (Artificial Intelligence)
The simplest definition I have found about AI is:
*"AI is the simulation of human intelligence processes by machines. These processes include, reasoning, remembering, learning and self-correction."*

It means we want the device's brain to function as a human's brain. So they can remember, understand, recognize things and even learn from past mistakes and correct themselves.

So as you can see, AI is all about the ability of machines to act as humans.

#ML (Machine Learning)
We mentioned that we want machines to act and behave as humans. In order to do that we need to write programs that give them such an ability. This brings us to ML.

In 1959, Arthur Samuel mentioned:
*"Machine learning is a field of computer science that gives computers the ability to learn without being explicitly programmed."*

ML is all about writing applications which give this ability to machines without hard-coding the situations. We can not simulate the human brain with hard-coded scenarios.

Look at this picture and think about what you see here? How would you describe this picture?
![What do you see in this picture?](https://thepracticaldev.s3.amazonaws.com/i/jeirnkk7v7v4y1x9xtb9.png)
You most probably describe it something like: *"I see a cat and a dog looking at each other through a window."*

What happened here is that your brain recognized a few patterns:
* A dog
* A cat
* A window

This happened simply because you have seen them earlier in your life and you were able to remember the pattern. Even though you might not have met this particular cat or dog before in person, you can still relate them as cats and dogs that you have seen before.

With ML, we can write programs that can detect these patterns by using different techniques such as:
* [Artificial Neural Networks](https://en.wikipedia.org/wiki/Artificial_neural_network)
* [Deep Learning](https://en.wikipedia.org/wiki/Deep_learning)
* [Bayesian Networks](https://en.wikipedia.org/wiki/Bayesian_network)
* [Clustering](https://en.wikipedia.org/wiki/Cluster_analysis)

You can use either one or a combination of them to detect different patterns.

#The bigger picture
Now that we know what is AI, ML and different ML techniques are, we can draw the bigger picture:
![The bigger picture](https://thepracticaldev.s3.amazonaws.com/i/m30lh3whvi2umozqewvf.png)
AI generally refers to the ability of machines to behave as human (very general). ML is one way of giving this ability to machines by programs. To write these programs, developers often use one or a combination of ML techniques such as ANN, DL & etc.

#How does ML work?
Let's figure this out by trying to teach the machine to recognize dogs. In order to do that we need to follow these steps:
1. Create a data set which contains pictures of all dog breeds
2. Run different algorithms to learn what a dog looks like
3. Go through step one and two until it knows what a dog looks like

![Dog](https://thepracticaldev.s3.amazonaws.com/i/2i3uv87quxtvsd5bxf64.png)

The result of these steps is called **"Model"** and the process of generating the model is called **"Training"**. You might have heard the phrase before *"I am training my model"*. It basically means I am going through step 1 & 2 multiple times to recognize a pattern.

![Training a model](https://thepracticaldev.s3.amazonaws.com/i/fr61jjqfmjtibnckn441.png)

Once you have the Model, you can have a REST API to talk to your application.

#Challenges
This process might sound pretty simple, but of course it comes with different challenges. Here are the top 3 challenges:
* Data preparation
* Create and test the result of the algorithm
* Expose your model to the app
![Challenges](https://thepracticaldev.s3.amazonaws.com/i/bgjz7d6cdmo981cn5xxg.png)

Let's go through each of them and discover what the issue is.
##Data preparation
Preparing the data-set which projects the reality and covers all the edge cases is not always easy. If we get back to our dog example, you need to make sure to have a data set with pictures of all possible breed of dogs, including the mixed breeds. Collecting all of these data is not always easy.

It is not so easy to find out out which algorithm, or combination of them, is the best/worst for your scenario - supervising the results is neither easy nor straight forward. Keep in mind, cases are not always as easy as detecting pictures of dogs.

![Dog or Muffin](https://thepracticaldev.s3.amazonaws.com/i/qxdkrqpyp1gmz4290vxk.png)

That's why there are three types of machine learning algorithms:
* [Supervised learning](https://searchenterpriseai.techtarget.com/definition/supervised-learning): Data sets are labeled so that patterns can be detected and used to label new data sets
* [Unsupervised learning](https://whatis.techtarget.com/definition/unsupervised-learning): Data sets aren't labeled and are sorted according to similarities or differences
* [Reinforcement learning](https://searchenterpriseai.techtarget.com/definition/reinforcement-learning): Data sets aren't labeled but, after performing an action or several actions, the AI system is given feedback

Also keep in mind these processes are pretty expensive in terms of required resources.

##Expose your model to the app
Any of you who have exposed the data out to the different apps know that creating a performed and secure REST API that caters to the needs of different apps is not always easy.

![Expose your model to the app](https://thepracticaldev.s3.amazonaws.com/i/jiv7g7jqy78q061uh8zm.png)


#Is there an easier way?
Now that I am talking about all of these challenges you might ask. Okay, we get it, but is there any other easier way to leverage ML and create intelligent apps?

Yes there is. [Azure Cognitive services](https://azure.microsoft.com/en-us/services/cognitive-services/directory/?wt.mc_id=cognitiveservices-devto-shlist) can remove most of these responsibilities off your shoulders and come up with a pretty performant and secure REST API which you can use in your apps.

Your process will turn into the following picture:
![Cognitive Services](https://thepracticaldev.s3.amazonaws.com/i/bd4bap9zbshhb5x4vm2o.png)

Also by having your services and data in Azure, you will automatically have a basic level of security on your services that comes by default with using Azure. Azure will also guarantee that availability of your service.

As of today there are 5 available services:
* Decision
* Speech
* Language
* Search
* Vision

![List of Azure Cognitive Services](https://thepracticaldev.s3.amazonaws.com/i/otrjmwf5qvn820fevi1j.png)

All of these services come with a pre-built model. Additionally, there is a group of services where you can customize the models, through providing training data, to cater to your specific needs. You can combine them together like LEGO pieces to create super intelligent apps.

All you need to know is how to [create your Service on Azure](https://azure.microsoft.com/en-us/try/cognitive-services/?api=face-apit?wt.mc_id=cognitiveservices-devto-shlist), call the end point from your app with the Authentication key which is provided to you and leverage your app.

![Azure portal](https://thepracticaldev.s3.amazonaws.com/i/jmlnie5k6fzmxulac0ve.png)

If you just want to explore and play with different services, you can also [create a guest account](https://aka.ms/create-cognitive-services-account) without even providing your credit card information.

So far in this article we have been through the basics of Machine learning and how Cognitive services come into the picture as well as how easy is it to use them by just creating them and calling the secured and well performed end-point which Azure provides you.

In the next article I will give you a good overview of our available cognitive services and will show you how easily you can call them via your application (with code snippets).


#Useful resources:
* [Microsoft Azure Cognitive Services: The Big Picture](https://app.pluralsight.com/library/courses/microsoft-azure-cognitive-services-big-picture/table-of-contents)
* [Azure Cognitive Services API - I need your clothes, boots and your motorcycle](https://itnext.io/cognitive-services-api-i-need-your-clothes-boots-and-your-motorcycle-1216c36cfe8b)
* [Getting started with Azure Cognitive Services](https://youtu.be/MvDjbjB0Lsw)
* [A machine learning and AI guide for enterprises in the cloud] (https://searchenterpriseai.techtarget.com/definition/AI-Artificial-Intelligence)
* [What Is Machine Learning?](https://www.ibm.com/developerworks/community/blogs/jfp/entry/What_Is_Machine_Learning)