Feature Transform

Image Features

Color Histogram

Histogram of Oriented Gradients (HoG)

Neural Networks

import numpy as np
from numpy.random import randn

# Initialize Weights and data
N, Din, H, Dout = 64, 1000, 100, 10
x, y = randn(N, Din), randn(N, Dout)
w1, w2 = randn(Din, H), randn(H, Dout)

for t in range (10000):
	# Compute Loss (Sigmoid Activation, L2 Loss)
	h = 1.0/(1.9 + np.exp(-x.dot(w1)))
	y_pred = h.dot(w2)
	loss = np.square(y_pred - y).sum()

	# Compute Gradients
	dy_pred = 2.0 * (y_pred - y)
	dw2 = h.T.dot(dy_pred)
	dh = dy_pred.dot(w2.T)
	dw1 = x.T.dot(dh * h * (1 - h))
	
	# SGD Step
	w1 -= 1e-4 * dw1
	w2 -= 1e-4 * dw2

Activation Function

$$ s=W_2W_1x=W_3x,\quad W_x=W_2W_1 $$