0% found this document useful (0 votes)
2 views

Data Science Introduction

Artificial Intelligence (AI) enables machines to perform tasks that typically require human intelligence, such as understanding language and recognizing images. AI systems learn from data using algorithms, with techniques like supervised and unsupervised learning to make decisions. Classification models, such as K-Nearest Neighbors (K-NN), categorize data into predefined classes based on learned patterns from training data.

Uploaded by

sarvadnya mense
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Data Science Introduction

Artificial Intelligence (AI) enables machines to perform tasks that typically require human intelligence, such as understanding language and recognizing images. AI systems learn from data using algorithms, with techniques like supervised and unsupervised learning to make decisions. Classification models, such as K-Nearest Neighbors (K-NN), categorize data into predefined classes based on learned patterns from training data.

Uploaded by

sarvadnya mense
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Study Material

AI Concepto Labs

1. What is AI

Artificial Intelligence (AI) is the ability of a computer or a machine to think and learn like a
human. It helps machines do tasks that usually need human intelligence, like:

- Understanding language: Like how Siri or Alexa can understand and answer your questions.

- Recognizing images: Like how Facebook can tag your friends in photos.

- Making decisions: Like how Google Maps can find the best route for you.

AI is used in many areas, such as helping doctors diagnose diseases, powering self-driving
cars, and recommending movies on Netflix. The goal of AI is to make machines smart enough
to solve problems on their own.

2. How AI makes a computer or a machine to think

AI makes a computer or machine "think" by using algorithms and models that allow it to
process information, learn from data, and make decisions. Here’s a simple breakdown of
how this works:

1. Data Input: Just like humans learn from experience, AI systems learn from data. This data
can be anything from text, images, sounds, to sensor readings.

2. Learning from Data: AI uses different techniques to learn from data. One common
technique is called Machine Learning. Machine Learning algorithms identify patterns in the
data and learn from these patterns to make predictions or decisions. For example:

- Supervised Learning: The AI is trained on a labeled dataset, meaning it knows the correct
answer ahead of time. It learns to make predictions or decisions based on this data.

- Unsupervised Learning: The AI is given data without labels and must find patterns or
structure on its own.

- Reinforcement Learning: The AI learns by receiving rewards or penalties for actions it


performs, improving its decisions over time.

3. Algorithms and Models: These are the mathematical formulas and statistical techniques
that process the data and help the AI learn. For example:

4. Processing and Decision Making: Once trained, the AI can process new data and make
decisions or predictions based on what it has learned. For example:

- A self-driving car uses AI to process data from its sensors and cameras, learning to
recognize objects like pedestrians and traffic signs, and making decisions about when to
stop or turn.

5. Improvement and Adaptation: AI systems can continue to learn and improve over time as
they are exposed to more data. This allows them to adapt to new situations and improve
their performance.

In essence, AI mimics human learning and decision-making processes through the use of
sophisticated algorithms and large amounts of data, enabling machines to perform tasks
that typically require human intelligence.

3. what is classification model

A classification model is a type of machine learning model that is used to categorize or


classify data into predefined classes or labels. It takes input data and predicts which
category or class the data belongs to. Classification models are widely used in various
applications, such as email spam detection, image recognition, and medical diagnosis.

Here's a simple explanation of how a classification model works:

1. Training Data: The model is trained on a dataset that includes examples with known
labels. For instance, if you are building a spam detection model, your training data
would consist of emails labeled as "spam" or "not spam."

2. Features: The input data is represented by features, which are the attributes or
properties used to make predictions. In the spam detection example, features could
include the presence of certain words, the length of the email, etc.

3. Learning: The model learns patterns from the training data using an algorithm. During
this learning process, the model adjusts its internal parameters to minimize errors in
predicting the labels.

4. Prediction: Once trained, the model can predict the label for new, unseen data. It
takes the features of the new data as input and outputs a label. For example, given a
new email, the model will predict whether it is "spam" or "not spam."

5. Evaluation: The performance of the classification model is evaluated using metrics


such as accuracy, precision, recall, and F1-score. This helps determine how well the
model is performing on both the training data and unseen data.

Types of Classification Algorithms:

- Logistic Regression: A statistical model that predicts the probability of a binary


outcome (e.g., spam or not spam).
- Decision Trees: A tree-like model where decisions are made based on feature values,
leading to a predicted label.
- Random Forest: An ensemble of decision trees that improves prediction accuracy by
combining the output of multiple trees.
- Support Vector Machines (SVM): A model that finds the optimal boundary
(hyperplane) to separate different classes in the feature space.
- K-Nearest Neighbors (KNN): A model that assigns labels based on the labels of the
nearest data points in the feature space.
- Neural Networks: Complex models inspired by the human brain, capable of learning
intricate patterns in data.

Example Application:
Imagine you are building a model to classify types of fruit based on their features such
as color, size, and weight. You would:

1. Collect a dataset of fruits with labels (e.g., apple, banana, orange).


2. Extract features from each fruit (e.g., color = red, size = medium, weight = 150g).
3. Train a classification model on this dataset.
4. Use the trained model to predict the type of fruit for new, unlabeled examples based
on their features.

In summary, a classification model helps in making decisions by assigning labels to input


data based on learned patterns from labeled training data.
how K-NN works

K-Nearest Neighbors (K-NN) is a simple, yet powerful, machine learning algorithm used for
classification and regression tasks. Here’s a step-by-step explanation of how K-NN works:

Steps in the K-NN Algorithm

1. Choose the Number of Neighbors (K):

- Decide the number of nearest neighbors (K) to consider. This is a hyperparameter that you
can tune based on the dataset and problem.

2. Calculate Distance:

- For a new data point that you want to classify, calculate the distance between this point
and all the points in the training dataset. Common distance metrics include Euclidean
distance, Manhattan distance, and Minkowski distance. The Euclidean distance between two
points \((x_1, y_1)\) and \((x_2, y_2)\) in a 2-dimensional space is calculated as:

\[

\text{distance} = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

\]

3. Identify the Nearest Neighbors:

- Sort the distances calculated in the previous step and select the K points that are closest
to the new data point. These points are the nearest neighbors.

4. Voting for Classification:

- For classification, each of the K nearest neighbors "votes" for their class label. The class
with the majority vote among the K neighbors is assigned to the new data point. For
instance, if K=5 and the nearest neighbors have labels [‘apple’, ‘apple’, ‘orange’, ‘apple’,
‘orange’], the new data point will be classified as ‘apple’ since ‘apple’ is the majority.
5. Averaging for Regression:

- For regression tasks, the average of the K nearest neighbors' values is calculated and
assigned to the new data point.

Example of K-NN in Action

Imagine you have a dataset of fruits with features like weight and color intensity, and you
want to classify a new fruit.

1. Dataset:

- Apples: (150g, 8), (160g, 9), (170g, 8.5)

- Oranges: (180g, 5), (190g, 4.5), (200g, 5)

- New fruit: (155g, 7.5)

2. Choosing K:

- Let’s choose K=3.

3. Calculating Distances:

- Calculate the Euclidean distance from the new fruit to all points in the dataset.

\[

\text{distance to (150g, 8)} = \sqrt{(155-150)^2 + (7.5-8)^2} = \sqrt{5^2 + (-0.5)^2} =


\sqrt{25.25} \approx 5.02

\]

- Repeat for all other points.

4. Identifying Nearest Neighbors:

- Sort the distances and select the 3 nearest neighbors.

5. Voting:
- If the nearest neighbors are [(150g, 8), (160g, 9), (170g, 8.5)] which are all labeled as ‘apple’,
the new fruit is classified as an ‘apple’.

Advantages of K-NN

- Simplicity: Easy to understand and implement.

- No Training Phase: It's a lazy learning algorithm, meaning there’s no explicit training phase.
The computation is deferred until a prediction is needed.

Study Material
AI Concepto Labs

You might also like