ML from Scratch
- This code does not use sklearn functions (from scratch)
- This code generate a polynomial (degree k) feature map (0 to k) using the training data (function create_poly).
- This code generate a polynomial (degree k) feature map (0 to k) plus sinusoidal function using the training data (function create_sin).
- This code fit linear model solving Ax = b (function fit)
- This code make a prediction given new inputs (function predict).
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code fits a model using Newton's method to minimize the logistic regression loss function.
- This code make a prediction given new inputs (function predict).
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- Parameters associated to Multivariate Gaussian distribution are computed: mean vectors (mu) and covariance matrix (sigma).
- This code make a prediction given new inputs (function predict).
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code implements a Generalized Linear Model with a Poisson distribution with gradient ascent.
- This code make a prediction given new inputs (function predict).
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code classifies (predicts) a message text is spam or not.
- This code make a prediction given new inputs (function predict_from_naive_bayes_model).
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code classifies (predicts) a message text is spam (1) or not (0).
- This code make a prediction given new inputs (function svm.train_and_predict_svm).
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code uses k-Means to compress a image. Where the image is reduced to 16 colors (num_clusters = 16).
- Each pixel (RGB) is assigned to the closest centroid.
python main.py
- This version of code uses sklearn functions to valid the previous results.
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code implements Gaussian Mixture Model (GMM) to apply semi-supervised EM algorithm with labelled and unlabelled data.
- E-step and M-step are computed.
- The input data (or new data) is clustered.
python main.py
- This version of code uses sklearn functions to valid the previous results (Unsupervised Expectation-Maximization).
python vscikit-learn.py
- This code does not use sklearn functions (from scratch)
- This code implements a simple neural network (NN) to classify grayscale images of handwritten digits (0 - 9) from the MNIST dataset.
- This NN has a single hidden layer (sigmoid function as activation) and cross entropy loss (softmax function for the output layer).
python main.py
- This version of code uses TensorFlow functions to valid the previous results.
python vTensorFlow.py
- This code does not use sklearn functions (from scratch)
- Parts of the code (cart and pole dynamics, and the state discretization) are inspired from code available at the RL repository http://all.cs.umass.edu//rlr//domains.html and the course XCS229 Machine Learning from Stanford University.
- The cart-pole system is described in
cartpole.py
. The main simulation loop in this file calls thesimulate()
function for simulating the pole dynamics,get_state()
for discretizing the otherwise continuous state space in discrete states, andshow_cart()
for display. - The code presented in
functions.py
shows a estimate model for the underlying Markov Decision Process (MDP), solving the Bellman's equations for this estimated MDP.
python cartpole.py
- This code does not use sklearn functions (from scratch)
- This code implements REINFORCE policy gradient algorithm to optimize on a stochastic policy that solves a simple gridded environment.
python train.py