SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
Talk: Hack Linear Algebra with Python for Deep Neural Network
Speaker: Chetan Khatri, Department of Computer Science, University of
Kachchh alumnus.
Lead - Technology, Accionlabs Inc.
In [1]:
from IPython.display import Image
In [2]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-24-40.png")
In [3]:
Image(filename="/home/chetan/Downloads/screenshot-towardsdatascience.com-2018-01
-13-07-49-05-835.png")
common linear algebra operations used in Neural Network
Out[2]:
Out[3]:
Say What ? Linear Algebra for Neural Network
In the context of deep learning / Neural network, linear algebra is a mathematical toolbox that offers helpful
techniques for manipulating groups of numbers simultaneously. It provides structures like vectors and
matrices (spreadsheets) to hold these numbers and new rules for how to add, subtract, multiply, and divide
them.
Why is it useful?
It turns complicated problems into simple, intuitive, efficiently calculated problems. Here is an example of
how linear algebra can achieve greater speed and simplicity.
In [4]:
import numpy as np
In [5]:
# Multiply two arrays
x = [1,2,3]
y = [2,3,4]
product = []
for i in range(len(x)):
product.append(x[i]*y[i])
print product
In [6]:
# Linear algebra version
x = np.array([1,2,3])
y = np.array([2,3,4])
x * y
After initializing the arrays, the linear algebra approach was 3x faster.
How is it used in Artificial Neural Network / deep learning ?
Neural networks store weights in matrices. Linear algebra makes matrix operations fast and easy, especially
when training on GPUs. In fact, GPUs were created with vector and matrix operations in mind. Similar to how
images can be represented as arrays of pixels, video games generate compelling gaming experiences using
enormous, constantly evolving matrices. Instead of processing pixels one-by-one, GPUs manipulate entire
matrices of pixels in parallel.
Vectors
[2, 6, 12]
Out[6]:
array([ 2, 6, 12])
Vectors are 1-dimensional arrays of numbers or terms. In geometry, vectors store the magnitude and
direction of a potential change to a point. The vector [3, -2] says go right 3 and down 2. A vector with more
than one dimension is called a matrix.
Vector -> is arrow pointing in a space. What defines a vector: length and direction it's pointing, as long as
length and direction are same you can move all around.
Vectors in geometry
In [7]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-36-32.png")
Out[7]:
In [8]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-36-36.png")
In [9]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-36-42.png")
Out[8]:
Out[9]:
In [10]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-39-55.png")
In [11]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-39-53.png")
Vector lives in flat plane is 2 dimensional.
Out[10]:
Out[11]:
In [12]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-41-09.png")
If vector sits in broader space where you and I leave they are 3 Dimensional.
In [13]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-46-00.png")
vector addition & vector multiplication plays important role in linear algebra
positive numbers indicating rightward and upward motion negative numbers indicating leftward and
downward motion
Out[12]:
Out[13]:
Every pair of number gives 1 and only 1 vector. And every vector is associated with 1 and only 1 pair of
number.
3 Dimensions - Z
Z - Parpendicular to both X & Y axis, which orders triplet numbers.
[2 1 3] Move along to how far to X axis. How far to move parellel to Y axis. How far to move parellel to Z axis
In Brief: Vectors typically represent movement from a point. They store both the magnitude and direction of
potential changes to a point. The vector [-2,5] says move left 2 units and up 5 units.
A vector can be applied to any point in space. The vector’s direction equals the slope of the hypotenuse
created moving up 5 and left 2. Its magnitude equals the length of the hypotenuse.
What's going on to space & Ask computer to figure it out numerically.
Scalar operations
Scalar operations involve a vector and a number. You modify the vector in-place by adding, subtracting, or
multiplying the number from all the values in the vector.
Examples: Streaching vector by scalar, Scaling Vector by scalar, Squash in vector by Scalar, Shear vector in
plane geometry
In [14]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-51-02.png")
Out[14]:
In [15]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-30.png")
In [16]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-33.png")
Out[15]:
Out[16]:
In [17]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-40.png")
In [18]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-41.png")
Out[17]:
Out[18]:
In [19]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-53-00.png")
In [20]:
Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-53-17.png")
Span: What does the span of two 3d vectors look like ?
All possible linear combination of two vectors. If one vector is already span of other then it's called "Linearly
dependent" for some values of a and b. Each vector adds another dimension to span that's "Linearly
independent" w /= av for all values of a.
Out[19]:
Out[20]:
Basis The basis of a vector space is a set of linearly independent vectors that span the full space. The word
"transformation" suggests that you think using "Movement"
Transformation is linear: If all lines must remain lines, origin remains fixed. Not linear: Some lines get
curved, grid lines remain parellel and evenly spaced.
Elementwise operations
In [21]:
Image(filename="/home/chetan/Music/images/1_g7cc0GkA7xrkhoh-__Ok3g.png")
In elementwise operations like addition, subtraction, and division, values that correspond positionally are
combined to produce a new vector. The 1st value in vector A is paired with the 1st value in vector B. The 2nd
value is paired with the 2nd, and so on. This means the vectors must have equal dimensions to complete the
operation.*
In [22]:
Image(filename="/home/chetan/Music/images/2.png")
In [23]:
y = np.array([1,2,3])
x = np.array([2,3,4])
In [24]:
y + x
Out[21]:
Out[22]:
Out[24]:
array([3, 5, 7])
In [25]:
y - x
In [26]:
y / x
Vector multiplication
There are two types of vector multiplication: Dot product and Hadamard product.
Dot product
The dot product of two vectors is a scalar. Dot product of vectors and matrices (matrix multiplication) is one of
the most important operations in deep learning.
In [27]:
Image(filename="/home/chetan/Music/images/3.png")
In [28]:
y = np.array([1,2,3])
x = np.array([2,3,4])
In [29]:
np.dot(y,x)
Hadamard product
Hadamard Product is elementwise multiplication and it outputs a vector.
Out[25]:
array([-1, -1, -1])
Out[26]:
array([0, 0, 0])
Out[27]:
Out[29]:
20
In [30]:
Image(filename="/home/chetan/Music/images/4.png")
In [31]:
y = np.array([1,2,3])
x = np.array([2,3,4])
In [32]:
y * x
Vector fields
A vector field shows how far the point (x,y) would hypothetically move if we applied a vector function to it like
addition or multiplication. Given a point in space, a vector field shows the power and direction of our
proposed change at a variety of points in a graph.
In [33]:
Image(filename="/home/chetan/Music/images/5.png")
Matrices
A matrix is a rectangular grid of numbers or terms (like an Excel spreadsheet) with special rules for addition,
subtraction, and multiplication.
Out[30]:
Out[32]:
array([ 2, 6, 12])
Out[33]:
Matrix dimensions
We describe the dimensions of a matrix in terms of rows by columns.
In [34]:
Image(filename="/home/chetan/Music/images/6.png")
In [35]:
a = np.array([
[1,2,3],
[4,5,6]
])
In [36]:
a.shape
In [37]:
b = np.array([
[1,2,3]
])
In [38]:
b.shape
Matrix scalar operations
Scalar operations with matrices work the same way as they do for vectors. Simply apply the scalar to every
element in the matrix—add, subtract, divide, multiply, etc.
Out[34]:
Out[36]:
(2, 3)
Out[38]:
(1, 3)
In [39]:
Image(filename="/home/chetan/Music/images/7.png")
In [40]:
a = np.array(
[[1,2],
[3,4]])
In [41]:
a + 1
Matrix elementwise operations
In order to add, subtract, or divide two matrices they must have equal dimensions.* We combine
corresponding values in an elementwise fashion to produce a new matrix.
In [42]:
Image(filename="/home/chetan/Music/images/8.png")
In [43]:
a = np.array([
[1,2],
[3,4]
])
b = np.array([
[1,2],
[3,4]
])
Out[39]:
Out[41]:
array([[2, 3],
[4, 5]])
Out[42]:
In [44]:
a + b
In [45]:
a - b
Numpy broadcasting*
In numpy the dimension requirements for elementwise operations are relaxed via a mechanism called
broadcasting. Two matrices are compatible if the corresponding dimensions in each matrix (rows vs rows,
columns vs columns) meet the following requirements:
1. The dimensions are equal, or
2. One dimension is of size 1
In [46]:
a = np.array([
[1],
[2]
])
b = np.array([
[3,4],
[5,6]
])
c = np.array([
[1,2]
])
In [47]:
# Same no. of rows
# Different no. of columns
# but a has one column so this works
a * b
Out[44]:
array([[2, 4],
[6, 8]])
Out[45]:
array([[0, 0],
[0, 0]])
Out[47]:
array([[ 3, 4],
[10, 12]])
In [48]:
# Same no. of columns
# Different no. of rows
# but c has one row so this works
b * c
In [49]:
# Different no. of columns
# Different no. of rows
# but both a and c meet the
# size 1 requirement rule
a + c
Things get weirder in higher dimensions—3D, 4D, but for now we won’t worry about that. Understanding 2D
operations is a good start.
Matrix Hadamard product
Hadamard product of matrices is an elementwise operation. Values that correspond positionally are
multiplied to produce a new matrix.
In [50]:
Image(filename="/home/chetan/Music/images/9.png")
Out[48]:
array([[ 3, 8],
[ 5, 12]])
Out[49]:
array([[2, 3],
[3, 4]])
Out[50]:
In [51]:
a = np.array(
[[2,3],
[2,3]])
b = np.array(
[[3,4],
[5,6]])
# Uses python's multiply operator
a * b
In numpy you can take the Hadamard product of a matrix and vector as long as their dimensions meet the
requirements of broadcasting.
In [52]:
Image(filename="/home/chetan/Music/images/10.png")
Matrix transpose
Neural networks frequently process weights and inputs of different sizes where the dimensions do not meet
the requirements of matrix multiplication. Matrix transpose provides a way to “rotate” one of the matrices so
that the operation complies with multiplication requirements and can continue. There are two steps to
transpose a matrix: Rotate the matrix right 90° Reverse the order of elements in each row (e.g. [a b c]
becomes [c b a]) As an example, transpose matrix M into T:
Out[51]:
array([[ 6, 12],
[10, 18]])
Out[52]:
In [53]:
Image(filename="/home/chetan/Music/images/11.png")
In [54]:
a = np.array([
[1, 2],
[3, 4]])
a.T
Matrix multiplication
Matrix multiplication specifies a set of rules for multiplying matrices together to produce a new matrix.
Rules
Not all matrices are eligible for multiplication. In addition, there is a requirement on the dimensions of the
resulting matrix output.
1. The number of columns of the 1st matrix must equal the number of rows of the 2nd
2. The product of an M x N matrix and an N x K matrix is an M x K matrix. The new matrix takes the
rows of the 1st and columns of the 2nd
Steps
Matrix multiplication relies on dot product to multiply various combinations of rows and columns.
Out[53]:
Out[54]:
array([[1, 3],
[2, 4]])
In [57]:
Image(filename="/home/chetan/Music/images/12.png")
The operation a1 · b1 means we take the dot product of the 1st row in matrix A (1, 7) and the 1st column in
matrix B (3, 5).
In [58]:
Image(filename="/home/chetan/Music/images/13.png")
Here’s another way to look at it:
In [59]:
Image(filename="/home/chetan/Music/images/14.png")
Test yourself with these examples
Out[57]:
Out[58]:
Out[59]:

Más contenido relacionado

La actualidad más candente

Computer Vision: Correlation, Convolution, and Gradient
Computer Vision: Correlation, Convolution, and GradientComputer Vision: Correlation, Convolution, and Gradient
Computer Vision: Correlation, Convolution, and GradientAhmed Gad
 
K means clustering
K means clusteringK means clustering
K means clusteringkeshav goyal
 
A Correlative Information-Theoretic Measure for Image Similarity
A Correlative Information-Theoretic Measure for Image SimilarityA Correlative Information-Theoretic Measure for Image Similarity
A Correlative Information-Theoretic Measure for Image SimilarityFarah M. Altufaili
 
Image recogonization
Image recogonizationImage recogonization
Image recogonizationSANTOSH RATH
 
digital image processing, image processing
digital image processing, image processingdigital image processing, image processing
digital image processing, image processingKalyan Acharjya
 
Visualizing the Model Selection Process
Visualizing the Model Selection ProcessVisualizing the Model Selection Process
Visualizing the Model Selection ProcessBenjamin Bengfort
 
Wordoku Puzzle Solver - Image Processing Project
Wordoku Puzzle Solver - Image Processing ProjectWordoku Puzzle Solver - Image Processing Project
Wordoku Puzzle Solver - Image Processing ProjectSurya Chandra
 
07 dimensionality reduction
07 dimensionality reduction07 dimensionality reduction
07 dimensionality reductionMarco Quartulli
 
Dimensionality reduction
Dimensionality reductionDimensionality reduction
Dimensionality reductionShatakirti Er
 
Design and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation AlgorithmsDesign and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation AlgorithmsAjay Bidyarthy
 

La actualidad más candente (17)

Computer Vision: Correlation, Convolution, and Gradient
Computer Vision: Correlation, Convolution, and GradientComputer Vision: Correlation, Convolution, and Gradient
Computer Vision: Correlation, Convolution, and Gradient
 
Fuzzy c means manual work
Fuzzy c means manual workFuzzy c means manual work
Fuzzy c means manual work
 
PCA and SVD in brief
PCA and SVD in briefPCA and SVD in brief
PCA and SVD in brief
 
K means clustering
K means clusteringK means clustering
K means clustering
 
A Correlative Information-Theoretic Measure for Image Similarity
A Correlative Information-Theoretic Measure for Image SimilarityA Correlative Information-Theoretic Measure for Image Similarity
A Correlative Information-Theoretic Measure for Image Similarity
 
Principal component analysis
Principal component analysisPrincipal component analysis
Principal component analysis
 
Lda
LdaLda
Lda
 
Pca ankita dubey
Pca ankita dubeyPca ankita dubey
Pca ankita dubey
 
Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
 
Image recogonization
Image recogonizationImage recogonization
Image recogonization
 
digital image processing, image processing
digital image processing, image processingdigital image processing, image processing
digital image processing, image processing
 
Visualizing the Model Selection Process
Visualizing the Model Selection ProcessVisualizing the Model Selection Process
Visualizing the Model Selection Process
 
Wordoku Puzzle Solver - Image Processing Project
Wordoku Puzzle Solver - Image Processing ProjectWordoku Puzzle Solver - Image Processing Project
Wordoku Puzzle Solver - Image Processing Project
 
07 dimensionality reduction
07 dimensionality reduction07 dimensionality reduction
07 dimensionality reduction
 
Understandig PCA and LDA
Understandig PCA and LDAUnderstandig PCA and LDA
Understandig PCA and LDA
 
Dimensionality reduction
Dimensionality reductionDimensionality reduction
Dimensionality reduction
 
Design and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation AlgorithmsDesign and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation Algorithms
 

Similar a Hack Linear Algebra with Python for Deep Neural Network

vector application
vector applicationvector application
vector applicationrajat shukla
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfUmarMustafa13
 
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxPremanandS3
 
Metric-learn, a Scikit-learn compatible package
Metric-learn, a Scikit-learn compatible packageMetric-learn, a Scikit-learn compatible package
Metric-learn, a Scikit-learn compatible packageWilliam de Vazelhes
 
Matrix algebra in_r
Matrix algebra in_rMatrix algebra in_r
Matrix algebra in_rRazzaqe
 
Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...
Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...
Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...ZaidHussein6
 
8. Vectors data frames
8. Vectors data frames8. Vectors data frames
8. Vectors data framesExternalEvents
 
Matlab solved problems
Matlab solved problemsMatlab solved problems
Matlab solved problemsMake Mannan
 
SessionFour_DataTypesandObjects
SessionFour_DataTypesandObjectsSessionFour_DataTypesandObjects
SessionFour_DataTypesandObjectsHellen Gakuruh
 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoSeongwon Hwang
 
Deep Residual Hashing Neural Network for Image Retrieval
Deep Residual Hashing Neural Network for Image RetrievalDeep Residual Hashing Neural Network for Image Retrieval
Deep Residual Hashing Neural Network for Image RetrievalEdwin Efraín Jiménez Lepe
 
Introduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordIntroduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordLakshmi Sarvani Videla
 
Basics of Digital Images
Basics of  Digital ImagesBasics of  Digital Images
Basics of Digital ImagesSaad Al-Momen
 
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...CSCJournals
 
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHOD
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHODFORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHOD
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHODeditorijcres
 
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionSimple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionAnish Patel
 
Solving linear equations from an image using ann
Solving linear equations from an image using annSolving linear equations from an image using ann
Solving linear equations from an image using anneSAT Journals
 

Similar a Hack Linear Algebra with Python for Deep Neural Network (20)

vector application
vector applicationvector application
vector application
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
 
Vectors.pptx
Vectors.pptxVectors.pptx
Vectors.pptx
 
Metric-learn, a Scikit-learn compatible package
Metric-learn, a Scikit-learn compatible packageMetric-learn, a Scikit-learn compatible package
Metric-learn, a Scikit-learn compatible package
 
Matrix algebra in_r
Matrix algebra in_rMatrix algebra in_r
Matrix algebra in_r
 
Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...
Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...
Stereo Vision Distance Estimation Employing Canny Edge Detector with Interpol...
 
8. Vectors data frames
8. Vectors data frames8. Vectors data frames
8. Vectors data frames
 
Matlab solved problems
Matlab solved problemsMatlab solved problems
Matlab solved problems
 
SessionFour_DataTypesandObjects
SessionFour_DataTypesandObjectsSessionFour_DataTypesandObjects
SessionFour_DataTypesandObjects
 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in Theano
 
Deep Residual Hashing Neural Network for Image Retrieval
Deep Residual Hashing Neural Network for Image RetrievalDeep Residual Hashing Neural Network for Image Retrieval
Deep Residual Hashing Neural Network for Image Retrieval
 
Introduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordIntroduction to Data Science With R Lab Record
Introduction to Data Science With R Lab Record
 
Basics of Digital Images
Basics of  Digital ImagesBasics of  Digital Images
Basics of Digital Images
 
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...
 
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHOD
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHODFORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHOD
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHOD
 
Report
ReportReport
Report
 
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionSimple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
 
Solving linear equations from an image using ann
Solving linear equations from an image using annSolving linear equations from an image using ann
Solving linear equations from an image using ann
 

Más de Chetan Khatri

Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...
Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...
Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...Chetan Khatri
 
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Chetan Khatri
 
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-AirflowPyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-AirflowChetan Khatri
 
ScalaTo July 2019 - No more struggles with Apache Spark workloads in production
ScalaTo July 2019 - No more struggles with Apache Spark workloads in productionScalaTo July 2019 - No more struggles with Apache Spark workloads in production
ScalaTo July 2019 - No more struggles with Apache Spark workloads in productionChetan Khatri
 
No more struggles with Apache Spark workloads in production
No more struggles with Apache Spark workloads in productionNo more struggles with Apache Spark workloads in production
No more struggles with Apache Spark workloads in productionChetan Khatri
 
PyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_production
PyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_productionPyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_production
PyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_productionChetan Khatri
 
Automate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scala
Automate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scalaAutomate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scala
Automate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scalaChetan Khatri
 
HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...
HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...
HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...Chetan Khatri
 
TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...
TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...
TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...Chetan Khatri
 
An Introduction to Spark with Scala
An Introduction to Spark with ScalaAn Introduction to Spark with Scala
An Introduction to Spark with ScalaChetan Khatri
 
HBase with Apache Spark POC Demo
HBase with Apache Spark POC DemoHBase with Apache Spark POC Demo
HBase with Apache Spark POC DemoChetan Khatri
 
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...Chetan Khatri
 
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...Chetan Khatri
 
Fossasia 2018-chetan-khatri
Fossasia 2018-chetan-khatriFossasia 2018-chetan-khatri
Fossasia 2018-chetan-khatriChetan Khatri
 
Fossasia ai-ml technologies and application for product development-chetan kh...
Fossasia ai-ml technologies and application for product development-chetan kh...Fossasia ai-ml technologies and application for product development-chetan kh...
Fossasia ai-ml technologies and application for product development-chetan kh...Chetan Khatri
 
Introduction to Computer Science
Introduction to Computer ScienceIntroduction to Computer Science
Introduction to Computer ScienceChetan Khatri
 
An introduction to Git with Atlassian Suite
An introduction to Git with Atlassian SuiteAn introduction to Git with Atlassian Suite
An introduction to Git with Atlassian SuiteChetan Khatri
 
Think machine-learning-with-scikit-learn-chetan
Think machine-learning-with-scikit-learn-chetanThink machine-learning-with-scikit-learn-chetan
Think machine-learning-with-scikit-learn-chetanChetan Khatri
 
A step towards machine learning at accionlabs
A step towards machine learning at accionlabsA step towards machine learning at accionlabs
A step towards machine learning at accionlabsChetan Khatri
 
Voltage measurement using arduino
Voltage measurement using arduinoVoltage measurement using arduino
Voltage measurement using arduinoChetan Khatri
 

Más de Chetan Khatri (20)

Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...
Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...
Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...
 
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
 
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-AirflowPyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
 
ScalaTo July 2019 - No more struggles with Apache Spark workloads in production
ScalaTo July 2019 - No more struggles with Apache Spark workloads in productionScalaTo July 2019 - No more struggles with Apache Spark workloads in production
ScalaTo July 2019 - No more struggles with Apache Spark workloads in production
 
No more struggles with Apache Spark workloads in production
No more struggles with Apache Spark workloads in productionNo more struggles with Apache Spark workloads in production
No more struggles with Apache Spark workloads in production
 
PyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_production
PyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_productionPyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_production
PyConLT19-No_more_struggles_with_Apache_Spark_(PySpark)_workloads_in_production
 
Automate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scala
Automate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scalaAutomate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scala
Automate ml workflow_transmogrif_ai-_chetan_khatri_berlin-scala
 
HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...
HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...
HBaseConAsia 2018 - Scaling 30 TB's of Data lake with Apache HBase and Scala ...
 
TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...
TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...
TransmogrifAI - Automate Machine Learning Workflow with the power of Scala an...
 
An Introduction to Spark with Scala
An Introduction to Spark with ScalaAn Introduction to Spark with Scala
An Introduction to Spark with Scala
 
HBase with Apache Spark POC Demo
HBase with Apache Spark POC DemoHBase with Apache Spark POC Demo
HBase with Apache Spark POC Demo
 
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
 
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
 
Fossasia 2018-chetan-khatri
Fossasia 2018-chetan-khatriFossasia 2018-chetan-khatri
Fossasia 2018-chetan-khatri
 
Fossasia ai-ml technologies and application for product development-chetan kh...
Fossasia ai-ml technologies and application for product development-chetan kh...Fossasia ai-ml technologies and application for product development-chetan kh...
Fossasia ai-ml technologies and application for product development-chetan kh...
 
Introduction to Computer Science
Introduction to Computer ScienceIntroduction to Computer Science
Introduction to Computer Science
 
An introduction to Git with Atlassian Suite
An introduction to Git with Atlassian SuiteAn introduction to Git with Atlassian Suite
An introduction to Git with Atlassian Suite
 
Think machine-learning-with-scikit-learn-chetan
Think machine-learning-with-scikit-learn-chetanThink machine-learning-with-scikit-learn-chetan
Think machine-learning-with-scikit-learn-chetan
 
A step towards machine learning at accionlabs
A step towards machine learning at accionlabsA step towards machine learning at accionlabs
A step towards machine learning at accionlabs
 
Voltage measurement using arduino
Voltage measurement using arduinoVoltage measurement using arduino
Voltage measurement using arduino
 

Último

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Último (20)

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 

Hack Linear Algebra with Python for Deep Neural Network

  • 1. Talk: Hack Linear Algebra with Python for Deep Neural Network Speaker: Chetan Khatri, Department of Computer Science, University of Kachchh alumnus. Lead - Technology, Accionlabs Inc. In [1]: from IPython.display import Image In [2]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-24-40.png") In [3]: Image(filename="/home/chetan/Downloads/screenshot-towardsdatascience.com-2018-01 -13-07-49-05-835.png") common linear algebra operations used in Neural Network Out[2]: Out[3]:
  • 2. Say What ? Linear Algebra for Neural Network In the context of deep learning / Neural network, linear algebra is a mathematical toolbox that offers helpful techniques for manipulating groups of numbers simultaneously. It provides structures like vectors and matrices (spreadsheets) to hold these numbers and new rules for how to add, subtract, multiply, and divide them. Why is it useful? It turns complicated problems into simple, intuitive, efficiently calculated problems. Here is an example of how linear algebra can achieve greater speed and simplicity. In [4]: import numpy as np In [5]: # Multiply two arrays x = [1,2,3] y = [2,3,4] product = [] for i in range(len(x)): product.append(x[i]*y[i]) print product In [6]: # Linear algebra version x = np.array([1,2,3]) y = np.array([2,3,4]) x * y After initializing the arrays, the linear algebra approach was 3x faster. How is it used in Artificial Neural Network / deep learning ? Neural networks store weights in matrices. Linear algebra makes matrix operations fast and easy, especially when training on GPUs. In fact, GPUs were created with vector and matrix operations in mind. Similar to how images can be represented as arrays of pixels, video games generate compelling gaming experiences using enormous, constantly evolving matrices. Instead of processing pixels one-by-one, GPUs manipulate entire matrices of pixels in parallel. Vectors [2, 6, 12] Out[6]: array([ 2, 6, 12])
  • 3. Vectors are 1-dimensional arrays of numbers or terms. In geometry, vectors store the magnitude and direction of a potential change to a point. The vector [3, -2] says go right 3 and down 2. A vector with more than one dimension is called a matrix. Vector -> is arrow pointing in a space. What defines a vector: length and direction it's pointing, as long as length and direction are same you can move all around. Vectors in geometry In [7]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-36-32.png") Out[7]:
  • 4. In [8]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-36-36.png") In [9]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-36-42.png") Out[8]: Out[9]:
  • 5. In [10]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 14-39-55.png") In [11]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-39-53.png") Vector lives in flat plane is 2 dimensional. Out[10]: Out[11]:
  • 6. In [12]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-41-09.png") If vector sits in broader space where you and I leave they are 3 Dimensional. In [13]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-46-00.png") vector addition & vector multiplication plays important role in linear algebra positive numbers indicating rightward and upward motion negative numbers indicating leftward and downward motion Out[12]: Out[13]:
  • 7. Every pair of number gives 1 and only 1 vector. And every vector is associated with 1 and only 1 pair of number. 3 Dimensions - Z Z - Parpendicular to both X & Y axis, which orders triplet numbers. [2 1 3] Move along to how far to X axis. How far to move parellel to Y axis. How far to move parellel to Z axis In Brief: Vectors typically represent movement from a point. They store both the magnitude and direction of potential changes to a point. The vector [-2,5] says move left 2 units and up 5 units. A vector can be applied to any point in space. The vector’s direction equals the slope of the hypotenuse created moving up 5 and left 2. Its magnitude equals the length of the hypotenuse. What's going on to space & Ask computer to figure it out numerically. Scalar operations Scalar operations involve a vector and a number. You modify the vector in-place by adding, subtracting, or multiplying the number from all the values in the vector. Examples: Streaching vector by scalar, Scaling Vector by scalar, Squash in vector by Scalar, Shear vector in plane geometry In [14]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-51-02.png") Out[14]:
  • 8. In [15]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-30.png") In [16]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-33.png") Out[15]: Out[16]:
  • 9. In [17]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-40.png") In [18]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-52-41.png") Out[17]: Out[18]:
  • 10. In [19]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-53-00.png") In [20]: Image(filename="/home/chetan/Pictures/Screenshot from 2018-01-12 15-53-17.png") Span: What does the span of two 3d vectors look like ? All possible linear combination of two vectors. If one vector is already span of other then it's called "Linearly dependent" for some values of a and b. Each vector adds another dimension to span that's "Linearly independent" w /= av for all values of a. Out[19]: Out[20]:
  • 11. Basis The basis of a vector space is a set of linearly independent vectors that span the full space. The word "transformation" suggests that you think using "Movement" Transformation is linear: If all lines must remain lines, origin remains fixed. Not linear: Some lines get curved, grid lines remain parellel and evenly spaced. Elementwise operations In [21]: Image(filename="/home/chetan/Music/images/1_g7cc0GkA7xrkhoh-__Ok3g.png") In elementwise operations like addition, subtraction, and division, values that correspond positionally are combined to produce a new vector. The 1st value in vector A is paired with the 1st value in vector B. The 2nd value is paired with the 2nd, and so on. This means the vectors must have equal dimensions to complete the operation.* In [22]: Image(filename="/home/chetan/Music/images/2.png") In [23]: y = np.array([1,2,3]) x = np.array([2,3,4]) In [24]: y + x Out[21]: Out[22]: Out[24]: array([3, 5, 7])
  • 12. In [25]: y - x In [26]: y / x Vector multiplication There are two types of vector multiplication: Dot product and Hadamard product. Dot product The dot product of two vectors is a scalar. Dot product of vectors and matrices (matrix multiplication) is one of the most important operations in deep learning. In [27]: Image(filename="/home/chetan/Music/images/3.png") In [28]: y = np.array([1,2,3]) x = np.array([2,3,4]) In [29]: np.dot(y,x) Hadamard product Hadamard Product is elementwise multiplication and it outputs a vector. Out[25]: array([-1, -1, -1]) Out[26]: array([0, 0, 0]) Out[27]: Out[29]: 20
  • 13. In [30]: Image(filename="/home/chetan/Music/images/4.png") In [31]: y = np.array([1,2,3]) x = np.array([2,3,4]) In [32]: y * x Vector fields A vector field shows how far the point (x,y) would hypothetically move if we applied a vector function to it like addition or multiplication. Given a point in space, a vector field shows the power and direction of our proposed change at a variety of points in a graph. In [33]: Image(filename="/home/chetan/Music/images/5.png") Matrices A matrix is a rectangular grid of numbers or terms (like an Excel spreadsheet) with special rules for addition, subtraction, and multiplication. Out[30]: Out[32]: array([ 2, 6, 12]) Out[33]:
  • 14. Matrix dimensions We describe the dimensions of a matrix in terms of rows by columns. In [34]: Image(filename="/home/chetan/Music/images/6.png") In [35]: a = np.array([ [1,2,3], [4,5,6] ]) In [36]: a.shape In [37]: b = np.array([ [1,2,3] ]) In [38]: b.shape Matrix scalar operations Scalar operations with matrices work the same way as they do for vectors. Simply apply the scalar to every element in the matrix—add, subtract, divide, multiply, etc. Out[34]: Out[36]: (2, 3) Out[38]: (1, 3)
  • 15. In [39]: Image(filename="/home/chetan/Music/images/7.png") In [40]: a = np.array( [[1,2], [3,4]]) In [41]: a + 1 Matrix elementwise operations In order to add, subtract, or divide two matrices they must have equal dimensions.* We combine corresponding values in an elementwise fashion to produce a new matrix. In [42]: Image(filename="/home/chetan/Music/images/8.png") In [43]: a = np.array([ [1,2], [3,4] ]) b = np.array([ [1,2], [3,4] ]) Out[39]: Out[41]: array([[2, 3], [4, 5]]) Out[42]:
  • 16. In [44]: a + b In [45]: a - b Numpy broadcasting* In numpy the dimension requirements for elementwise operations are relaxed via a mechanism called broadcasting. Two matrices are compatible if the corresponding dimensions in each matrix (rows vs rows, columns vs columns) meet the following requirements: 1. The dimensions are equal, or 2. One dimension is of size 1 In [46]: a = np.array([ [1], [2] ]) b = np.array([ [3,4], [5,6] ]) c = np.array([ [1,2] ]) In [47]: # Same no. of rows # Different no. of columns # but a has one column so this works a * b Out[44]: array([[2, 4], [6, 8]]) Out[45]: array([[0, 0], [0, 0]]) Out[47]: array([[ 3, 4], [10, 12]])
  • 17. In [48]: # Same no. of columns # Different no. of rows # but c has one row so this works b * c In [49]: # Different no. of columns # Different no. of rows # but both a and c meet the # size 1 requirement rule a + c Things get weirder in higher dimensions—3D, 4D, but for now we won’t worry about that. Understanding 2D operations is a good start. Matrix Hadamard product Hadamard product of matrices is an elementwise operation. Values that correspond positionally are multiplied to produce a new matrix. In [50]: Image(filename="/home/chetan/Music/images/9.png") Out[48]: array([[ 3, 8], [ 5, 12]]) Out[49]: array([[2, 3], [3, 4]]) Out[50]:
  • 18. In [51]: a = np.array( [[2,3], [2,3]]) b = np.array( [[3,4], [5,6]]) # Uses python's multiply operator a * b In numpy you can take the Hadamard product of a matrix and vector as long as their dimensions meet the requirements of broadcasting. In [52]: Image(filename="/home/chetan/Music/images/10.png") Matrix transpose Neural networks frequently process weights and inputs of different sizes where the dimensions do not meet the requirements of matrix multiplication. Matrix transpose provides a way to “rotate” one of the matrices so that the operation complies with multiplication requirements and can continue. There are two steps to transpose a matrix: Rotate the matrix right 90° Reverse the order of elements in each row (e.g. [a b c] becomes [c b a]) As an example, transpose matrix M into T: Out[51]: array([[ 6, 12], [10, 18]]) Out[52]:
  • 19. In [53]: Image(filename="/home/chetan/Music/images/11.png") In [54]: a = np.array([ [1, 2], [3, 4]]) a.T Matrix multiplication Matrix multiplication specifies a set of rules for multiplying matrices together to produce a new matrix. Rules Not all matrices are eligible for multiplication. In addition, there is a requirement on the dimensions of the resulting matrix output. 1. The number of columns of the 1st matrix must equal the number of rows of the 2nd 2. The product of an M x N matrix and an N x K matrix is an M x K matrix. The new matrix takes the rows of the 1st and columns of the 2nd Steps Matrix multiplication relies on dot product to multiply various combinations of rows and columns. Out[53]: Out[54]: array([[1, 3], [2, 4]])
  • 20. In [57]: Image(filename="/home/chetan/Music/images/12.png") The operation a1 · b1 means we take the dot product of the 1st row in matrix A (1, 7) and the 1st column in matrix B (3, 5). In [58]: Image(filename="/home/chetan/Music/images/13.png") Here’s another way to look at it: In [59]: Image(filename="/home/chetan/Music/images/14.png") Test yourself with these examples Out[57]: Out[58]: Out[59]: