From BasicToAdvanced-FFN, Neuron, Activation Function.pdf
1. Introduction to Artificial Intelligence
Disclaimer: The content is curated for educational purposes only.
Introduction to Artificial Intelligence
2. Introduction to Artificial Intelligence
Learning Objectives
You will learn in this lesson:
• Users will gain an understanding of fundamental concepts of
AI
• Users will acquire knowledge and skills to analyze data.
5. Introduction to Artificial Intelligence
Artificial Intelligence (AI) is a field of computer science that aims to create machines capable of
emulating human intelligence, enabling them to perform tasks like problem-solving and learning from
data.
Artificial Intelligence
6. Introduction to Artificial Intelligence
Generative AI refers to artificial intelligence systems that have the ability to create new data, such as
text, images, or other content, often mimicking human-like creativity and generation.
• Content Generation
• Creative Capabilities
• Applications
• Models
• Potential for Misuse
Generative AI
7. Introduction to Artificial Intelligence
Discriminative AI specializes in classifying and predicting data based on learned patterns, but it
doesn't generate new content.
• Classification and Prediction
• Data-Driven
• Not Creative
• Widely Used
Discriminative AI
8. Introduction to Artificial Intelligence
Hands-on 2: Demo on Lobe
Lobe AI is a tool that allows you to create machine learning models without the need for extensive
programming knowledge. It focuses on making machine learning more accessible to a broader
audience, including those who may not be familiar with traditional coding or data science techniques
▪ User-Friendly Interface
▪ No Coding Required
▪ Image and Data Classification
▪ Customizable Models
▪ Export Options
▪ Support for TensorFlow
▪ Community and Resources
About Lobe AI:
9. Introduction to Artificial Intelligence
Disclaimer: The content is curated for educational purposes only.
Exploratory Data Analysis (EDA)
10. Introduction to Artificial Intelligence
What is EDA?
• Exploratory data analysis (EDA) involves using graphics and visualizations to explore and analyse a data
set. The goal is to explore, investigate and learn, as opposed to confirming statistical hypotheses.
• The process of using numerical summaries and visualizations to explore your data and to identify
potential relationships between variables is called exploratory data analysis, or EDA.
Reference link
Click here
12. Introduction to Artificial Intelligence
Univariate Analysis
• Univariate analysis examines a single variable's properties, whether quantitative (e.g., numerical) or
categorical (e.g., qualitative).
• It provides insights into the distribution, central tendency, and variability of the variable, using statistical
measures and graphical representations.
• Univariate analysis is an essential initial step in data exploration and hypothesis testing, focusing solely on
one variable without considering relationships with other variables.
13. Introduction to Artificial Intelligence
Bivariate Analysis
• Explains how two variables are related.
• Bivariate analysis is a crucial step in data analysis, allowing for a deeper understanding of the interplay
between two variables before moving to more complex multivariate analysis.
Multivariate Analysis
• Involves the simultaneous examination of three or more variables to uncover complex relationships and
interactions among them.
• It employs various statistical methods to gain a deeper understanding of how multiple variables collectively
influence data patterns.
14. Introduction to Artificial Intelligence
What are Outliers?
“A celebrity in the crowd of commoners is an outlier”
Reference link
Click here
15. Introduction to Artificial Intelligence
What are Outliers?
We all have heard of the idiom ‘odd one out which means something unusual in comparison to the
others in a group. Similarly, an Outlier is an observation in a given dataset that lies far from the rest of
the observations. That means an outlier is vastly larger or smaller than the remaining values in the
set.
Why do they occur?
An outlier may occur due to the variability in the data, or due to experimental error/human error.
They may indicate an experimental error or heavy skewness in the data(heavy-tailed distribution).
16. Introduction to Artificial Intelligence
Many tools are available in the market, which make it easier for us:
1. To process and manipulate data
2. Analyse the relationships and correlations between data sets,
3. Helps to identify patterns and trends for interpretation
Data Analysis Tools
17. Introduction to Artificial Intelligence
Hands-on 3: EDA Pre-Processing (NumPy)
Pre-processing involves getting the data into a suitable format for analysis. This step ensures that
the data is accurate, complete, and ready for modeling.
▪ Data Cleaning
▪ Data Transformation
▪ Feature Engineering
▪ Handling Missing Values
▪ Encoding Categorical Variables
▪ Dealing with Outliers
▪ Data Splitting
19. Introduction to Artificial Intelligence
What is Pandas?
1. Pandas is a Python library used for working with data sets (csv, json..,etc).
2. It has functions for
1. analyzing,
2. cleaning,
3. exploring,
4. and manipulating data.
3. The name "Pandas" has a reference to both "Panel Data", and "Python Data Analysis" and
was created by Wes McKinney in 2008.
20. Introduction to Artificial Intelligence
Why Use Pandas?
1. Pandas allows us to analyze big data.
2. It makes conclusions based on statistical theories operations
3. Pandas can clean messy data sets(in a larger size)
4. Pandas helps us to convert readable
5. Helps to find the relevant information from big data.
21. Introduction to Artificial Intelligence
What Can Pandas Do?
We can find the,
• Correlation between two or more columns
• We can find basic descriptive analysis
1. Mean
2. Median
3. Std
4. IQR (Inter Quartile Range)
5. Find Max value & Min value?
22. Introduction to Artificial Intelligence
Environmental Setup
Installation of Pandas
Windows
pip install pandas
or
conda install pandas
Linux
pip3 install pandas
23. Introduction to Artificial Intelligence
Series
Pandas Series - Name
Pandas Series - Index
Pandas Series - Values
Create a simple Pandas Series from a list:
24. Introduction to Artificial Intelligence
Series
Pandas Series - Name
Pandas Series – Index – [0,1,…etc] / we can give any name as label for
index.
Pandas Series - Values
Create the label Pandas Series
26. Introduction to Artificial Intelligence
DataFrames
A Series is essentially a column, and a DataFrame is a multi-dimensional table made up of a collection
of Series.
28. Introduction to Artificial Intelligence
DataFrames
Named Indexes – Data Frame
apples oranges
day1 420 50
day2 380 40
day3 390 45
29. Introduction to Artificial Intelligence
DataFrames
Locate Named Indexes– Data Frame
#refer to the named index:
print(df.loc["day2"])
Output:
apples 380
oranges 40
Name: 0, dtype:
int64
32. Introduction to Artificial Intelligence
Read CSV Files
import pandas as pd
df = pd.read_csv('data.csv')
print(df.to_string())
1. A simple way to store big data sets is to use CSV files (comma separated files).
2. CSV files contains plain text and is a well know format that can be read by everyone
including Pandas.
3. In our examples we will be using a CSV file called 'data.csv’.
33. Introduction to Artificial Intelligence
Read JSON file
import pandas as pd
df = pd.read_json('data.json')
print(df.to_string())
JSON is plain text which is written in JavaScript object natation. This file has .json as its extension, with the
data inside it represented in a key:value pair.
In our examples we will be using a JSON file called 'data.json'.
34. Introduction to Artificial Intelligence
Indexing in Pandas
An index is like an address, that’s how any data point across the data frame or series can be
accessed. Rows and columns both have indexes, rows indices are called index, and columns by
its general column names.
• .loc is used for labels
• .iloc is used for position numbers
Let us assume Geeta, Mahima & Shruti are standing at positions 1, 2, & 3, respectively. If you
want to call Mahima, you have two options, either you call her by her name or her position
number. So, if you call Mahima by her name “Mahima”, you will use .loc and if we will call her by
her position number “2” we will use .iloc.
36. Introduction to Artificial Intelligence
Conditional Selection
For example, suppose that we're interested specifically in better-than-average wines produced in
Italy. We can start by checking if each wine is Italian or not:
37. Introduction to Artificial Intelligence
Conditional Selection
This operation produced a Series of True/False booleans based on the country of each
record. This result can then be used inside of loc to select the relevant data:
reviews.loc[reviews.country == 'Italy']
38. Introduction to Artificial Intelligence
Conditional Selection
We can use the ampersand (&) to bring the two questions together:
reviews.loc[(reviews.country == 'Italy') & (reviews.points >= 90)]
39. Introduction to Artificial Intelligence
Pandas – Data Handling
The data set contains some empty cells ("Date" in row
22, and "Calories" in row 18 and 28).
The data set contains wrong format ("Date" in row 26).
40. Introduction to Artificial Intelligence
Pandas – Data Handling
Remove Rows: One way to deal with empty cells is to remove rows that contain empty cells.
41. Introduction to Artificial Intelligence
Pandas – Data Handling
Remove all rows with NULL values using inplace parameter
42. Introduction to Artificial Intelligence
Pandas – Data Handling
Replace Empty Values: The fillna() method allows us to replace empty cells with a value:
43. Introduction to Artificial Intelligence
Pandas – Data Handling
Replace Using Mean, Median, or Mode: Pandas uses the mean() median() and mode() methods to
calculate the respective values for a specified column. Calculate the MEAN and replace any empty values.
44. Introduction to Artificial Intelligence
Pandas – Data Handling
Finding Relationships: A great aspect of the Pandas module is the corr() method. The corr()
method calculates the relationship between each column in your data set.
45. Introduction to Artificial Intelligence
Pandas – Data Handling
Discovering Duplicates: Duplicate rows are rows that have been registered more than one time. The
duplicated() method returns a Boolean values for each row. Returns True for every row that is a
duplicate, otherwise False
46. Introduction to Artificial Intelligence
Lab 4 – EDA- Univariate, Bivariate and Multivariate Analysis (Pandas)
Data Analysis (EDA) is a crucial step in the data analysis process. It involves examining and visualizing data to
understand its underlying patterns, relationships, and characteristics. EDA can be divided into three main
categories: Univariate, Bivariate, and Multivariate analysis.
47. Introduction to Artificial Intelligence
What is Data Visualization?
Data visualization deals with a visual
representation of data and is part of data analysis.
It is the process of translating data into a chart,
graph, or other visual components.
Reference link
Click here
48. Introduction to Artificial Intelligence
Plotting and Visualization
Data visualization packages and tools are required to provide an accessible
way to analyze massive amounts of information and understand trends and
patterns in data.
49. Introduction to Artificial Intelligence
Matplotlib
Matplotlib is one of the most popular Python packages used for data visualization. It is a cross-
platform library for making 2D plots from data in arrays.
50. Introduction to Artificial Intelligence
Line Plot
According to the wiki,
“A line chart or line plot or line graph
is a type of chart which displays
information as a series of data points
called ‘markers’ connected by straight
line segments. It is a basic type of
chart common in many fields”
Reference link
Click here
51. Introduction to Artificial Intelligence
Bar Plot
A bar chart or bar graph is a chart or graph that
presents categorical data with rectangular bars with
heights or lengths proportional to the values that
they represent. The bars can be plotted vertically or
horizontally.
Syntax:
ax.bar(x, height, width, bottom, align)
plt.bar(x,y)
52. Introduction to Artificial Intelligence
Scatter Plot
A scatter plot is a diagram where each value in
the data set is represented by a dot.
Use the scatter() method to draw a scatter plot
diagram:
Syntax:
plt.scatter(x, y)
53. Introduction to Artificial Intelligence
3-D Plotting in Matplotlib
• Three-dimensional plots are enabled by importing
the mplot3d toolkit, included with the main Matplotlib
installation:
• from mpl_toolkits import mplot3d
• Syntax:
plt.plot3D()
Reference link
Click here
54. Introduction to Artificial Intelligence
Pie Chart
• Matplotlib API has pie() function in
its pyplot module which creates a pie chart
representing the data in an array.
• Syntax:
plt.pie(data)
Reference link
Click here
55. Introduction to Artificial Intelligence
Hands-on 5 – EDA- Descriptive Analysis with Visualization
Exploratory Data Analysis (EDA) involves examining and visualizing data to gain insights and understand its
underlying patterns. It's an essential step in the data analysis process. Here's a breakdown of how to perform
EDA with descriptive analysis and visualization
57. Introduction to Artificial Intelligence
Summary
• AI leverages advanced algorithms to automate data analysis and decision-making.
• EDA provides the foundational insights needed for AI models.
• Together, AI and EDA empower organizations to efficiently process and gain valuable insights from
large datasets, leading to data-driven decision-making.
58. Introduction to Artificial Intelligence
Quiz
1. Which subfield of AI focuses on developing algorithms that allow computers to learn
from and make predictions or decisions based on data?
a) Machine learning
b) Natural language processing
c) Robotics
d) Computer vision
Answer: a) Machine learning
59. Introduction to Artificial Intelligence
Quiz
2. What is the primary goal of Artificial Intelligence (AI)?
a) To create machines that can think and behave like humans
b) To automate tasks and improve efficiency
c) To develop advanced algorithms for data analysis
d) To simulate natural processes and phenomena
Answer: b) To automate tasks and improve efficiency
60. Introduction to Artificial Intelligence
3. What is the difference between narrow or weak AI and general or strong AI?
a) Narrow AI can perform specific tasks, while general AI can understand and perform any
intellectual task that a human being can do.
b) Narrow AI is less efficient than general AI in problem-solving.
c) Narrow AI is more expensive to develop than general AI.
d) Narrow AI is based on rule-based systems, while general AI uses neural networks.
Answer: a) Narrow AI can perform specific tasks, while general AI can understand and
perform any intellectual task that a human being can do.
Quiz