ET 287 Unit1 Introduction
ET 287 Unit1 Introduction
1. Introduction
● Academic background
● Current course and areas of specialization
● Interest in this discipline
● Concepts definition.
● A brief review of linear algebra using Python.
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
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.
Using ChatGPT :
"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."
What's missing for Google translator to be able to better translate the text?
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
Source: https://commons.wikimedia.org/wiki/File:2-chinese-room.jpg#/media/File:2-chinese-room.jpg
Source: https://commons.wikimedia.org/wiki/File:2-chinese-room.jpg#/media/File:2-chinese-room.jpg
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.
● Store knowledge,
● Apply it to solve problems,
● Acquire new knowledge through experience.
• Categorize them,
• Make predictions,
• Assist in decision-making,
• Detect faults,
• Perform diagnostics,
• Recognize patterns,
• Retrieve information,
• Etc.
Humans:
knowledge
experience/observation/repetition/interaction/reflexion/…
Machines:
knowledge data
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.
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
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 𝒗 = 𝒘𝑇 .
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: (𝑿𝒀)𝑇 = 𝒀𝑇 𝑿𝑇 .
Triangular Matrices: can be upper or lower triangular, with zeros below or above the main diagonal, respectively.
𝑎 𝑏 𝑐 𝑎 0 0
𝑼= 0 𝑑 𝑒 𝑳= 𝑏 𝑐 0
0 0 𝑓 𝑑 𝑒 𝑓
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
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 … 𝑥𝑛 𝑦𝑚
𝒙, 𝒚 = 𝑥𝑖 𝑦𝑖 = 𝒙𝑇 𝒚
𝑖=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.
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.
Let 𝑨 ∈ ℝ𝑛𝑥𝑛 . A scalar 𝜆 ∈ ℂ is called an eigenvalue of 𝑨 if there exists a non-zero vector 𝒙 ∈ ℂ𝑛 , called
the associated eigenvector to 𝜆, such that:
𝑨𝒙 = 𝜆𝒙
or
(𝜆𝑰 − 𝑨)𝒙 = 𝟎
Since the degree of Δ(𝜆) is 𝑛, the matrix 𝑨 has 𝑛 eigenvalues, not necessarily distinct.
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.
𝑻
with 𝒂𝒊 = 𝑎𝑖1 𝑎𝑖2 … 𝑎𝑖𝑛 .
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 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 𝑨 ∈ ℝ𝑛𝑥𝑛 .
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: 𝑡𝑟 𝑨𝑩 = 𝑡𝑟(𝑩𝑨).
𝑛
𝑖=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(𝑩)
Properties:
• 𝑨−1 𝑇 = 𝑨𝑇 −1
• 𝑨𝑩 −1 = 𝑩−1 𝑨−1 , considering that 𝑨 and 𝑩 have inverses.
• 𝑨𝑨+ 𝑨 = 𝑨
• 𝑨+ 𝑨𝑨+ = 𝑨+
• 𝑨𝑨+ = 𝑨+ 𝑨 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
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
Data vectorization implies efficiency in processing and saves algorithm execution time.
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.