Cheatsheet – Python & R codes for common Machine Learning Algorithms

avcontentteam 26 Jun, 2020 • 2 min read

Introduction

In his famous book – Think and Grow Rich, Napolean Hill narrates story of Darby, who after digging for a gold vein for a few years walks away from it when he was three feet away from it.

Now, I don’t know whether the story is true or false. But, I surely know of a few Data Darby around me. These people understand the purpose of machine learning, its execution and use just a set 2 – 3 algorithms on whatever problem they are working on. They don’t update themselves with better algorithms or techniques, because they are too tough or they are time consuming.

Like Darby, they are surely missing from a lot of action after reaching this close! In the end, they give up on machine learning by saying it is very computation heavy or it is very difficult or I can’t improve my models above a threshold – what’s the point? Have you heard them?

Today’s cheat sheet aims to change a few Data Darby’s to machine learning advocates. Here’s a collection of 10 most commonly used machine learning algorithms with their codes in Python and R. Considering the rising usage of machine learning in building models, this cheat sheet is good to act as a code guide to help you bring these machine learning algorithms to use. Good Luck!

For the super lazy Data Darbies, we will make your life even easier. You can download the PDF Version of the cheat sheet here and copy paste the codes from it directly.

machine learning algorithms, data science infographics

Keep this cheat sheet handy when you work on data sets. download the complete cheat sheet here: PDF Version

If you like what you just read & want to continue your analytics learning, subscribe to our emailsfollow us on twitter or join our Facebook Group

avcontentteam 26 Jun 2020

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers

Clear

venugopal
venugopal 15 Sep, 2015

Good Compilation...

Indu
Indu 15 Sep, 2015

Thanks for sharing this in both R and Python. Very helpful. It would be nice to have datasets to accompany this code for those who are just starting out....

Huaixiu Zheng
Huaixiu Zheng 17 Sep, 2015

thanks for sharing

Richard Boire
Richard Boire 17 Sep, 2015

This is good stuff. My only commentary is the following: I could not find anything in the code that deals with validation. This is a must in all models and their evaluation(i.e. how well the model performs in a holdout group). Evaluating the model based on its predicted output to observed output in the training data can be misleading because certain techniques have a tendency to overfit(i.e. neural nets) where holdout groups are essential in effectively evaluating model performance .

Kayla
Kayla 18 Sep, 2015

Awesome! Thank you!

greg
greg 21 Sep, 2015

thanks

andun
andun 23 Sep, 2015

For kNN in R, the package knn is no longer available. The function knn can be found in the "class" package, but I don't think it takes the arguments the way you specified. I guess you can also use caret for that.

Gaurav
Gaurav 24 Sep, 2015

Thx for sharing. In R we can implement stepwise regression.whats the equivalent in python.

Raman
Raman 12 Oct, 2015

Very thoughtfully compiled and presented. Thanks for posting something very useful!

Jared
Jared 13 Nov, 2015

The download link has been invalid for China's mainland users. I tried to register the website but filed. Can someone please send the PDF file to my email ?

venugopal
venugopal 28 Nov, 2015

GooD one. Please share PDF file to my mail as well

Shikhar Pandey
Shikhar Pandey 29 Nov, 2015

Please share the PDF with me

socialin
socialin 28 Dec, 2015

"The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: incorrect-captcha-sol)" The above messages prompted when I tried to register to download the pdf,I looked it up,it's about verify something,but I can't find the verify part anywhere.so that means I can't download it.Anyone know what's going on?

socialin
socialin 28 Dec, 2015

Can i get it in my email?Thanks!

deepa
deepa 01 Feb, 2016

thank you

Manya
Manya 10 Feb, 2016

Thank you

rajanikanth
rajanikanth 11 Feb, 2016

pl fix the download link

dieudonne
dieudonne 22 Feb, 2016

can i get a copy by my email? thank you . [email protected]

mobile live porn cam
mobile live porn cam 09 Jun, 2016

Can I simply just say what a comfort to uncover somebody that actually understands what they are discussing on the net. You certainly understand how to bring an issue to light and make it important. More people ought to read this and understand this side of your story. I was surprised that you aren't more popular given that you surely possess the gift.

Tikbal
Tikbal 15 Jun, 2016

there is a problem with the pdf link

Juan Pablo Garicoïts
Juan Pablo Garicoïts 17 Jul, 2016

Nice compilation

gelou88
gelou88 23 Aug, 2016

just to the point

stephen
stephen 26 Aug, 2016

Please share it with me thanks.

Manoj
Manoj 26 Aug, 2016

Thanks for sharing. It's great help.

Vighneshwar Eligeti
Vighneshwar Eligeti 18 Sep, 2016

can i get a copy by my email? thank you . [email protected]

Prateek Tandon
Prateek Tandon 25 Oct, 2016

Good work. For code snippets though, using gists is more friendly to make updates as per updates to libraries etc.

Muhammad Fahmi Adli
Muhammad Fahmi Adli 07 Nov, 2016

Can I get that copy code by email? Thank you. My email is [email protected].

Brenda
Brenda 10 Nov, 2016

please share the pdf to my email Thank you. God bless.

Harsh
Harsh 04 Jan, 2017

Excellent piece of information. Posting both R and Python code is helpful in choosing which one to use for ML. Cheers! and Keep up the good work!

kk7
kk7 27 Sep, 2017

Very nicely Scripted...Kudos