-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
27 lines (27 loc) · 1.05 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library("caret", lib.loc="D:/BA software setup/R/R-3.3.2/R-3.3.2/library")
library('caret')
set.seed(1)
set.seed(1)
load("C:/Imbalanceddataproject/.RData")
load("C:/Imbalanceddataproject/.RData")
setwd("C:/EnsemblemodelProject")
data<-read.csv("train_data.csv")
data
str(data)
sum(is.na(data))
install.packages("rann")
install.packages("RANN")
library('caret')
library("caret", lib.loc="D:/BA software setup/R/R-3.3.2/R-3.3.2/library")
preProcValues<-preProcess(data,method = c("medianImpute","center","scale"))
library('RANN')
data_processed<-predict(preProcValues,data)
sum(is.na(data_processed))
index<-createDataPartition(data_processed$Loan_Status,p=0.75,list = FALSE)
trainset<-data_processed[index,]
testset<-data_processed[-index,]
fitcontrol<-trainControl(method = "cv",number = 5,savePredictions = 'final',classProbs = T)
predictors<-c("Credit_History", "LoanAmount", "Loan_Amount_Term", "ApplicantIncome",
"CoapplicantIncome")
outcomeName<-'Loan_Status'
model_rf<-train(trainset[,predictors],trainset[,outcomeName],method='rf',trControl=fitcontrol,tuneLength=3)