This document summarizes a talk on using linear algebra with Python for deep neural networks. It discusses how linear algebra provides useful structures like vectors and matrices for manipulating groups of numbers. It then covers various linear algebra concepts used in neural networks like vectors, matrices, scalar and elementwise operations, matrix multiplication, and transpose. Key linear algebra operations like addition, subtraction, and multiplication are explained through code examples in NumPy.
Social networks are not new, even though websites like Facebook and Twitter might make you want to believe they are; and trust me- I’m not talking about Myspace! Social networks are extremely interesting models for human behavior, whose study dates back to the early twentieth century. However, because of those websites, data scientists have access to much more data than the anthropologists who studied the networks of tribes!
Because networks take a relationship-centered view of the world, the data structures that we will analyze model real world behaviors and community. Through a suite of algorithms derived from mathematical Graph theory we are able to compute and predict behavior of individuals and communities through these types of analyses. Clearly this has a number of practical applications from recommendation to law enforcement to election prediction, and more.
Network analyses are powerful methods for both visual analytics and machine learning but can suffer as their complexity increases. By embedding time as a structural element rather than a property, we will explore how time series and interactive analysis can be improved on Graph structures. Primarily we will look at decomposition in NLP-extracted concept graphs using NetworkX and Graph Tool.
Prepared as a conference tutorial, MIC-Electrical, Athens, Greece, 5th April 2014, updated and delivered again in Beijing, China, 27 January 2015 to students from Complex Systems Group, CSRC and Dept. of Engineering Physics, Tsinghua University
Introducing the Concept of Back-Inking as an Efficient Model for Document Ret...IJITCA Journal
Today, many institutions and organizations are facing serious problem due to the tremendously increasing
size of documents, and this problem is further triggering the storage and retrieval problems due to the
continuously growing space and efficiency requirements. This problem is becoming more complex with
time and the increase in the size and number of documents in an organization. Therefore, there is a
growing demand to address this problem. This demand and challenge can be met by developing a
technique to enable specialized document imaging people to use when there is a need for storing
documents images. Thus, we need special and efficient storage techniques for this type of information
storage (IS) systems.
In this paper, we present an efficient storage technique for electronic documents. The proposed technique
uses the Information Pixels concept to make the technique more efficient for certain image formats. In
addition, we shall see how Storing Information Pixels Addresses ( SIPA ) method is an efficient method for
document storage and as a result makes the document image storage relatively efficient for most image
formats.
Social networks are not new, even though websites like Facebook and Twitter might make you want to believe they are; and trust me- I’m not talking about Myspace! Social networks are extremely interesting models for human behavior, whose study dates back to the early twentieth century. However, because of those websites, data scientists have access to much more data than the anthropologists who studied the networks of tribes!
Because networks take a relationship-centered view of the world, the data structures that we will analyze model real world behaviors and community. Through a suite of algorithms derived from mathematical Graph theory we are able to compute and predict behavior of individuals and communities through these types of analyses. Clearly this has a number of practical applications from recommendation to law enforcement to election prediction, and more.
Network analyses are powerful methods for both visual analytics and machine learning but can suffer as their complexity increases. By embedding time as a structural element rather than a property, we will explore how time series and interactive analysis can be improved on Graph structures. Primarily we will look at decomposition in NLP-extracted concept graphs using NetworkX and Graph Tool.
Prepared as a conference tutorial, MIC-Electrical, Athens, Greece, 5th April 2014, updated and delivered again in Beijing, China, 27 January 2015 to students from Complex Systems Group, CSRC and Dept. of Engineering Physics, Tsinghua University
Introducing the Concept of Back-Inking as an Efficient Model for Document Ret...IJITCA Journal
Today, many institutions and organizations are facing serious problem due to the tremendously increasing
size of documents, and this problem is further triggering the storage and retrieval problems due to the
continuously growing space and efficiency requirements. This problem is becoming more complex with
time and the increase in the size and number of documents in an organization. Therefore, there is a
growing demand to address this problem. This demand and challenge can be met by developing a
technique to enable specialized document imaging people to use when there is a need for storing
documents images. Thus, we need special and efficient storage techniques for this type of information
storage (IS) systems.
In this paper, we present an efficient storage technique for electronic documents. The proposed technique
uses the Information Pixels concept to make the technique more efficient for certain image formats. In
addition, we shall see how Storing Information Pixels Addresses ( SIPA ) method is an efficient method for
document storage and as a result makes the document image storage relatively efficient for most image
formats.
Computer Vision: Correlation, Convolution, and GradientAhmed Gad
Three important operations in computer vision are explained starting with each one got explained and implemented in Python.
Generally, all of these three operations have many similarities in as they follow the same general steps but there are some subtle changes. The main change is using different masks.
This slide represents topics on PCA (Principal Component Analysis) and SVD (Singular Value Decomposition) where I tried to cover basic PCA, application, and use of PCA and SVD, Important keywords to know about PCA briefly, PCA algorithm and implementation, Basic SVD, SVD calculation, SVD implementation, Performance comparison of SVD and PCA regarding one publicly available dataset.
N.B. Information in this slide are gathered from
1. Machine Learning course by Andrew NG,
2. Mining of Massive Dataset | Stanford University | Artificial Intelligence - All in One (youtube channel)
3. and many more they are described in the slide.
A Correlative Information-Theoretic Measure for Image SimilarityFarah M. Altufaili
A hybrid measure is proposed for assessing the similarity among gray-scale images. The well-known Structural Similarity Index Measure (SSIM) has been designed using a statistical approach that fails under significant noise (low PSNR). The proposed measure, denoted by SjhCorr2, uses a combination of two parts: the first part is information - theoretic, while the second part is based on 2D correlation. The concept
of symmetric joint histogram is used in the information - heoretic part. The new measure shows the advantages of statistical approaches and information - theoretic approaches. The proposed similarity approach is robust under noise. The new measure outperforms the classical SSIM in detecting image similarity at low PSN.
This is the basic introductory presentation for beginners. It gives you the idea about what is image processing means. The presentation consists of introduction to digital image processing, image enhancement, image filtering, finding an image edge, image analysis, tools for image processing and finally some application of digital image processing.
Machine learning is the hacker art of describing the features of instances that we want to make predictions about, then fitting the data that describes those instances to a model form. Applied machine learning has come a long way from it's beginnings in academia, and with tools like Scikit-Learn, it's easier than ever to generate operational models for a wide variety of applications. Thanks to the ease and variety of the tools in Scikit-Learn, the primary job of the data scientist is model selection. Model selection involves performing feature engineering, hyperparameter tuning, and algorithm selection. These dimensions of machine learning often lead computer scientists towards automatic model selection via optimization (maximization) of a model's evaluation metric. However, the search space is large, and grid search approaches to machine learning can easily lead to failure and frustration. Human intuition is still essential to machine learning, and visual analysis in concert with automatic methods can allow data scientists to steer model selection towards better fitted models, faster. In this talk, we will discuss interactive visual methods for better understanding, steering, and tuning machine learning models.
To output a solved wordoku puzzle from an input image in Matlab. The project involves image segmentation, extraction, pattern recognition, support vector regression and other image processing techniques.
Computer Vision: Correlation, Convolution, and GradientAhmed Gad
Three important operations in computer vision are explained starting with each one got explained and implemented in Python.
Generally, all of these three operations have many similarities in as they follow the same general steps but there are some subtle changes. The main change is using different masks.
This slide represents topics on PCA (Principal Component Analysis) and SVD (Singular Value Decomposition) where I tried to cover basic PCA, application, and use of PCA and SVD, Important keywords to know about PCA briefly, PCA algorithm and implementation, Basic SVD, SVD calculation, SVD implementation, Performance comparison of SVD and PCA regarding one publicly available dataset.
N.B. Information in this slide are gathered from
1. Machine Learning course by Andrew NG,
2. Mining of Massive Dataset | Stanford University | Artificial Intelligence - All in One (youtube channel)
3. and many more they are described in the slide.
A Correlative Information-Theoretic Measure for Image SimilarityFarah M. Altufaili
A hybrid measure is proposed for assessing the similarity among gray-scale images. The well-known Structural Similarity Index Measure (SSIM) has been designed using a statistical approach that fails under significant noise (low PSNR). The proposed measure, denoted by SjhCorr2, uses a combination of two parts: the first part is information - theoretic, while the second part is based on 2D correlation. The concept
of symmetric joint histogram is used in the information - heoretic part. The new measure shows the advantages of statistical approaches and information - theoretic approaches. The proposed similarity approach is robust under noise. The new measure outperforms the classical SSIM in detecting image similarity at low PSN.
This is the basic introductory presentation for beginners. It gives you the idea about what is image processing means. The presentation consists of introduction to digital image processing, image enhancement, image filtering, finding an image edge, image analysis, tools for image processing and finally some application of digital image processing.
Machine learning is the hacker art of describing the features of instances that we want to make predictions about, then fitting the data that describes those instances to a model form. Applied machine learning has come a long way from it's beginnings in academia, and with tools like Scikit-Learn, it's easier than ever to generate operational models for a wide variety of applications. Thanks to the ease and variety of the tools in Scikit-Learn, the primary job of the data scientist is model selection. Model selection involves performing feature engineering, hyperparameter tuning, and algorithm selection. These dimensions of machine learning often lead computer scientists towards automatic model selection via optimization (maximization) of a model's evaluation metric. However, the search space is large, and grid search approaches to machine learning can easily lead to failure and frustration. Human intuition is still essential to machine learning, and visual analysis in concert with automatic methods can allow data scientists to steer model selection towards better fitted models, faster. In this talk, we will discuss interactive visual methods for better understanding, steering, and tuning machine learning models.
To output a solved wordoku puzzle from an input image in Matlab. The project involves image segmentation, extraction, pattern recognition, support vector regression and other image processing techniques.
Metric learning is an area of machine learning which aims to learn a distance (or similarity) measure between samples for a given task. In this presentation, I will start by briefly introducing the main ideas of metric learning and some of its applications, and show a concrete example of using metric-learn, the metric learning library in Python. I will then highlight the importance of making a machine learning package compatible with scikit-learn and discuss the challenges in the specific case of metric-learn, in particular regarding API constraints. Finally, we will dig into metric-learn's code to illustrate the main design choices, and emphasize some general issues (such as test design) that require special care when developing a machine learning toolbox.
https://github.com/metric-learn/metric-learn
As part of the GSP’s capacity development and improvement programme, FAO/GSP have organised a one week training in Izmir, Turkey. The main goal of the training was to increase the capacity of Turkey on digital soil mapping, new approaches on data collection, data processing and modelling of soil organic carbon. This 5 day training is titled ‘’Training on Digital Soil Organic Carbon Mapping’’ was held in IARTC - International Agricultural Research and Education Center in Menemen, Izmir on 20-25 August, 2017.
Performance Comparison of Image Retrieval Using Fractional Coefficients of Tr...CSCJournals
The thirst of better and faster retrieval techniques has always fuelled to the research in content based image retrieval (CBIR). The paper presents innovative content based image retrieval (CBIR) techniques based on feature vectors as fractional coefficients of transformed images using Discrete Cosine, Walsh, Haar and Kekre’s transforms. Here the advantage of energy compaction of transforms in higher coefficients is taken to greatly reduce the feature vector size per image by taking fractional coefficients of transformed image. The feature vectors are extracted in fourteen different ways from the transformed image, with the first being considering all the coefficients of transformed image and then fourteen reduced coefficients sets (as 50%, 25%, 12.5%, 6.25%, 3.125%, 1.5625% ,0.7813%, 0.39%, 0.195%, 0.097%, 0.048%, 0.024%, 0.012% and 0.06% of complete transformed image) are considered as feature vectors. The four transforms are applied on gray image equivalents and the colour components of images to extract Gray and RGB feature sets respectively. Instead of using all coefficients of transformed images as feature vector for image retrieval, these fourteen reduced coefficients sets for gray as well as RGB feature vectors are used, resulting into better performance and lower computations. The proposed CBIR techniques are implemented on a database having 1000 images spread across 11 categories. For each proposed CBIR technique 55 queries (5 per category) are fired on the database and net average precision and recall are computed for all feature sets per transform. The results have shown performance improvement (higher precision and recall values) with fractional coefficients compared to complete transform of image at reduced computations resulting in faster retrieval. Finally Kekre’s transform surpasses all other discussed transforms in performance with highest precision and recall values for fractional coefficients (6.25% and 3.125% of all coefficients) and computation are lowered by 94.08% as compared to DCT.
FORGERY (COPY-MOVE) DETECTION IN DIGITAL IMAGES USING BLOCK METHODeditorijcres
AKHILESH KUMAR YADAV, DEENBANDHU SINGH, VIVEK KUMAR
Department of Computer Science and Engineering
Babu Banarasi Das University, Lucknow
akhi2232232@gmail.com, deenbandhusingh85@gmail.com, vivek.kumar0091@gmail.com
ABSTRACT- Digital images can be easily modified using powerful image editing software. Determining whether a manipulation is innocent of sharpening from those which are malicious, such as removing or adding parts to an image is the topic of this paper. In this paper we focus on detection of a special type of forgery-the Copy-Move forgery, in this part of the original image is copied moved to desired location in the same image and pasted. The proposed method compress images using DWT (discrete wavelet transform) and divided into blocks and choose blocks than perform feature vector calculation and lexicographical sorting and duplicated blocks are identified after sorting. This method is good at some manipulation/attack likes scaling, rotation, Gaussian noise, smoothing, JPEG compression etc.
INDEX TERMS- Copy-Move forgery, Wavelet Transform, Lexicographical Sorting, Region Duplication Detection.
Solving linear equations from an image using anneSAT Journals
Abstract
Optical character recognition has a great impact in image processing application. This paper combines the concept of OCR and feed-forward artificial neural network to solve mathematical linear equations. We implement blob analysis and feature extraction to extract the individual characters to a captured image which having some mathematical equations. We are constructing 39 character set which having some numbers, alphabet and operators. Training of these character set is done by using supervised learning rule. If that image satisfying linear equation condition then our proposed algorithm solve this equation and generate the output. This paper tries to increase the recognition rate more than 87%. The result achieved from the training and testing on the network of the letter recognition is satisfactory.
Keywords: Artificial Neural Network, Linear Equation, Recognized rate, Optical Character Recognition.
Similar to An Introduction Linear Algebra for Neural Networks and Deep learning (20)
Data Science for Beginner by Chetan Khatri and Deptt. of Computer Science, Ka...Chetan Khatri
What is Data Science?
What is Machine Learning, Deep Learning, and AI?
Motivation
Philosophy of Artificial Intelligence (AI)
Role of AI in Daily life
Use cases/Applications
Tools & Technologies
Challenges: Bias, Fake Content, Digital Psychography, Security
Detect Fake Content with “AI”
Learning Path
Career Path
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Chetan Khatri
Pragmatic presentation on Penetration testing for Data-Driven Platforms.
Agenda:
- Motivation
- Information Security - Ethics.
- Encryption
- Authentication
- Information Security & Potential threats with Open Source World.
- Find vulnerabilities.
- Checklist before using any Open Source library.
- Vulnerabilities report.
- Penetration Testing for Data-Driven Developments.
ScalaTo July 2019 - No more struggles with Apache Spark workloads in productionChetan Khatri
Scala Toronto July 2019 event at 500px.
Pure Functional API Integration
Apache Spark Internals tuning
Performance tuning
Query execution plan optimisation
Cats Effects for switching execution model runtime.
Discovery / experience with Monix, Scala Future.
No more struggles with Apache Spark workloads in productionChetan Khatri
Paris Scala Group Event May 2019, No more struggles with Apache Spark workloads in production.
Apache Spark
Primary data structures (RDD, DataSet, Dataframe)
Pragmatic explanation - executors, cores, containers, stage, job, a task in Spark.
Parallel read from JDBC: Challenges and best practices.
Bulk Load API vs JDBC write
An optimization strategy for Joins: SortMergeJoin vs BroadcastHashJoin
Avoid unnecessary shuffle
Alternative to spark default sort
Why dropDuplicates() doesn’t result consistency, What is alternative
Optimize Spark stage generation plan
Predicate pushdown with partitioning and bucketing
Why not to use Scala Concurrent ‘Future’ explicitly!
No more struggles with Apache Spark (PySpark) workloads in production, Chetan Khatri, Data Science Practice Leader.
Accionlabs India. PyconLT’19, May 26 - Vilnius Lithuania
Fossasia ai-ml technologies and application for product development-chetan kh...Chetan Khatri
Train at GPU and Inference at Mobile, Artificial Intelligence / Machine learning Technologies and Applications for AI Driven Product Development. Talk at FOSSASIA 2018, Singapore
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
An Introduction Linear Algebra for Neural Networks and Deep learning
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]:
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]:
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]: