Machine Learning in R, in a nutshell

2 Min Read

Josh Reich has created a concise R script demonstrating various machine-learning techniques in R with simple, self-contained examples. For example, here’s the code for K-means clustering:

k <- kmeans(train[,1:2],="">
plot(train[,1:2], type='n')
text(train[,1:2], as.character(k$cluster))
cm (train$class, k$cluster)

The techniques illustrated include:
  • K-means clustering
  • K nearest neighbours clustering 
  • Kernel clustering (via hand-rolled code) 
  • Recursive partitioning (regression trees) 
  • Principal Components Analysis (PCA) 
  • Linear Discriminant Analysis (LDA)
  • Support Vector Machines (SVM)
While the code is concise, Josh also provides extensive comments explaining how the techniques work and are implemented in R. He’s also provided some slides to go with the script which go over the fundamentals of machine learning techniques. This is a great place to start if you’re thinking about doing some predictive analytics in R. (And don’t forget to check out the Machine Learning Task View on CRAN, too.)

i2pi: Machine Learning demo script and slides

Link to original post

Josh Reich has created a concise R script demonstrating various machine-learning techniques in R with simple, self-contained examples. For example, here’s the code for K-means clustering:

k <- kmeans(train[,1:2], 3)
plot(train[,1:2], type='n')
text(train[,1:2], as.character(k$cluster))
cm (train$class, k$cluster)

The techniques illustrated include:
  • K-means clustering
  • K nearest neighbours clustering 
  • Kernel clustering (via hand-rolled code) 
  • Recursive partitioning (regression trees) 
  • Principal Components Analysis (PCA) 
  • Linear Discriminant Analysis (LDA)
  • Support Vector Machines (SVM)
While the code is concise, Josh also provides extensive comments explaining how the techniques work and are implemented in R. He’s also provided some slides to go with the script which go over the fundamentals of machine learning techniques. This is a great place to start if you’re thinking about doing some predictive analytics in R. (And don’t forget to check out the Machine Learning Task View on CRAN, too.)

i2pi: Machine Learning demo script and slides

Link to original post

Share This Article
Exit mobile version