Matrix Math Flashcards
A single value is known as
scalar
scalar
a value with 0 dimensions
Lists of values are known as
vectors
Types of vectors
row and column
Dimensions of vectors
just one: length
What is a matrix
a 2 dimensional grid of values
What is a tensor?
Any n-dimensional collection of values
Locations in matrices are known as
indices
Indices nomenclature
Like a 1 layer nested array
Numpy is
a C library in python.
Does lots of math operations in Python and is designed to work with matrices.
Normal convention for naming numpy
import numpy as np
Most common way to with number in NumPy is through
ndarray objects
ndarray objects are
similar to Python lists, but can have any number of dimensions
Does fast math operations
To declare an ndarray
x = nd.array(5)
To get shape of ndarray
nd.shape
To reshape an nd array like one that is (4,)
(4,).reshape(1,4)
Why do some people use
x = v[:, None]
Adds extra dimension
Elementwise operations
Like iterating through and running an operation
Requirements for adding two matrices
Have to be the same shape
When describing the shape of a matrix how does one describe it?
rows x columns
You can only safely run a transpose to multiply if
The data is arranged as rows
To get the min, max, mean of a matrix
np. min(array)
np. max(array)
mp. mean(array)
How to calculate error in a logistic regression?
It the number of errors
What method does one use to minimize the error?
Gradient descent
Basic parts of a neural network
Input data, processing, output
Individual nodes are called
perceptrons
What are weights?
A higher weight means the neural network considers that input more important than other inputs, and lower weight means that the data is considered less important.
W vs w
W when it represents a matrix of weights or a w when it represents an individual weight
How is an output signal determined?
feeding the linear combination into an activation function
What are two ways to go from an AND perceptron to an OR perceptron?
Increase the weights
Decrease the magnitude of the bias
AND perceptron
Both must be true to accept
OR perceptron
One must be true
NOT perceptron
A specific one must be true
XOR perceptron
outputs 0 if the inputs are the same and 1 if the inputs are different
Gradient is
term for rate of change or slope
To calculate rate of change
derivative of a function f(x) gives you another function fââ(x) that returns the slope of f(x) at point x
Local minima
where the error is low, but not the lowest
SSE is
measure of networks performance. Low means good predictions.
np.dot is the same as
Multiplying two matrices and then getting the sum
sigmoid(x)
1/(1+np.exp(-x))
sigmoid_prime(x)
sigmoid(x) * (1 - sigmoid(x))