documentclass: book bibliography: ./path/to/bibfile.bib csl: .csl fontsize: 12pt classoption: oneside link-citations: true color-links: true
urlcolor: "blue"
# Creates ".bashtrash" directory if it doesn't exist; then it moves things to it | |
function trash { | |
if [ ! -d "$HOME/.bashtrash" ] | |
then | |
mkdir "$HOME/.bashtrash" | |
fi | |
mv "$@" "$HOME/.bashtrash" | |
} |
## Python Commander | |
class simple_shell(): | |
def __init__(self): | |
while True: | |
self.listener() | |
## Listener Function (required) | |
def listener(self): | |
self.user_input = input('---\nuser: ').split(' ') | |
try: |
## std lib | |
import sys, os | |
## ext req | |
import autograd.numpy as np | |
from autograd import grad | |
import autograd.scipy.signal as signal | |
## _ _ _ Get Model Output _ _ _ |
## ext requirements | |
import numpy as np | |
# - - - - - - - - - - - - - - - - - - | |
# -- Model -- | |
# - - - - - - - - - - - - - - - - - - | |
## produces model outputs |
## ext requirements | |
import autograd.numpy as anp | |
from autograd import grad | |
# - - - - - - - - - - - - - - - - - - | |
# -- Model -- | |
# - - - - - - - - - - - - - - - - - - |
''' | |
Implementation of LDA with Numpy (using covariance & scatter matrix), based on this tutorial by Sebastian Raschka: https://sebastianraschka.com/Articles/2014_python_lda.html | |
''' | |
import numpy as np | |
def get_components(data: np.ndarray, labels: np.ndarray) -> np.ndarray: # <-- using covariance method | |
label_set = np.unique(labels) | |
class_means = np.array([ | |
data[labels == label,:].mean(axis = 0, keepdims = True) | |
for label in label_set |
''' | |
Implementation of PCA with Numpy (using covariance), based on this tutorial by Sebastian Raschka: https://sebastianraschka.com/Articles/2014_pca_step_by_step.html | |
''' | |
import numpy as np | |
def get_components(data: np.ndarray) -> np.ndarray: | |
cov_mat = np.cov(data.T) # <-- get the covariance matrix | |
## calculate eigenvalues of the covariance matrix | |
eig_val, eig_vec = np.linalg.eig(cov_mat) |