Book Image

Machine Learning with R Quick Start Guide

By : Iván Pastor Sanz
Book Image

Machine Learning with R Quick Start Guide

By: Iván Pastor Sanz

Overview of this book

Machine Learning with R Quick Start Guide takes you on a data-driven journey that starts with the very basics of R and machine learning. It gradually builds upon core concepts so you can handle the varied complexities of data and understand each stage of the machine learning pipeline. From data collection to implementing Natural Language Processing (NLP), this book covers it all. You will implement key machine learning algorithms to understand how they are used to build smart models. You will cover tasks such as clustering, logistic regressions, random forests, support vector machines, and more. Furthermore, you will also look at more advanced aspects such as training neural networks and topic modeling. By the end of the book, you will be able to apply the concepts of machine learning, deal with data-related problems, and solve them using the powerful yet simple language that is R.
Table of Contents (9 chapters)

Data overview

First, we are going to analyze the types of variables that we have in the dataset. For that, we can use the class function, which tells us whether a variable is a number, a character, or a matrix. For example, the class of the identifying number of a bank ID_RSSD can be obtained as follows:

class(Model_database$ID_RSSD)

## [1] "integer"

This function indicates that this variable is a number without decimals.

We can calculate the same information for all the variables and store it using the following code:

 classes<-as.data.frame(sapply(Model_database, class))
classes<-cbind(colnames(Model_database),classes)
colnames(classes)<-c("variable","class")

With sapply, calculate iteratively the class function on the dataset. Then, combine the name of variables with the class in only a data frame, and, finally, rename the resulting dataset...