10/18/2016
Cheat Sheet - 10 Machi ne ne Learning Algorithms & R Commands - Bytes Cravings
Bytes Cravings HOME
WEB
YOU ARE AT:
Home
»
MOBILITY Big Data
»
BIG DATA
SECURITY
SOFTWARE ENGG
CONTACT US
CAREER PLANNING
Cheat Sheet – 10 Machine Machin e Learning Algorithms & R Commands
0
Cheat Sheet – 10 Machine Learning Algorithms & R Commands BY AJITESH KUMAR ON KUMAR ON JANUARY 16, 2015
BIG DATA
OUR APPS
Data Science Capsule Quiz
This article lists down 10 popular machine learning algorithms and algorithms and related R commands commands (& (& package information) that could be used to create respective models. The objective is to represent represent a quick reference reference page for
RECENT POSTS
beginners/intermediate level R programmers who working on machine learning related pr problems. Please feel free to comment/suggest if I missed to mention one or more important points. points. Also, sorry for the the typos.
SEPTEMBER 21, 2016
0
How to Dockerize Springboot Web
Following are the dierent ML algorithms included in this article:
1. Linear regression 2. Logistic Regression 3. K-Means Clustering
App
SEPTEMBER 21, 2016
0
Java Code Sample to Access Firebase Data
4. K-Nearest Neighbors (KNN) Classication 5. Naive Bayes Classication 6. Decison Decison Trees Trees 7. Support Vector Machine (SVM)
SEPTEMBER 20, 2016
0
Liskov Substitution Principle with Java Code Examples
8. Artical Neural Network Network (ANN) 9. Apriori 10. AdaBoost
SEPTEMBER 17, 2016
0
Dockers Containers only to shine more with Kubernetes
Cheat Sheet – ML Algorithms & R Commands Linear regression: regression : “lm” method from base package could be used for linear regression models. Following is
SEPTEMBER 17, 2016
0
Springboot Web Hello World with a Java & Pom.xml ále
the sample command:
lm_model <- lm(y ~ x1 + x2, data=as.data.frame(cbind(y,x1,x2))) data=as.data.frame(cbind(y,x1,x2)))
RECENT COMMENTS
Logistic Regression: Regression : Logistic regression is a classication based model. “glm” method from base R package could be used for logistic regression. Following is the sample command:
glm_model <- glm(y ~ x1+x2, family=binomial(link="logit"), data=as.data.frame(cbind(y,x1,x2))) data=as.data.frame(cbind(y,x1,x2)))
on How to Install Oracle 11g (EE) on Ajitesh Kumar on Docker Vel on How to Install Oracle 11g (EE) on Docker
K-Means Clustering: Clustering: “kmeans” method from base R package could be used to run k-means clustering. Following is a sample command given X is a data matrix and m is the number of clusters:
kmeans_model <- kmeans(x=X, centers=m) K-Nearest Neighbors (KNN) Classicati Classication on:: “knn” method from “class” package could be used for K-NN modeling. One need to install and load “class” package. Following is the sample command given X_train represents a training dataset, X_test represents test data set, k represents number of nearest neighbors to
ADCS on on How to Measure Code Maintainability with Sonar saki on on Angular 2 – Two Ways to Initialize Component Properties Mubasher on Authentication using One Time Password (OTP) technique – Part 1
be included for the modeling
knn_model <- knn(train=X_train, test=X_test, cl=as.factor(labels), cl=as.factor(labels), k=K)
JOIN US ON FACEBOOK
Naive Bayes Classicati Classication on:: “naiveBayes” method from “e1071” package could be used for Naive Bayes classication. One need to install and load “e1071” package prior to analysis. Following is the sample command:
naiveBayes_model naiveBayes_mod el <- naiveBayes(y ~ x1 + x2, data=as.data.frame(cbind(y,x1,x2))) data=as.data.frame(cbind(y,x1,x2))) Decision Trees: Trees: “rpart” method from “rpart” can be used for Decision Trees. One need to install and load
http://vitalflux.com/cheat-sheet-10-machine-learning-algorithms-r-commands/
Software Develo er C… 1/3
10/18/2016
Cheat Sheet - 10 Machi ne Learning Algorithms & R Commands - Bytes Cravings
“rpart” package. Following is the sample command:
13,527 likes
cart_model <- rpart(y ~ x1 + x2, data=as.data.frame(cbind(y,x1,x2)), method="class") Support Vector Machine (SVM): “svm” method from “e1071” package could be used for SVM. Note that the
Like Page
Share
same package also provide method, naiveBayes, for Naive Bayes classication. One need to install and load “e1071” package. Following is the sample command given X is the matrix of features, labels be the vector of
Be the first of your friends to like this
0-1 class labels, and C being regularization parameter
svm_model <- svm(x=X, y=as.factor(labels), kernel ="radial", cost=C) Artical Neural Network (ANN) : “neuralnet” method from “neuralnet” package could be used for ANN modeling. Following is sample command:
ann_model <- neuralnet( y ~ x1 + x2 + x3, data=as.data.frame(cbind(y,x1,x2, x3)), hidden = 1)
LINKS
Prediction could be made using following formula:
p <- compute( ann_model, as.data.frame(cbind(x1,x2)) )
Apriori: “apriori” method from “arules” package could be used for Apriori analysis. One need to install and
AngularJS QuizApp (Github) Free Online Tests AngularJS Tutorials Javascript Tutorials Function Point Analysis Tool AgileSQM - Software Quality Metrics Tool
load “arules” package. Following is the sample command:
apriori_model <- apriori(as.matrix(sampleDataset), parameter = list(supp = 0.8, conf = 0.9)) AdaBoost: “ada” method from “rpart” package could be used as boosting function. Following is sample command:
boost_model <- ada(x=X, y=labels) For most of the above formulas including linear regression model, one could use following function to predict:
predicted_values <- predict(some_model, newdata=as.data.frame(cbind(x1_test, x2_test)))
About
Latest Posts
Ajitesh Kumar Ajitesh is passionate about various dierent technologies including programming languages such as Java/JEE, Javascript, PHP, .NET, C/C++, mobile programming languages etc and, computing fundamentals such as application security, cloud computing, API, mobile apps, google glass, big data etc.Recently, he has been digging deep into the eld of data science and machine learning. Follow him on Twitter and Google+.
datascience
PREVIOUS ARTICLE
Top 4 Javascript Frameworks to Watch out in 2015
NEXT ARTICLE
Data Science – List of Common Machine Learning Problems with Examples
LEAVE A REPLY
Your Comment
http://vitalflux.com/cheat-sheet-10-machine-learning-algorithms-r-commands/
2/3
10/18/2016
Cheat Sheet - 10 Machi ne Learning Algorithms & R Commands - Bytes Cravings
Your Name
Your Email
Your Website
−
= 1
POST COMMENT
http://vitalflux.com/cheat-sheet-10-machine-learning-algorithms-r-commands/
3/3