K-Means is one of the simplest unsupervised clustering algorithm which is used to cluster our data into K number of clusters. The algorithm iteratively assigns the data points to one of the K clusters based on how near the point is to the cluster centroid. The result of K-Means algorithm is: K number of cluster […]
Understanding Support vector Machines using Python
Support Vector machines (SVM) can be used for both classification as well as regression tasks but they are mostly used in classification applications. Some of the real world applications include Face detection, Handwriting detection, Document categorisation, SPAM Filtering, image classification and protein remote homology detection. For many researchers, SVM is the first best choice for […]
Simple example of Polynomial regression using Python
Previously I wrote an article explaining the underlying maths behind polynomial regression. In this post I will use Python libraries to regress a simple dataset to see polynomial regression in action. If you want to fully understand the internals I recommend you read my previous post. Polynomial regression is a method of finding an nth […]
Maths behind Polynomial regression
Polynomial regression is a process of finding a polynomial function that takes the form f( x ) = c0 + c1 x + c2 x2 โฏ cn xn where n is the degree of the polynomial and c is a set of coefficients. Through polynomial regression we try to find an nth degree polynomial function which is the closest approximation of our data points. Below is a sample random dataset which has been regressed […]
Multiple Linear Regression with Python on Framingham Heart Study data
Previously we built a simple linear regression model using a single explanatory variable to predict the price of pizza from its diameter. But in the real world the price of pizza cannot be entirely derived from the diameter of its base alone. It also depends on the toppings, which means there are a many more […]
Evaluating the fitness of a modal with a cost function
Previously we derived a simple linear regression modal for our Pizza price dataset. We built a modal that predicted a price of $13.68 for a 12 inch pizza. When the same modal is used to predict the price of an 8 inch pizza, we get $9.78 which is around $0.78 more than the known price of $9. […]
Math behind Linear Regression with Python code
Simple linear regression is a statistical method you can use to study relationships between two continuous (quantitative) variables: independent variable (x) – also referred to as predictor or explanatory variable dependant variable (y) – also referred to as response or outcome The goal of any regression model is to predict the value of y (dependant variable) based on the […]
Instagram quotes generator using Python PIL
I am using Python’s Pillow library for image creation.You can even install it using pip. You can get the detailed installation instructions here. Instagram’s default post size is 612px 612px so first let me create a 612px square white box. Now lets put our quote inside this white box. Below is output image from the […]
A lesson on Elementary Worldly Wisdon
A famous talk by Charlie Munger at USC Business School in 1994 entitled A Lesson on Elementary Worldly Wisdom. I’m going to play a minor trick on you today because the subject of my talk is the art of stock picking as a subdivision of the art of worldly wisdom. That enables me to start […]
Possibly the easiest explanation of differentiation and Integration in Calculus
I have read a lot of books on Calculus but “Calculus Made Easy” by Silvanus P. Thompson stands out as possibly the easiest book to read on this topic. It totally lives up to its name. The first chapter opens up with an impressive introduction on the difference between dx &ย โซ.ย d which merely means […]