Learn R Programming

Rprofet (version 3.1.1)

WOEProfet: WOE Transformation

Description

Function that calculates the WOE for each bin and the information value for each variable.

Usage

WOEProfet(data, id, target, varcol)

Value

A list with the following components.

Bin

Dataframe with the binned variables and their WOE values.

WOE

Dataframe with the WOE values.

IV

Each attribute and their associated information values.

vars

A list containing the different WOE values for each attribute.

Arguments

data

Dataframe of binned variables.

id

ID variable.

target

A binary target variable.

varcol

Vector of variables to have WOE transformation.

Examples

Run this code
mydata <- ISLR::Default
mydata$ID = seq(1:nrow(mydata)) ## make the ID variable
mydata$default<-ifelse(mydata$default=="Yes",1,0) ## Creating numeric binary target variable
binned <- BinProfet(mydata, id= "ID", target= "default", num.bins = 5) ## Binning variables
WOE_dat <- WOEProfet(binned, "ID", "default", 3:5)
head(WOE_dat$Bin)
head(WOE_dat$WOE)
WOE_dat$IV
head(WOE_dat$vars$income)

Run the code above in your browser using DataLab