We are committed to bringing you 100% authentic exercise sets. We even try to include as different datasets as possible to give you an understanding of different problems. No more classifying Titanic dataset. R has tons of datasets in its library. This is to encourage you to try as many datasets as possible. We will […]

## Model Evaluation 2

Below are the solutions to these exercises on model evaluation ############### # # # Exercise 1 # # # ############### library(ROCR) ## Warning: package ‘ROCR’ was built under R version 3.3.2 ## Warning: package ‘gplots’ was built under R version 3.3.2 library(caTools) library(caret) data("GermanCredit") df1=GermanCredit df1$Class=ifelse(df1$Class=="Bad",1,0) set.seed(100) spl=sample.split(df1$Class,SplitRatio = 0.7) Train1=df1[spl==TRUE,] Test1=df1[spl==FALSE,] model1=glm(Class~.,data=Train1,family = binomial) […]

## Basic Tree 2 Exercises

This is a continuation of the exercise Basic Tree 1 Answers to the exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page. Exercise 1 load the tree library. If it is not installed […]

## Basic Tree 2 Solutions

Below are the solutions to these exercises on basic tree lens=read.csv("C:/Contract/lens/lenses.csv") colnames(lens) <- c("index","age","spec_pres","astigmatic","tpr","class") lens$age[lens$age == "1"]="young" lens$age[lens$age == "2"]="pre-presbyopic" lens$age[lens$age == "3"]="presbyopic" lens$spec_pres[lens$spec_pres=="1"]="myope" lens$spec_pres[lens$spec_pres=="2"]="hypermetrope" lens$astigmatic=as.character(lens$astigmatic) lens$astigmatic[lens$astigmatic=="1"]="no" lens$astigmatic[lens$astigmatic=="2"]="yes" lens$tpr[lens$tpr==1]="reduced" lens$tpr[lens$tpr=="2"]="normal" table(lens$astigmatic) ## ## g no yes ## 2 1 10 10 lens=lens[lens$astigmatic!="g",] lens=lens[-1] ############### # # # Exercise 1 # # # ############### library(tree) ## […]

## Basic Tree 1 Solutions

Below are the solutions to these exercises on basic tree ############### # # # Exercise 1 # # # ############### lens=read.csv("C:/Contract/lens/lenses.csv") str(lens) ## ‘data.frame’: 23 obs. of 6 variables: ## $ X1 : int 2 3 4 5 6 7 8 9 10 11 … ## $ X1.1: int 1 1 1 1 1 1 […]

## Basic Tree 1 Exercises

Using the knowledge you acquired in the previous exercises on sampling and selecting(here), we will now go through an entire data analysis process. You will be using what you know as crutches to solve the problems. Don’t worry. It might look intimidating but follow the sequence and you will see that modeling a decision tree […]

## Select and Query Exercise

In this exercise we cover the basics on selecting and extracting data using queries. We add a few other materials into it. This should prepare you for the next exercise: Basic Decision Tree. The purpose of this is to give you the 20 percent of the tools to get 80 percent of work done. You […]

## Select and Query Solutions

Below are the solutions to these exercises on selecting and querying data ############### # # # Exercise 1 # # # ############### a=c(4,5,6,8,3) b=c("apple","chair","jetplane","salmon","island") c=c(TRUE,TRUE,FALSE,TRUE,FALSE) ############### # # # Exercise 2 # # # ############### df=data.frame(a,b,c) ############### # # # Exercise 3 # # # ############### str(df) ## ‘data.frame’: 5 obs. of 3 variables: ## […]

## Model Evaluation Exercises 1

We are committed to bringing you 100% authentic exercise sets. We even try to include as different datasets as possible to give you an understanding of different problems. No more classifying Titanic dataset. R has tons of datasets in its library. This is to encourage you to try as many datasets as possible. We will […]

## Model Evaluation Solutions 1

Below are the solutions to these exercises on model evaluation ############### # # # Exercise 1 # # # ############### 3/5 ## [1] 0.6 3/7 ## [1] 0.4285714 ############### # # # Exercise 2 # # # ############### 100 ## [1] 100 24 ## [1] 24 94 ## [1] 94 23 ## [1] 23 ############### […]