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

ET 287 Unit1 Introduction

introduction to deep networks

Uploaded by

Felipe Baltor
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)
9 views

ET 287 Unit1 Introduction

introduction to deep networks

Uploaded by

Felipe Baltor
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/ 53

ET-287 – Signal Processing using Neural Networks

1. Introduction

Professor Sarah Negreiros de Carvalho Leite


Aeronautics Institute of Technology
Electronic Engineering Division
Department of Telecommunications
[email protected], [email protected]
room: 221
Presentation

Introduce yourself by addressing the following points:

● Academic background
● Current course and areas of specialization
● Interest in this discipline

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Course Plan

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Unit 1 - Introduction

In this unit, we will cover:

● Concepts definition.
● A brief review of linear algebra using Python.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Understanding the concepts

● Artificial Intelligence (AI)


● Machine Learning (ML)
● Artificial Neural Networks (ANN)
● Deep Learning (DL)

These encompass concepts and technologies that are increasingly present in our daily lives.

It is a challenge to find a scientific field that has not yet benefited from these technological
solutions.
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Timeline

Artificial Intelligence: aims to create machines and programs that make us


consider them intelligent.

Machine Learning: the ability of machines to


learn from provided data without being explicitly
programmed.

Deep Learning: learning based


on deep neural networks.

1950 1980 2006

Profa. Dra. Sarah Negreiros de Carvalho Leite.


A timeline on neural networks history

Source: https://sefiks.com/2017/10/14/evolution-of-neural-networks/
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Introduction

Every time we use a smartphone, we interact with technologies that emerge from these
concepts.
Example:
● Tracking and route suggestions,
● Profile and content recommendations on social networks,
● Product suggestions and online shopping sites,
● Among many other functionalities.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Introduction

Devices collect information about our use and our


behavior and the way we use programs and
applications.

The collected data is processed and provides


information that allows algorithms to 'learn' and make
predictions and inferences about our 'pattern' of use.

It is a powerful technology that allows you to solve


different types of problems.

It is important to be ‘literate’ in this world and


understand the basic concepts and how it works.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Example

Can you read the text?

De aorcdo com uma pqsieusa de uma uinrvesriddae ignlsea, não ipomtra


em qaul odrem as lrteas de uma plravaa etãso, a úncia csioa iprotmatne é
que a piremria e útmlia lrteas etejasm no lgaur crteo. O rseto pdoe ser
uma ttaol bçguana que vcoê pdoe andia ler sem pborlmea. Itso oorcre
pqorue nós não lmeos cdaa lrtea isladoa, mas a plravaa cmoo um tdoo.

Can a machine read?

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Example

Using Google Translator (Pt -> En -> Pt):

De acordo com um pqsieusa de um uinrvesriddae ígneo, não ipomtra no


qual os leites de um plravaa etérico odrem, a única razão iprotmatne é
que a piremyria e utmlia lrteas eteejasm no crteo lgaur. O texto pode ser
um texto confuso que você pode ler sem desfocar. É porque não a vemos
como uma ilha isolada, mas falamos dela como um todo.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Example

Using ChatGPT :

O texto que você forneceu está escrito da seguinte forma:

"De acordo com uma pesquisa de uma universidade inglesa, não importa
em qual ordem as letras de uma palavra estão, a única coisa importante é
que a primeira e última letras estejam no lugar certo. O resto pode ser
uma total bagunça que você pode ainda ler sem problema. Isso ocorre
porque nós não lemos cada letra isolada, mas a palavra como um todo."

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Example

What's missing for Google translator to be able to better translate the text?

De acordo com um pqsieusa de um De acordo com uma pesquisa de uma


uinrvesriddae ígneo, não ipomtra no universidade inglesa, não importa em
qual os leites de um plravaa etérico qual ordem as letras de uma palavra
odrem, a única razão iprotmatne é que a estão, a única coisa importante é que a
piremyria e utmlia lrteas eteejasm no primeira e última letras estejam no lugar
crteo lgaur. O texto pode ser um texto certo. O resto pode ser uma total
confuso que você pode ler sem desfocar. bagunça que você pode ainda ler sem
É porque não a vemos como uma ilha problema. Isso ocorre porque nós não
isolada, mas falamos dela como um lemos cada letra isolada, mas a palavra
todo. como um todo.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


How far can learning machines go?

The objective of AI is to enable machines to perform tasks that supposedly require


intelligence when done by humans:
● Be able to discuss and explain your knowledge to other people
● Extrapolate and contextualize concepts
● Being able to prepare criticisms and detect limitations
● Propose improvements
● Understand concepts
● Use the knowledge you have

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Example: Night guard
A night guard (NG) was doing his usual rounds when he noticed a man (M) kneeling next to a streetlight,
searching for something.

NG: “Did you lose something, sir?”


M: “Yes, I lost a bunch of keys.”
NG: “Do you have any idea where you lost them?”
M: “Yes, it was down at the end of the street, in the dark.”
NG: “But then why are you here, searching under this streetlight?”
M: “Because this is the only place where there is enough light for me to find it.”

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Turing Test (1950)

Sources: https://commons.wikimedia.org/wiki/File:Turing_Test_version_3.png#/media/File:Turing_Test_version_3.png,
https://commons.wikimedia.org/wiki/File:Alan_Turing_Aged_16.jpg#/media/File:Alan_Turing_Aged_16.jpg Alan Turing (1912 – 1954)
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Movie recommendation

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Chinese Room
Consider a room with a person unfamiliar with the Chinese language. In the
room, there are many baskets containing Chinese ideograms and a rule
book explaining how to combine them.

John Searle (1932) Source: https://commons.wikimedia.org/wiki/File:John_searle2.jpg#/media/Ficheiro:John_searle2.jpg

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Searle’s Room
The person then receives questions in
Chinese and, consulting the rule book,
combines the Chinese ideograms from the
baskets to create a new sequence that serves
as the answer.

This new sequence is then sent out of the


room by the person. Although this individual
doesn't know Chinese, they are responding to
the questions in the Chinese language.

Source: https://commons.wikimedia.org/wiki/File:2-chinese-room.jpg#/media/File:2-chinese-room.jpg

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Searle’s Room
Is there any difference between them and a
person who is proficient in the Chinese language
and answers the same questions without using
the rule book?

Yes!! The first one is merely following syntactic


rules without fully understanding what they are
doing.

The second one is associating semantics


(meaning) with what they are doing.

Source: https://commons.wikimedia.org/wiki/File:2-chinese-room.jpg#/media/File:2-chinese-room.jpg

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Searle’s Room
With this reasoning, Searle concluded that computers, being syntactic machines, can replace a person who is
unfamiliar with the Chinese language and follows rules.

However, they cannot replace the role of someone who knows the Chinese language and can add semantics to
the process.

Computers can execute formal or syntactic processes, but they cannot 'think' because thinking involves
semantics.

Searle asserts that computers can never be 'intelligent' because programs alone are not sufficient to attribute
minds to computers.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


What do you think about the points raised by Turing and Searle in the face of today's AI
advances?

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Machine Learning
A machine, particularly one based on digital computation, may not be considered intelligent, but it is possible
to make its behavior indistinguishable from intelligent behavior.

Machines with AI should be able to:

● Store knowledge,
● Apply it to solve problems,
● Acquire new knowledge through experience.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Human vs. Machine Learning

Do machines and humans learn in the same way?

What are the differences?

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Human vs. Machine Learning

Humans learn through a combination of experience, instruction, observation, imitation,


reflexion, and interaction with other people and with the environment.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Machine Learning
Machines primarily learn based on mathematical algorithms and data, without the ability
for human-like reflection or experience.

Machines extracting knowledge directly from available data, aiming to:

• Categorize them,
• Make predictions,
• Assist in decision-making,
• Detect faults,
• Perform diagnostics,
• Recognize patterns,
• Retrieve information,
• Etc.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Human vs. Machine Learning

Humans:

knowledge 
experience/observation/repetition/interaction/reflexion/…

Machines:

knowledge  data

Profa. Dra. Sarah Negreiros de Carvalho Leite.


A very brief review of linear algebra with Python

Before we begin the study of neural networks and machine learning algorithms, we will
provide a brief review of Python and of important concepts in Linear Algebra.

Typically, machine learning algorithms deal with a large amount of data organized in specific
forms or tables. To handle these algorithms, this information is often represented in the
form of matrices, with the types of values for a particular object placed in the columns and
individual entries in the rows.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


A very brief review of linear algebra with Python

Machine learning algorithms deal with a large


amount of data organized in specific forms or
tables. To handle these algorithms, this information
is often represented in the form of matrices, with
the types of values for a particular object placed in
the columns and individual entries in the rows.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Scalar

Scalar is a single numerical value belonging to the set of real numbers ℝ, for example, the
number 5.
𝑥 = 5.

𝑥 𝑖𝑓 𝑥 ≥ 0
The magnitude of a real scalar 𝑥 is given in the form: 𝑥 =
−𝑥 𝑖𝑓 𝑥 < 0

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Vector

Vector is a one-dimensional array of data. The vector can be a row or column. A vector with
𝑛 real numbers belongs to the domain ℝ𝑛 .
1
𝒗 = 1 2 3 - row vector 𝒘 = 2 - column vector
3
with 𝒗 = 𝒘𝑇 .

𝟎𝑛 ​ is the zero vector of dimension 𝑛, with all elements equal to zero.


𝟏𝑛 ​ is the vector of dimension 𝑛, with all elements equal to 1.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Matrix

Matrix is an array of data with 𝑚 rows and 𝑛 columns.


The matrix is said to have dimensions 𝑚x𝑛. If the matrix is composed of real numbers, then
it belongs to the domain ℝ𝑚𝑥𝑛 or 𝑿 ∈ ℝ𝑚𝑥𝑛 .

1 2 3
𝑿= 4 5 6
7 8 9

For matrices 𝑿 and 𝒀 of appropriate dimensions such that the product 𝑿𝒀 exists, we have
the following relationship: (𝑿𝒀)𝑇 = 𝒀𝑇 𝑿𝑇 .

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Special matrices
Identity Matrix (𝑰 𝒐𝒓 𝑰𝒏 ): square matrix with ones on the main diagonal and zeros elsewhere.
1 0 0
𝑰 = 𝑰𝟑 = 0 1 0
0 0 1

Diagonal Matrix: all off-diagonal elements are zero.


𝑎 0 0
𝑫= 0 𝑏 0
0 0 𝑐

Triangular Matrices: can be upper or lower triangular, with zeros below or above the main diagonal, respectively.
𝑎 𝑏 𝑐 𝑎 0 0
𝑼= 0 𝑑 𝑒 𝑳= 𝑏 𝑐 0
0 0 𝑓 𝑑 𝑒 𝑓

Sparse Matrix: with a significant number of zero elements.


𝑎 0 0
𝑺= 0 0 𝑐
𝑏 0 0

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Tensors

Tensors are arrays formed with 3 or more dimensions. The number of dimensions depends
on the object being modeled.

For example: In addition to data in the rows and columns of a matrix, you may need this data
at different points in time. To store this sequence of 2-D matrices, a 3-D structure is required.
A 3-D tensor has 𝑚 rows, 𝑛 columns, and depth k, with dimensions 𝑚x𝑛𝑥𝑘.

1 2 3 1 2 4
𝑡= 4 5 6 ⋱ 4 0 2
7 8 9 3 8 1

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Outer product

The outer product between two vectors 𝑥 ∈ ℝ𝑛 and y ∈ ℝ𝑚 is a matrix of dimensions 𝑛x𝑚
with a rank of one.
𝑇 𝑇
Given 𝒙 = 𝑥1 𝑥2 … 𝑥𝑛 and 𝒚 = 𝑦1 𝑦2 … 𝑦𝑚 the outer product is:

𝑥1 𝑦1 𝑥1 𝑦2 … 𝑥1 𝑦𝑚
𝑥 𝑦 𝑥2 𝑦2 … 𝑥2 𝑦𝑚
𝒙𝒚𝑇 = 2 1
⋮ ⋮ ⋱ ⋮
𝑥𝑛 𝑦1 𝑥𝑛 𝑦2 … 𝑥𝑛 𝑦𝑚

Observe that vectors 𝒙 and 𝒚 can have different dimensions.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Inner product
𝑇
The inner product between two vectors 𝒙, 𝒚 ∈ ℝ𝑛 , with 𝒙 = 𝑥1 𝑥2 … 𝑥𝑛 and
𝑇
𝒚 = 𝑦1 𝑦2 … 𝑦𝑛 is:

𝒙, 𝒚 = 𝑥𝑖 𝑦𝑖 = 𝒙𝑇 𝒚
𝑖=1
Properties:
1. 𝒙, 𝒚 = 𝒚, 𝒙
2. 𝒙 + 𝒚, 𝒛 = 𝒙, 𝒛 + 𝒚, 𝒛
3. 𝛼. 𝒙, 𝒚 = 𝛼. 𝒙, 𝒚
4. 𝒙, 𝒙 ≥ 0, ∀𝒙 ∈ ℝ𝑛
5. 𝒙, 𝒙 = 0 ⟺ 𝒙 = 𝟎
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Matrix x Vector

When you multiply a vector by a non-zero scalar, the direction of the vector remains
unchanged, only its magnitude is subject to change.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Matrix x vector

On the other hand, when you multiply a vector by a matrix, and here we restrict ourselves to square
matrices, it is possible to induce rotation and magnitude variation in the vector.

E.g. 3D rotation: 𝒗′ = 𝑹𝒗

If the vector is non-zero, there always exists a square matrix that maps any vector to any other vector in
the same vector space.
Figure source: http://motion.pratt.duke.edu/RoboticSystems/CoordinateTransformations.html
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Eigenvectors and eigenvalues

Now, given a fixed matrix and varying the vector, in the product between a square matrix and a vector,
there are vectors that a given matrix cannot rotate, promoting only the scaling of the vector.
These vectors are the eigenvectors of the matrix and the scaling is given by the corresponding
eigenvalue.

Figure source: http://motion.pratt.duke.edu/RoboticSystems/CoordinateTransformations.html


Profa. Dra. Sarah Negreiros de Carvalho Leite.
Eigenvectors and eigenvalues

Let 𝑨 ∈ ℝ𝑛𝑥𝑛 . A scalar 𝜆 ∈ ℂ is called an eigenvalue of 𝑨 if there exists a non-zero vector 𝒙 ∈ ℂ𝑛 , called
the associated eigenvector to 𝜆, such that:
𝑨𝒙 = 𝜆𝒙

or
(𝜆𝑰 − 𝑨)𝒙 = 𝟎

There exists 𝒙 ∈ ℂ𝑛 , 𝒙 ≠ 𝟎, if and only if det(𝜆𝑰 − 𝑨) = 0.

Δ(𝜆) ≜ det(𝜆𝑰 − 𝑨) is the characteristic polynomial of 𝑨.

Since the degree of Δ(𝜆) is 𝑛, the matrix 𝑨 has 𝑛 eigenvalues, not necessarily distinct.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Matrix x vector

For a rectangular matrix 𝑨 ∈ ℝ𝑚𝑥𝑛 , the result of the product belongs to the space spanned
by the columns of the matrix, because it is given by a linear combination of the columns of
the matrix and the product can be interpreted as a vector formed by the inner products
between each row of the matrix and the vector.

𝑎11 𝑎12 … 𝑎1𝑛 𝑥1 𝑎11 𝑎1𝑛 𝒂𝟏 𝑇 𝒙


𝑎 𝑎22 … 𝑎2𝑛 𝑥2 𝑎21 𝑎2𝑛 𝒂 𝑇
𝒙
𝑨𝒙 = 21 ⋮ = 𝑥1 ⋮ + ⋯ + 𝑥𝑛 ⋮ = 𝟐
⋮ ⋮ ⋱ ⋮ ⋮
𝑎𝑚1 𝑎𝑚2 … 𝑎𝑚𝑛 𝑥𝑛 𝑎𝑚1 𝑎𝑚𝑛 𝒂𝒎 𝑇 𝒙

𝑻
with 𝒂𝒊 = 𝑎𝑖1 𝑎𝑖2 … 𝑎𝑖𝑛 .

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Operations between matrices

Addition can only occur between matrices of the same dimension.


Addition is distributive:
𝐀 𝑩 + 𝑪 = 𝑨𝑩 + 𝑨𝑪
and
𝑨 + 𝑩 𝑪 = 𝑨𝑪 + 𝑩𝑪

Matrix product: to exist, it is necessary that the number of columns in the left matrix
coincides with the number of rows in the right matrix of the product.

Matrix multiplication is associative: 𝑨𝑩 𝑪 = 𝑨(𝑩𝑪)

Matrix multiplication is generally not commutative, even if both products exist, i.e.,
𝑨𝑩 ≠ 𝑩𝑨, although 𝑨𝑩 = 𝑩𝑨 can occur for specific pairs of matrices.
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Matrices
Consider a square matrix 𝑨 ∈ ℝ𝑛𝑥𝑛 .

Idempotent: It is said to be idempotent if 𝑨𝑟 = 𝑨. 𝑨. … . 𝑨 = 𝑨, for 𝑟 ≥ 1. If 𝑨 is idempotent, then 𝑰 − 𝑨 is also.


𝑟

Cofactor: the cofactor of the element 𝑎𝑖𝑗 with 𝑖, 𝑗 = 1, … , 𝑛 is given by:


𝑐𝑖𝑗 = (−1)𝑖+𝑗 𝑚𝑖𝑗
where 𝑚𝑖𝑗 is the determinant of the matrix formed by eliminating the i-th row and j-th column from matrix 𝑨.

Trace: the trace of 𝑨, represented by 𝑡𝑟(𝑨), is the sum of the elements on the diagonal of 𝑨, i.e.:
𝑛

𝑡𝑟 𝑨 = 𝑎𝑖𝑗
𝑖=1
The trace only applies to square matrices, and can be given by the sum of its eigenvalues.
For square matrices 𝑨 and 𝑩 of the same dimension, the property holds: 𝑡𝑟 𝑨𝑩 = 𝑡𝑟(𝑩𝑨).

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Matrices

𝑛
𝑖=1 𝑎𝑖𝑗 𝑐𝑖𝑗 for any 𝑗
Determinant: 𝑨 = 𝑑𝑒𝑡 𝑨 = 𝑛
𝑗=1 𝑎𝑖𝑗 𝑐𝑖𝑗 for any 𝑖

The determinant only applies to square matrices and can be given by the product of its
eigenvalues.

For square matrices 𝑨 and 𝑩 of the same dimension, the property holds:
det 𝑨𝑩 = det 𝑨 . det(𝑩)

If det 𝑨 = 0 The matrix 𝑨 is said to be singular.


A matrix 𝑨 has an inverse if and only if det 𝑨 ≠ 0 , that is, when 𝑨 is non-singular.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Matrices

The inverse of a matrix 𝑨 ∈ ℝ𝑛𝑥𝑛 is a matrix 𝑨−1 ∈ ℝ𝑛𝑥𝑛 such that:


𝑨𝑨−1 = 𝑨−1 𝑨 = 𝑰

For a matrix to be invertible, it must be square and non-singular.

Properties:

• 𝑨−1 𝑇 = 𝑨𝑇 −1
• 𝑨𝑩 −1 = 𝑩−1 𝑨−1 , considering that 𝑨 and 𝑩 have inverses.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Matrices
The pseudo-inverse of a matrix 𝑨 ∈ ℝ𝑛𝑥𝑛 is a matrix 𝑨+ ∈ ℝ𝑛𝑥𝑛 such that:

• 𝑨𝑨+ 𝑨 = 𝑨
• 𝑨+ 𝑨𝑨+ = 𝑨+
• 𝑨𝑨+ = 𝑨+ 𝑨 are symmetric matrices.
It can be demonstrated that there exists a unique pseudo-inverse for each matrix.

Properties:
• 𝑨+ =𝑨−1 , if 𝑨 is a square matrix and non singular
• 𝑨+ + = 𝑨
• 𝑨+ 𝑇 = 𝑨𝑇 +
• 𝑨𝑨+ 𝑇 = 𝑨𝑨+
• (𝛼𝑨)+ = 𝛼 −1 𝑨+, if 𝛼 ≠ 0
• 𝑨𝑨𝑇 𝑨+ 𝑇 = 𝑨 and 𝑨𝑇 𝑨𝑨+ = 𝑨𝑇
+
• 𝑨+ = (𝑨𝑇 𝑨)+ 𝑨𝑇 = 𝑨𝑇 𝑨𝑨𝑻
Profa. Dra. Sarah Negreiros de Carvalho Leite.
Tables and Matrices

Databases typically describe the characteristics of a particular problem in table format.


For instance, to describe each student in a class, we can create a table containing data such
as name, age, previous education, and grades for each assignment. By understanding this
data, we can propose analyses that generate new types of information, allowing us to make
generalizations and identify patterns among students.

Name Age Education Grade 1 Grade 2

Ane 33 Engineering 9.1 9.5

John 27 Computer Science 9.0 8.6

Mary 45 Administration 8.5 9.7

Peter 26 Engineering 6.5 7.8

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Tables and Matrices

We can work with tables using the Pandas library or we can place the useful information in a
matrix and work with the NumPy library.

1 33 1 9.1 9.5
2 27 2 9.0 8.6
Name Age Education Grade 1 Grade 2 3 45 3 8.5 9.7
4 26 1 6.5 7.8
Ane 33 Engineering 9.1 9.5

John 27 Computer Science 9.0 8.6

Mary 45 Administration 8.5 9.7

Peter 26 Engineering 6.5 7.8

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Advantages of vectorization

Data vectorization implies efficiency in processing and saves algorithm execution time.

● Concise and more readable code.


● Reduced debugging time due to fewer lines of code.
● Reduced number of loops.

Now, let's see how to manipulate arrays in NumPy.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Exercise 1 – Iris Flower Species
1. Download the dataset: Iris flower dataset
available in sklearn.

2. Visualize the shape of the matrix.

3. Find the maximum, minimum, mean and


standard deviation values for each variable.

4. How many samples are there for each flower species?

5. Find the maximum, minimum, mean and standard deviation values for each variable of each species.

6. Are there missing data? Are the data consistent with the expected dimensions? Are there outliers? Is the database
balanced? Visualize the data through boxplots.

7. Plot the average values for each flower species and the overall average, considering the length of petals and sepals.

8. Plot the heatmap and analyze the correlation between variables.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Exercise 2 - California house-prices

1. Download the dataset: California house-prices available in Sklearn.


2. Visualize the shape of the matrix.
3. Find the maximum and minimum values for each variable.
4. Find the mean and standard deviation for each variable.
5. How many houses have more than 3 bedrooms?
6. Are the data consistent? For example, is the number of rooms always greater than or
equal to the number of bedrooms?

For those who had difficulty with Exercise 1.


Try doing Exercise 2 on your own.

Profa. Dra. Sarah Negreiros de Carvalho Leite.


Project 1

Combining linear algebra, Python and wines!!!

Profa. Dra. Sarah Negreiros de Carvalho Leite.

You might also like