Browse Category Machine Learning

Gradient Descent Algorithm Matlab Implementation

Here’s a very basic Matlab implementation of the gradient descent algorithm for linear regression. The following plot shows the cost for every iteration in the algorithm. It should be decreasing function as in each iteration we try to move towards the global minimum direction.

Read more

KNN Algorithm Matlab Implementation

This is a KNN algorithm implementation written in Matlab. In this example, I’m just using some random numbers for X, Y, and the according labels. There are 3 classes differentiated by color. For the distance I chose Euclidean distance. The algorithm loops through all records in the dataset, finds K closest neighbor points, and predict […]

Read more