Machine learning with numpy

Background: In order to understand a little bit more about some of the mainstream machine learning algorithms, I decided to build those models from scratch using NumPy and compare them with their off-the-shelf counterparts available in scikit-learn.

This is the project repository and the supported machine learning models are:

  1. Linear Regression
  2. Principal Components Analysis (PCA)
  3. k-Nearest Neighbors Regression

I tried to make the numpy model act similarly to the sklearn models, so that users should be able to use it rightaway to train, predict, and validate the models. For example:

# ------ KNN with scikit-learn ------
from sklearn import neighbors
knn_sk = neighbors.KNeighborsRegressor(n_neighbors)
model_sk = knn_sk.fit(X, y)
y_sk = model_sk.predict(T)

# ------ KNN with NumPy -----
from models import knn-
knn_np = knn.KNeighborsRegressor(k=n_neighbors)
model_np = knn_np.fit(X, y)
y_np = model_np.predict(T)

The other testing comparisons are available here in /benchmarks/.