Skip to content

Instantly share code, notes, and snippets.

View fedden's full-sized avatar
🤖
Training deep audio models

Leon Fedden fedden

🤖
Training deep audio models
View GitHub Profile
@fedden
fedden / la.py
Created November 6, 2017 19:38
Fundamental Linear Algebra Objects
>>> import numpy as np
>>> # Scalars are just a single number.
>>> scalar = 5.0
>>> np.isscalar(scalar)
True
>>> # Vectors are a matrix with one column.
>>> vector = np.arange(10)
>>> vector
@fedden
fedden / matmul.py
Created November 7, 2017 00:13
Matrix Multiplication
>>> import numpy as np
>>> # Create a random matrix with 3 rows and 4 columns.
>>> matrix_a = np.random.random_sample((3, 4))
>>> matrix_a
array([[ 0.21922347, 0.84313988, 0.41381942, 0.53553901],
[ 0.35322431, 0.38337327, 0.15964194, 0.30629508],
[ 0.16188791, 0.55971721, 0.33561351, 0.04709838]])
>>> # Create a matrix from the transpose of A. Note the shapes
@fedden
fedden / indentity.py
Created November 7, 2017 01:26
Identity dot vector operation.
>>> import numpy as np
>>> # Create a simple vector.
>>> vector = np.arange(3.)
>>> vector
array([ 0., 1., 2.])
>>> # Create an identity with
>>> # the right dimensionality.
>>> identity = np.identity(3)
@fedden
fedden / norms.py
Last active November 7, 2017 12:31
NumPy Norms
>>> import numpy as np
>>> # Create five vectors of size two to compute the norms for.
>>> values = np.array([[v, v] for v in np.arange(0.0, 1.0, 0.2)])
>>> values
array([[ 0. , 0. ],
[ 0.2, 0.2],
[ 0.4, 0.4],
[ 0.6, 0.6],
[ 0.8, 0.8]])
@fedden
fedden / orthogonal_vectors.py
Last active November 7, 2017 19:38
Orthogonal Vectors
>>> import numpy as np
>>> # Two vectors, a and b.
>>> a = np.array([-3, 4])
>>> b = np.array([4, 3])
>>> # The dot product is 0.
>>> a.dot(b)
0
@fedden
fedden / orthogonal_matrices.py
Last active November 7, 2017 23:48
orthogonal_matrices.py
>>> import numpy as np
>>> # No scientific notation
>>> np.set_printoptions(suppress=True)
>>> # Some random orthogonal matrix.
>>> orthog = np.array([[-0.3639, 0.8268, 0.3570, 0.2377],
[-0.3578, -0.5330, 0.7427, 0.1906],
[-0.6208, -0.1798, -0.5609, 0.5174],
[-0.5951, 0.0024, -0.0797, -0.7997]])
@fedden
fedden / eigen.ipynb
Created November 9, 2017 00:31
Eigenvectors And Eigenvalues
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedden
fedden / pca.ipynb
Created November 9, 2017 03:18
PCA
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.