INTRODUCTION
Dear reader,
If you lot are a newbie inwards the globe of machine learning, thence this tutorial is precisely what you lot require inwards gild to innovate yourself to this exciting novel business office of the information scientific discipline world.
This post service includes a total machine learning projection that volition guide you lot measurement past times measurement to do a “template,” which you lot tin purpose later on on other datasets.
Before proceeding, delight follow our short tutorial.
Look at the examples given together with endeavor to sympathize the logic behind them. Then endeavor to solve the exercises below using R together with without looking at the answers. Then depository fiscal establishment lucifer the solutions.to depository fiscal establishment lucifer your answers.
Look at the examples given together with endeavor to sympathize the logic behind them. Then endeavor to solve the exercises below using R together with without looking at the answers. Then depository fiscal establishment lucifer the solutions.to depository fiscal establishment lucifer your answers.
Exercise 1
Create a listing of 80% of the rows inwards the master copy dataset to purpose for training. HINT: Use
createDataPartition()
. Exercise 2
Select 20% of the information for validation.
Exercise 3
Use the remaining 80% of information to prepare together with seek the models.
Exercise 4
Find the dimensions of the “iris” dataset. HINT: Use
dim()
. Exercise 5
Find the type of each attribute inwards your dataset. HINT: Use
sapply()
. Exercise 6
Take a await at the offset v rows of your dataset. HINT: Use
head()
. Exercise 7
Find the levels of the variable “Species.” HINT: Use
levels()
. Exercise 8
Find the percentages of rows that belong to the labels you lot establish inwards Exercise 7. HINT: Use
prop.table()
and table()
. Exercise 9
Display the absolute count of instances for each course of report equally good equally its percentage. HINT: Use
cbind()
. Exercise 10
Display the summary of the “iris” dataset. HINT: Use
summary()
. _________________________________
Below are the solutions to these exercises on summarizing datasets to employ machine learning.
#################### # # # Exercise 1 # # # #################### library(caret) data(iris) validation <- createDataPartition(iris$Species, p=0.80, list=FALSE) #################### # # # Exercise ii # # # #################### library(caret) data(iris) validation <- createDataPartition(iris$Species, p=0.80, list=FALSE) validation20 <- iris[-validation,] #################### # # # Exercise three # # # #################### library(caret) data(iris) validation <- createDataPartition(iris$Species, p=0.80, list=FALSE) validation20 <- iris[-validation,] iris <- iris[validation,] #################### # # # Exercise four # # # #################### library(caret) dim(iris) #################### # # # Exercise v # # # #################### library(caret) sapply(iris, class) #################### # # # Exercise vi # # # #################### library(caret) head(iris) #################### # # # Exercise vii # # # #################### library(caret) levels(iris$Species) #################### # # # Exercise 8 # # # #################### library(caret) percentage <- prop.table(table(iris$Species)) * 100 #################### # # # Exercise nine # # # #################### library(caret) percentage <- prop.table(table(iris$Species)) * 100 cbind(freq=table(iris$Species), percentage=percentage) #################### # # # Exercise 10 # # # #################### library(caret) summary(iris)
Sources:
http://www.r-exercises.com/2017/09/01/summarizing-dataset-to-apply-machine-learning-exercises/
http://www.r-exercises.com/2017/09/01/summarizing-dataset-to-apply-machine-learning-exercises-solutions/