-
Notifications
You must be signed in to change notification settings - Fork 3
/
credit-cards-ppt.Rmd
89 lines (67 loc) · 1.98 KB
/
credit-cards-ppt.Rmd
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
title: "Maching Learning in R using mlR"
author: "Surag Gupta"
date: "August 20, 2017"
output: beamer_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,
cache = TRUE)
```
## About me
- Senior Analyst, Assortment Optimization
- MS Business Analytics, University of Minnesota (Class of 2017)
- which means I'm a relatively new team member
- Worked as a Decision Scientist for 3 years prior to my graduate program
- R Enthusiast (This would be a good time for you to notice my t-shirt, if you haven't already)
## Disclaimer
Those who use Python for data science tasks shall not throw stuff at me during the session
## What is mlR?
mlR is an R package developed to simplify basic and advanced data science tasks, such as:
- Data preparation
- Feature Engineering
- Training Models
- Validating models
- Predictions
- ...
## We use the Kaggle credit card dataset to demonstrate the use of `mlR`
## Load packages
```{r cars, echo = FALSE, message = FALSE}
required_packages <- c(
# Add to this list the packages that you will use - if unavailable, it will be
# automatically installed
"Hmisc",
"caret",
"kknn",
"gbm",
"nnet",
"h2o",
"xgboost",
"lightgbm",
"mlr",
"parallel",
"parallelMap",
"ggplot2",
"data.table",
"tidyverse"
)
packages_to_install = required_packages[!(required_packages %in%
installed.packages()[, 1])]
if (length(packages_to_install) > 0) {
install.packages(packages_to_install)
}
suppressPackageStartupMessages({
sapply(required_packages, require, character.only = TRUE)
})
```
## Import the dataset
```{r message = FALSE, results = "hide"}
#Use fread() from the data.table package to read
df <- fread("creditcard.csv")
df <- df %>%
data.frame() %>%
mutate(Class = as.factor(Class)) #Convert target variable to categorical type
```
```{r}
head(df)
```