Posts

Showing posts with the label ML

Logistic Regression using matlab

Image
Logistic Regression is one of the most famous classification algorithms, like Linear Regression we discussed before , it is easy to implement and gives great predictions. The Logistic Regression algorithm has two major categories: Binary-Class: where the result is 0 or 1 (belong to a certain class or not), an example of it is the spam email detection problem, where the result could be 0 (not spam), or 1 (spam).  Multi-Class: where the result could be any value in the range (0..n), where n is the number of classes, an example of it it the handwritten digit recognition, where we have 10 classes (n = 10), each class represent a number between 0 and 9. Implementing Binary-Class Logistic Regression using matlab is similar to implementing Linear Regression, with some modifications of the hypothesis and cost function formulas. In this video, I implement the algorithm using matlab:

Linear Regression using matlab

Image
Linear Regression is a powerful algorithm when it comes to prediction, you only have to give it some training data that contains the properties and result for each sample, then it will draw a regression line through the data, and predict the results for a new set of properties without previously seeing them by the algorithm. Implementing Linear Regression is a fun task, because it's not that hard to do, plus the outcome will be very useful. In this video, I'm implementing Linear Regression using matlab, the training data consist of the population of a city, and the profit a company gaining from it, the algorithm should predict the profit for new cities given the population.  you can find the code on github: Code Here