AI Unit 1
AI Unit 1
SUPRITA KAGAWADE
DEPARTMENT OF COMPUTER SCIENCE
Government Ramnarayan Chellaram College of Commerce and Management Bengaluru
SYLLABUS
Course – 1 - Azure AI Fundamentals (AI-900)
AI-900 pathway consists of 5 courses and 2 reading material:
i. Introduction to AI on Azure
ii. Use visual tools to create machine learning models with Azure Machine Learning
iii. Explore computer vision in Microsoft Azure
iv. Explore natural language processing
v. Explore conversational AI
vi. Tune Model Hyperparameters - Azure Machine Learning (Reading)
vii. Neural Network Regression: Module Reference - Azure Machine Learning (Reading)
Practical
1. Prepare the data
2. Model the data
3. Visualize the data
4. Analyse the data
5. Deploy and maintain deliverables
Practical
1. Describe Artificial Intelligence workloads and considerations
2. Describe fundamental principles of machine learning on Azure
3. Describe features of computer vision workloads on Azure
4. Describe features of Natural Language Processing (NLP) workloads on Azure
References:
1. The learning resources made available for the course titled “Azure AI Fundamentals (AI-900) and Data
Analyst Associate (DA-100).” on Future Skills Prime Platform of NASSCOM.
2. Dr. Ashoka S.B, Ms. Kamakshi Katti, Mr. Hanamant Jakaraddi “Artificial Intelligence” edition 2023.
3. Dr. Vivek I. Sarikar, Suman M, R. Sreenivas Rao. “Artificial Intelligence”.
MARKS:
Theory Marks :30
Internals Marks:20
Total Marks:50
SECTION- B
(Understanding and Applying)
II. Answer Any Two of the following questions. Each carries Eight marks. (2 x8= 16)
4.
5.
6.
SECTION- B
I. Answer Any Four of the following questions. Each carries Five marks. (4x5= 20)
9.
10.
11.
12.
13.
14.
ARTIFICIAL INTELLIGENCE (AI)
• The term Artificial Intelligence (AI) was first invented in the early 1950, and the idea of artificial
intelligence was initially begun by the great computer scientist John McCarthy from 1943 to 1956.
• In today's world, technology is growing very fast, and we are getting in touch with different new
technologies day by day.
• Here, one of the booming technologies of computer science is Artificial Intelligence which is ready to
create a new revolution in the world by making intelligent machines. The Artificial Intelligence is now
all around us. It is currently working with a variety of subfields, ranging from general to specific, such
as self-driving cars, playing chess, proving theorems, playing music, Painting, etc.
• AI is one of the fascinating and universal fields of Computer science which has a great scope in future.
AI holds a tendency to cause a machine to work as a human.
• Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial
defines "man-made," and intelligence defines "thinking power", hence AI means "a man-made
thinking power."
• AI can be defined as "It is a branch of computer science by which we can create intelligent
machines which can behave like a human, think like humans, and able to make decisions."
▪ Artificial Intelligence exists when a machine can have human based skills such as learning,
reasoning, and solving problems.
▪ With Artificial Intelligence you do not need to preprogram a machine to do some work, despite
that you can create a machine with programmed algorithms which can work with own intelligence,
and that is the awesomeness of AI.
IMPORTANCE OF AI:
▪ With the help of AI, you can create such software or devices which can solve real-world problems
very easily and with accuracy such as health issues, marketing, traffic issues, etc.
▪ With the help of AI, you can create your personal virtual Assistant, such as Cortana, Google
Assistant, Siri, etc.
▪ With the help of AI, you can build such Robots which can work in an environment where survival
of humans can be at risk.
▪ AI opens a path for other new technologies, new devices, and new Opportunities.
ADVANTAGES OF ARTIFICIAL INTELLIGENCE:
Following are some main advantages of Artificial Intelligence:
▪ High Accuracy with less errors: AI machines or systems are prone to less errors and high accuracy as
it takes decisions as per pre-experience or information.
▪ High-Speed: AI systems can be of very high-speed and fast-decision making, because of that AI systems
can beat a chess champion in the Chess game.
▪ High reliability: AI machines are highly reliable and can perform the same action multiple times with
high accuracy.
▪ Useful for risky areas: AI machines can be helpful in situations such as defusing a bomb, exploring
the ocean floor, where to employ a human can be risky.
▪ Digital Assistant: AI can be very useful to provide digital assistant to the users such as AI technology is
currently used by various E-commerce websites to show the products as per customer requirement.
▪ Useful as a public utility: AI can be very useful for public utilities such as a self-driving car which can
make our journey safer and hassle-free, facial recognition for security purpose, Natural language
processing to communicate with the human in human-language, etc.
APPLICATIONS OF AI:
1. AI in Astronomy: Artificial Intelligence can be very useful to solve complex universe problems. AI
technology can be helpful for understanding the universe such as how it works, origin, etc.
2. AI in Healthcare: Healthcare Industries are applying AI to make a better and faster diagnosis than humans.
AI can help doctors with diagnoses and can inform when patients are worsening so that medical help can
reach to the patient before hospitalization.
3. AI in Gaming: AI can be used for gaming purpose. The AI machines can play strategic games like chess,
where the machine needs to think of a large number of possible places.
4. AI in Finance: AI and finance industries are the best matches for each other. The finance industry is
implementing automation, chatbot, adaptive intelligence, algorithm trading, and machine learning into
financial processes.
5. AI in Data Security: The security of data is crucial for every company and cyber-attacks are growing very
rapidly in the digital world. AI can be used to make your data more safe and secure. Some examples such
as AEG bot, AI2 Platform, are used to determine software bug and cyber-attacks in a better way.
6. AI in Social Media: Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user
profiles, which need to be stored and managed in a very efficient way. AI can organize and manage massive
amounts of data. AI can analyze lots of data to identify the latest trends, hashtag, and requirement of
different users.
7. AI in Travel & Transport: AI is becoming highly demanding for travel industries. AI is capable of doing
various travel related works such as from making travel arrangement to suggesting the hotels, flights, and
best routes to the customers. Travel industries are using AI-powered chatbots which can make human-like
interaction with customers for better and fast response.
8. AI in Automotive Industry: Various Industries are currently working for developing self-driven cars
which can make your journey more safe and secure.
9. AI in Robotics: Humanoid Robots are best examples for AI in robotics, recently the intelligent Humanoid
robot named as Erica and Sophia has been developed which can talk and behave like humans.
10. AI in Entertainment: We are currently using some AI based applications in our daily life with some
entertainment services such as Netflix or Amazon. With the help of ML/AI algorithms, these services show
the recommendations for programs or shows.
11. AI in Agriculture: Agriculture is an area which requires various resources, labour, money, and time for
best result. Now a day's agriculture is becoming digital, and AI is emerging in this field. Agriculture is
applying AI as agriculture robotics, solid and crop monitoring, predictive analysis. AI in agriculture can be
very helpful for farmers.
12. AI in E-commerce: AI is providing a competitive edge to the e-commerce industry, and it is becoming
more demanding in the e-commerce business. AI is helping shoppers to discover associated products with
recommended size, color, or even brand.
13. AI in education: AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant.AI in the future can be work as a personal virtual tutor
for students, which will be accessible easily at any time and any place.
UNIT 1: AZURE AI FUNDAMENTALS (AI-900)
INTRODUCTION TO AI
What is AI?
Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a software think
intelligently, in the similar manner the intelligent humans think.
What is Azure?
Azure is a cloud computing platform and an online portal that allows you to access and manage cloud
services and resources provided by Microsoft.
https://www.microsoft.com/en-us/videoplayer/embed/RE4vyDl?postJsllMsg=true
FIVE KEY WORKLOADS OF AI:
1. Machine-Learning: We "teach" a computer-model to make prediction and draw conclusions from data.
2. Anomaly-Detection: The capability of software to automatically detect errors or unusual activity in a
system.
3. Computer-Vision: The capability of software to interpret the world visually through cameras, video and
images.
4. Natural Language Processing: The capability of software to interpret written or spoken language, and
respond in kind.
5. Knowledge Mining: The capability of software to extract information from large volumes of unstructured-
data. The extracted-information is used to create a searchable-knowledge-store.
UNDERSTAND MACHINE-LEARNING(ML):
Machine learning: Machine learning is a branch of Artificial Intelligence and computer science which
focuses on the use of data and algorithms to imitate the way that humans learn, gradually improving its
accuracy.
https://www.microsoft.com/en-us/videoplayer/embed/RE4voJG?postJsllMsg=true
How Machine-Learning works?
▪ The machines learn from data.
▪ In today's world, huge volumes of data is created.
Example: Text messages, emails, social media posts, photographs and videos.
▪ Data is also created by millions of sensors in homes, cars, cities and factories.
▪ Data-scientists can use the data to train ML-models.
▪ The models can make predictions and inferences based on the relationships in the data.
Example: suppose an environmental conservation organization wants volunteers to identify and catalog
different species of wildflower using a phone app.
The below procedure is followed:
1. A team of botanists and scientists collect data on wildflower samples.
2. The team labels the samples with the correct species.
3. The labeled data is processed using an algorithm that finds relationships between the features of the
samples and the labeled species.
4. The results of the algorithm are encapsulated in a model.
5. When new samples are found by volunteers, the model can identify the correct species label.
AZURE
WHAT IS AZURE AI?
Azure is a cloud computing platform and an online portal that allows you to access and manage cloud
services and resources provided by Microsoft.
WHY AZURE FOR A1?
✓ Build on your terms Access frameworks, tools, and capabilities for developers and data scientists of any
skill level.
✓ Deploy mission-critical AI solutions. Use the same proven Al services that power Al capabilities in Xbox,
HoloLens, and Microsoft Teams.
✓ Apply AI responsibly Get tools, services, and guidelines to help you use Al responsibly, while also
preserving data privacy, transparency, and trust.
1. Azure Applied AI Service
Specialized Al services for specific business scenarios
✓ Modernize business processes with task-specific AI to solve for common scenarios
✓ Accelerate development with built-in business logic that enables you to launch solutions in days-not
months.
✓ Run responsibly anywhere with security that extends from the cloud to intelligent edge
2. Azure Cognitive Services
Comprehensive family of customizable cognitive APIs for vision, speech, language, and decision making
✓ Easily access sophisticated Al models, including OpenAl models, with the most comprehensive portfolio
of Al capabilities on the market
✓ Build confidently with the first Al services to achieve human parity in computer vision, speech, and
language
✓ Deploy anywhere from the cloud to the edge with containers.
✓ Get started quickly and customize solutions to meet your own unique requirements
3. Azure Machine Learning
An end-to-end platform for building, training, and deploying machine learning models
✓ Develop with your choice of tools with Jupyter Notebook, drag-and-drop designer, and automated
machine learning
✓ Create and deploy models at scale using automated and reproducible machine learning workflows.
✓ Innovate responsibly with a rich set of built-in responsible capabilities to help you understand, protect, and
control data, models and processes.
✓ Build your way with best-in-class support for open-source frameworks and languages including MLflow,
Kubeflow, ONNX, PyTorch, TensorFlow, Python, and R.
INTRODUCTION
✓ Machine Learning is the foundation for most artificial intelligence solutions. Creating an intelligent
solution often begins with the use of machine learning to train predictive models using historic data
that you have collected.
✓ Azure Machine Learning is a cloud service that you can use to train and manage machine learning
models.
WHAT IS MACHINE-LEARNING?
✓ Machine learning is a branch of Artificial Intelligence and computer science which focuses on
the use of data and algorithms to imitate the way that humans learn, gradually improving its
accuracy.
✓ ML uses mathematics & statistics to create a model that can predict unknown values.
a) Mathematically, machine-learning is a function (f): The function (f) operates on one or more features
(x) to calculate a predicted-label (y).
i.e., f(x) = y
b) The function (f) depends on a no. of factors including
i. Type of model
ii. Algorithm used to train the model
TYPES OF MACHINE-LEARNING
a) There are 2 general approaches to machine-learning.
1) Supervised ML
2) Unsupervised ML
b) In both approaches, you train a model to make predictions.
1) Supervised Machine-Learning:
▪ Supervised learning is a machine learning approach in which a data scientist acts like a tutor and trains the
AI system by feeding basic rules and labeled datasets. The datasets will include labeled input data and
expected output results. In this machine learning method, the system is explicitly told what to look for in the
input data.
▪ You to start with a dataset with known label-values.
Two types of tasks are:
i. Regression: Regression is used to predict a continuous value; like a price or a sales total.
ii. Classification: Classification is used to determine a class-label. For example,
• Binary class-label can classify whether a patient has diabetes or not
• Multi-class-labels can classify text as positive, negative, or neutral
2) Unsupervised Machine-Learning:
▪ Unsupervised learning is a machine learning technique in which the data scientist lets the AI system learn
by observing. The training dataset will contain only the input data and no corresponding output data.
▪ When compared to supervised learning, this machine learning method requires massive amounts of
unlabeled data to observe, find patterns, and learn. Unsupervised learning could be a goal in itself, for
example, discovering hidden patterns in datasets or a method for feature learning.
▪ You to start with a dataset without known label-values.
One type of task is:
i. Clustering: Clustering used to determine labels by grouping similar information into label-groups.
• For example, grouping different shapes.
MACHINE-LEARNING IN MICROSOFT-AZURE
▪ Microsoft-Azure provides the Machine-Learning (ML) service.
▪ ML-service is a cloud-based platform for creating, managing, and publishing ML-models.
FEATURE CAPABILITY
Automated machine learning This feature enables non-experts to quickly create an
effective machine learning model from data.
Azure Machine Learning designer A graphical interface enabling no-code
development of machine learning solutions.
Data and compute management Cloud-based data storage and compute resources that
professional data scientists can use to run data experiment
code at scale.
Pipelines Data scientists, software engineers, and IT operations
professionals can define pipelines to orchestrate model
training, deployment, and management tasks.
▪ In Azure Machine Learning, operations that you run are called jobs. You can configure multiple
settings for your job before starting an automated machine learning run. The run configuration provides
the information needed to specify your training script, compute target, and Azure ML environment in
your run configuration and run a training job.
UNDERSTAND THE AUTOML PROCESS
The steps in a machine-learning process is as follows:
1. PREPARE DATA
▪ Identify the features and label in a dataset. Pre-process, or clean and transform, the data as needed.
▪ Machine learning models must be trained with existing data. Data scientists expend a lot of effort
exploring and pre-processing data, and trying various types of model-training algorithms to produce
accurate models, which is time consuming, and often makes inefficient use of expensive compute
hardware.
▪ In Azure Machine Learning, data for model training and other operations is usually encapsulated in
an object called a dataset. You can create your own dataset in Azure Machine Learning studio.
2. TRAIN MODEL
▪ Split the data into two groups, a training and a validation set. Train a machine learning model using the training
data set. Test the machine learning model for performance using the validation data set.
▪ The automated machine learning capability in Azure Machine Learning supports supervised
machine learning models - in other words, models for which the training data includes known label
values. You can use automated machine learning to train models for:
• Classification (predicting categories or classes)
• Regression (predicting numeric values)
• Time series forecasting (predicting numeric values at a future point in time) In Automated
Machine Learning you can select from several types of tasks:
▪ In Automated Machine Learning, you can select configurations for the primary metric, type of model used
for training, exit criteria, and concurrency limits.
▪ Importantly, AutoML will split data into a training set and a validation set. You can configure the
details in the settings before you run the job.
3. EVALUATE PERFORMANCE:
▪ Compare how close the model's predictions are to the known labels.
▪ After the job has finished you can review the best performing model. In this case, you used exit
criteria to stop the job. Thus the "best" model the job generated might not be the best possible model,
just the best one found within the time allowed for this exercise.
APPLICATIONS OF COMPUTER-VISION
1. Content Organization: Identify people or objects in photos and organize them based on the identification.
2. Photo Recognition: Applications like this are commonly used in photo storage and social media applications.
3. Text Extraction: Analyse images and PDF documents that contain text and extract the text into a structured
format.
4. Spatial Analysis: Identify people or objects, such as cars, in a space and map or understand their movement
within that space.
COMPUTER-VISION SERVICE (CVS)
▪ To an AI application, an image is just an array of pixel values.
▪ These numeric values can be used as features to train models.
▪ Then, the models make predictions about the image and its contents.
▪ CVS gives you access to pre-trained computer-vision capabilities.
3. Detecting Objects:
▪ The object detection capability is similar to tagging, in that the service can identify common objects;
but rather than tagging, or providing tags for the recognized objects only, this service can also return
what is known as bounding box coordinates.
▪ Not only will you get the type of object, but you will also receive a set of coordinates that indicate the
top, left, width, and height of the object detected, which you can use to identify the location of the
object in the image.
Example:
4. Detecting Brands:
▪ This feature provides the ability to identify commercial brands. The service has an existing database of
thousands of globally recognized logos from commercial brands of products.
▪ When you call the service and pass it an image, it performs a detection task and determine if any of
the identified objects in the image are recognized brands. The service compares the brands against its
database of popular brands spanning clothing, consumer electronics, and many more categories.
▪ If a known brand is detected, the service returns a response that contains the brand name, a
confidence score (from 0 to 1 indicating how positive the identification is), and a bounding box
(coordinates) for where in the image the detected brand was found.
For example: In the following image, a laptop has a Microsoft logo on its lid, which is identified and
located by the Computer Vision service.
5. Detecting Faces:
▪ The Computer Vision service can detect and analyze human faces in an image, including the ability
to determine age and a bounding box rectangle for the location of the face(s).
Example: In The following example shows an image of a person with their face detected and
approximate age estimated.
6. Categorizing an Image:
▪ Computer Vision can categorize images based on their contents. The service uses a parent/child
hierarchy with a "current" limited set of categories. When analyzing an image, detected objects are
compared to the existing categories to determine the best way to provide the categorization.
Examples:
What is NLP?
▪ NLP stands for Natural Language Processing. It is the branch of Artificial Intelligence that deals
with creating software that understand written or spoken language.
Working of Natural Language Processing (NLP)
▪ Working in natural language processing (NLP) typically involves using computational techniques to
analyze and understand human language. This can include tasks such as language understanding,
language generation, and language interaction.
The field is divided into three different parts:
1. Speech Recognition: The translation of spoken language into text.
2. Natural Language Understanding (NLU): The computer’s ability to understand about what do the
user say?, their intention?, Meaning?.
3. Natural Language Generation (NLG): The generation of natural language by a computer about What
should we say to user?, It should be Intelligent and Conversational, Deal with structured data,
Text/sentence planning.
4. Named Entity Recognition: Identifying and categorizing entities in a text, such as people,
organizations and locations.
Example:
5. Chatbots: Using NLP to interact with a computer program or device, such as a virtual assistant or
messaging app.
Example:
3. Entity recognition
▪ You can provide the Language service with unstructured text and it will return a list of entities in the
text that it recognizes.
Example: suppose you use the Language service to detect entities in the following restaurant review extract:
"I ate at the restaurant in Seattle last week."
WORKING OF CONVERSATIONAL AI
▪ Conversational AI works by using a combination of natural language processing (NLP)
and machine learning (ML).
▪ Conversational AI systems are trained on large amounts of data, such as text and speech. This data
is used to teach the system how to understand and process human language. The system then uses
this knowledge to interact with humans in a natural way. It’s constantly learning from its interactions
and improving its response quality over time.
Examples of conversational AI
To give a few application examples of the constantly evolving conversational AI technology:
1. Chatbots: often used in customer service applications to answer questions and provide support.
2. Assistants: often voice-activated and can be
used on mobile devices and smart speakers.
3. Text-to-speech software: used to create audiobooks, or generate spoken directions.
4. Speech recognition software: used to transcribe lectures, create transcripts of phone calls, or generate
automatic captions for videos.
BOT
▪ A bot is an application with a conversational interface.
Some common features of bots include:
• Users interact with a bot by initiating activities in turns.
• Activities are events, such as a user joining a conversation or sending a message.
• Messages can be text, speech, or visual interface elements.
• A flow of activities can form a dialog, in which state is maintained to manage a multi-turn
conversation.
• Activities are exchanged across channels, such as web chat, email, Microsoft Teams, and
others.
• We except organizations to engage with us individually, and to be able to answer complex questions
at a personal level
• Many organizations publish support information that answer through a web browser or a
dedicated app.
RESULTS
After training is complete:
o To save a snapshot of the trained model, select the Outputs tab in the right panel of the Train
model component. Select the Register dataset icon to save the model as a reusable component.
PRACTICAL
1. Prepare the data
2. Model the data
3. Visualize the data
4. Analyse the data
5. Deploy and maintain deliverables
Solutions:
Problem: Polynomial Logistic Regression on Iris Flowers Dataset for Classification
Problem Description: The Iris flowers dataset basically contains 150 instances of flowers. Each flower has 4
attributes: sepal length, sepal width, petal length and petal width (each in cm) and 3 possible classes it might
belong to: setosa, vermicolor, and virginica.
Our objective is to develop a classifier that can accurately classify a flower as one of the 3 classes based on the
4 features.
There are basically 5 stages involved-
1. Obtain a proper dataset for the task.
2. Analyze and visualize the dataset, and try to gain an intuition about the model you should use.
3. Convert the data into an usable form, and then preprocess it.
4. Build the model, and evaluate it.
5. Check where the model is falling short, and keep improving it.
Algorithm: We used Logistic Regression which is one of the simplest algorithms which on also made to work
relatively well on this dataset-Logistic Regression. In case if you have just begun Machine Learning and do not
know what it is, check this set of lectures out from the popular machine Learning course by Andrew NG. They
are perfect way to get started. Also check out the next series of lectures, i.e. 7, if you aren't familiar with
regularization.
If you are well-versed in linear algebra, univariate and multivariate calculus, probability as well as statistics
already, and would like a deeper mathematical understanding then check out this video from Stanford Online-
In case if you don't understand any of the metrics you see, feel free to search them they are pretty much
basic and easy to understand. Training set accuracy is approx 95.5% and test set accuracy approx 94.7%. A
weighted average of F1-score of all different classes in the test set is 0.95 and 2 examples from the test set are
classified incorrectly. An accuracy of 94.7% on the training set at first go is really good, but we can do better.
Then evaluate the model, using the metrics discussed above. Again, the results will differ with each
time the model is trained. Here is my output
5. Generating Predictions
It's time to use the model to generate predictions. We'll give it an array of 4 numbers representing the 4
features of a flower, and it will tell us which species it thinks that it belongs to. We randomly pick 20 examples
from the dataset, preprocess them and get the predicted classes.
indices = np.random.randint(150, size=20)
X_pred, Y_true = X[indices],
Y[indices] X_pred_pr = poly.transform(X_pred)
X_pred_pr = scaler.transform(X_pred_pr)
Y_pred = model.predict(X_pred_pr)
Note that Y_true represents the true class of the example and Y_pred is the predicted class. They are
both integers as the model works with numeric data. We will now create 2 lists, storing the true names and
predicted names of the species of each example, using the dictionary mapping we already created named target.
target_true, target_pred = [], []
for i in range(len(Y_true)):
target_true.append(target[Y_true[i]])
target_pred.append(target[Y_pred[i]])
print(X_pred)
print(target_true)
print(target_pred)
OUTPUT:
5Marks questions
1. Explain Applications of AI.
2. Explain Advantages and Disadvantages of AI
3. Explain 5 key workloads of AI
4. Mention the services provided by Azure.
5. Explain the types of Machine Learning?
6. What are the different types of Azure Machine Learning Compute Resource?
7. What are the steps to be followed to understand the AutoML process?
8. Explain tasks for analyzing images with the Computer Vision service.
9. Write a short note on NLP.
10. Explain the Text Analytics Techniques.
11. Explain different capabilities of language services.
12. How Does Conversational AI Work?
13. Mention the steps to create Conversational AI.
14. Explain the Components of Conversational AI.
15. Differentiate between Human Intelligence and Machine Intelligence.