4.25 out of 5
4.25
81 reviews on Udemy

# Case Studies in Data Mining with R

Learn to use the "Data Mining with R" (DMwR) package and R software to build and evaluate predictive data mining models.
Understand how to implement and evaluate a variety of predictive data mining models in three different domains, each described as extended case studies: (1) harmful plant growth; (2) fraudulent transaction detection; and (3) stock market index changes.
Perform sophisticated data mining analyses using the "Data Mining with R" (DMwR) package and R software.
Have a greatly expanded understanding of the use of R software as a comprehensive data mining tool and platform.
Understand how to implement and evaluate supervised, semi-supervised, and unsupervised learning algorithms.

### A Brief Introduction to R and RStudio using Scripts

1
Course Overview
2
Introduction to R for Data Mining
3
Data Structures: Vectors (part 1)

A vector is a sequence of data elements of the same basic type. Members in a vector are officially called components. Nevertheless, we will just call them members in this site.

Here is a vector containing three numeric values 2, 3 and 5.

> c(2, 3, 5)
 2 3 5

And here is a vector of logical values.

> c(TRUE, FALSE, TRUE, FALSE, FALSE)
 TRUE FALSE TRUE FALSE FALSE

A vector can contain character strings.

> c("aa", "bb", "cc", "dd", "ee")
 "aa" "bb" "cc" "dd" "ee"

4
Data Structures: Vectors (part 2)
5
Factors (part 1)

The function `factor` is used to encode a vector as a factor (the terms 'category' and 'enumerated type' are also used for factors). If argument `ordered` is `TRUE`, the factor levels are assumed to be ordered. For compatibility with S there is also a function `ordered`.

`is.factor`, `is.ordered`, `as.factor` and `as.ordered` are the membership and coercion functions for these classes.

6
Factors (part 2)
7
Generating Sequences

seq() is the R function that will produce an enumerated vector.

8
Indexing (aka Subscripting or Subsetting)

Given a vector of data one common task is to isolate particular entries or censor items that meet some criteria.

9
Data Structures: Matrices and Arrays (part 1)

A matrix is a collection of data elements arranged in a two-dimensional rectangular layout.

10
Data Structures: Matrices and Arrays (part 2)

An array in R can have one, two or more dimensions. It is simply a vector which is stored with additional attributes giving the dimensions (attribute `"dim"`) and optionally names for those dimensions (attribute `"dimnames"`).

11
Data Structures: Lists

A list is an R structure that may contain object of any other types, including other lists. Lots of the modeling functions (like t.test() for the t test or lm() for linear models) produce lists as their return values, but you can also construct one yourself:

` mylist <- list (a = 1:5, b = "Hi There", c = function(x) x * sin(x)) `
12
Data Structures: Dataframes (part 1)

A data frame is a list of variables of the same number of rows with unique row names, given class `"data.frame"`. If no variables are included, the row names determine the number of rows.

13
Data Structures: Dataframes (part 2)
14
Creating New Functions

### Inputting and Outputting Data and Text

1
Using the scan() Function for Input (part 1)

The scan() function in R reads data into a vector or list from the console or file.

2
Using the scan() Function for Input (part 2)
3
Using readline(), cat() and print() Functions

The readline() function in R reads a line from the terminal (in interactive use).

4
Using readLines() Function and Text Data

5
Example Program: powers.r
6
Example Program: quartiles1.r
7
8
Reading and Writing Files (part 1)
9
Reading and Writing Files (part 2)

### Introduction to Predicting Algae Blooms

1
Predicting Algae Blooms

This case study introduces you to some basic tasks of data mining: data pre-processing, exploratory data analysis, and predictive model construction. This initial case study studies a relatively small problem by data mining standards. Namely, the case addresses the problem of predicting the frequency occurrence of several harmful algae in water samples.

2
Data Visualization and Summarization: Histograms

A histogram is a graphical representation of the distribution of numerical data. It is an estimate of the probability distribution of a continuous variable (quantitative variable) and was first introduced by Karl Pearson.

3
Data Visualization: Boxplot and Identity Plot

The box plot (a.k.a. box and whisker diagram) is a standardized way of displaying the distribution of data based on the five number summary: minimum, first quartile, median, third quartile, and maximum.

4
Data Visualization: Conditioning Plots

Conditioning Plot. Purpose: Check pairwise relationship between two variables conditional on a third variable. A conditional plot, also known as a coplot or subset plot, is a plot of two variables contional on the value of a third variable (called the conditioning variable).

5
Imputation: Dealing with Unknown or Missing Values

In statistics, imputation is the process of replacing missing data with substituted values. When substituting for a data point, it is known as "unit imputation"; when substituting for a component of a data point, it is known as "item imputation". Because missing data can create problems for analyzing data, imputation is seen as a way to avoid pitfalls involved with listwise deletion of cases that have missing values. That is to say, when one or more values are missing for a case, most statistical packages default to discarding any case that has a missing value, which may introduce bias or affect the representativeness of the results. Imputation preserves all cases by replacing missing data with a probable value based on other available information. Once all missing values have been imputed, the data set can then be analysed using standard techniques for complete data

6
Imputation: Removing Rows with Missing Values
7
Imputation: Replace Missing Values with Central Measures
8
Imputation: Replace Missing Values through Correlation
9
Visualizing other Imputations with Lattice Plots

The lattice package, written by Deepayan Sarkar, attempts to improve on base R graphics by providing better defaults and the ability to easily display multivariate relationships. In particular, the package supports the creation of trellis graphs - graphs that display a variable or the relationship between variables, conditioned on one or more other variables.

### Obtaining Prediction Models

1
2
Creating Prediction Models
3
Examine Alternative Regression Models

In statistics, regression analysis is a statistical process for estimating the relationships among variables. It includes many techniques for modeling and analyzing several variables, when the focus is on the relationship between a dependent variable and one or more independent variables (or 'predictors').

4
Regression Trees

Regression trees are for dependent variables that take continuous or. ordered discrete values, with prediction error typically measured by the squared. difference between the observed and predicted values.

5
Strategy for Pruning Trees

### Evaluating and Selecting Models

1
Alternative Model Evaluation Criteria
2
Introduction to K-Fold Cross-Validation

Cross-validation, sometimes called rotation estimation, is a model validation technique for assessing how the results of a statistical analysis will generalize to an independent data set. It is mainly used in settings where the goal is prediction, and one wants to estimate how accurately a predictive model will perform in practice. In a prediction problem, a model is usually given a dataset of known data on which training is run (training dataset), and a dataset of unknown data (or first seen data) against which the model is tested (testing dataset). The goal of cross validation is to define a dataset to "test" the model in the training phase (i.e., the validation dataset), in order to limit problems like overfitting, give an insight on how the model will generalize to an independent dataset (i.e., an unknown dataset, for instance from a real problem), etc.

3
Setting up K-Fold Evaluation (part 1)

In k-fold cross-validation, the original sample is randomly partitioned into k equal sized subsamples. Of the k subsamples, a single subsample is retained as the validation data for testing the model, and the remaining k − 1 subsamples are used as training data. The cross-validation process is then repeated k times (the folds), with each of the k subsamples used exactly once as the validation data. The k results from the folds can then be averaged (or otherwise combined) to produce a single estimation. The advantage of this method over repeated random sub-sampling (see below) is that all observations are used for both training and validation, and each observation is used for validation exactly once. 10-fold cross-validation is commonly used

4
Setting up K-Fold Evaluation (part 2)
5
Best Model (part 1)
6
Best Model (part 2)
7
Finish Evaluating Models
8
Predicting from the Models
9
Comparing the Predictions

### Examine the Data in the Fraudulent Transactions Case Study

1
Exercise Solution from Evaluating and Selecting Models
2
Fraudulent Case Study Introduction

This case study addresses an instantiation of the general problem of detecting unusual observations of a phenomena, that is, finding rare and quite different observations. The driving application has to do with transactions of a set of products that are reported by the salespeople of some company. The goal is to find "strange" transaction reports that may indicate fraud attempts by some of the salespeople.

3
Prelude to Exploring the Data
4
Exploring the Data

Data visualization is the presentation of data in a pictorial or graphical format. For centuries, people have depended on visual representations such as charts and maps to understand information more easily and quickly.

5
Exploring the Data Continued (part 1)
6
Exploring the Data Continued (part 2)
7
Exploring the Data Continued (part 3)
8
Dealing with Missing Data (part 1)
9
Dealing with Missing Data (part 2)
10
Dealing with Missing Data (part 3)

### Pre-Processing the Data to Apply Methodology

1
Review the Data and the Focus of the Fraudulent Transactions Case
2
Pre-Processing the Data (part 1)
3
Pre-Processing the Data (part 2)

Here we explain the whys and hows of creating a list structure containing the unit prices by product.

4
Pre-Processing the Data (part 3)
5

In supervised learning the categories, data is assigned to are known before computation. So they are being used in order to 'learn' the parameters that are really significant for those Clusters. In unsupervised learning Datasets are assigned to segments, without the clusters being known.

6
Semi-Supervised Techniques

Semi-supervised learning is a class of supervised learning tasks and techniques that also make use of unlabeled data for training - typically a small amount of labeled data with a large amount of unlabeled data.

7
Precision and Recall

In pattern recognition and information retrieval with binary classification, precision (also called positive predictive value) is the fraction of retrieved instances that are relevant, while recall (also known as sensitivity) is the fraction of relevant instances that are retrieved.

8
Lift Charts and Precision Recall Curves

Lift is a measure of the effectiveness of a predictive model calculated as the ratio between the results obtained with and without the predictive model. Cumulative gains and lift charts are visual aids for measuring model performance. Both charts consist of a lift curve and a baseline.

### Methodology to Find Outliers (Fraudulent Transactions)

1
Exercise from Previous Session
2
Review Precision and Recall
3
Review Lift Charts and Precision Recall Curves
4
Cumulative Recall Chart
5
Creating More Functions for the Experimental Methodology
6
Experimental Methodology to find Outliers (part 1)
7
Experimental Methodology to find Outliers (part 2)

An outlier is an observation that lies outside the overall pattern of a distribution (Moore and McCabe 1999). Usually, the presence of an outlier indicates some sort of problem. This can be a case which does not fit the model under study, or an error in measurement. Outliers are often easy to spot in histograms.

8
Experimental Methodology to find Outliers (part 3)
9
Experimental Methodology to find Outliers (part 4)
10
Experimental Methodology to find Outliers (part 5)

### The Data Mining Tasks to Find the Fraudulent Transactions

1
Review of Fraud Case (part 1)
2
Review of Fraud Case (part 2)
3
Review of Fraud Case (part 3)
4
Baseline Boxplot Rule
5
Local Outlier Factors
state-of-the-art outlier ranking method. The main idea of this system is to

try to obtain an outlyingness score for each case by estimating its degree of

isolation with respect to its local neighborhood. The method is based on the

notion of the local density of the observations. Cases in regions with very low

density are considered outliers. The estimates of the density are obtained using

the distances between cases.

6
Plotting Everything
7
Supervised and Unsupervised Approaches

From a theoretical point of view, supervised and unsupervised learning differ only in the causal structure of the model. In supervised learning, the model defines the effect one set of observations, called inputs, has on another set of observations, called outputs. In other words, the inputs are assumed to be at the beginning and outputs at the end of the causal chain. The models can include mediating variables between the inputs and outputs. In unsupervised learning, all the observations are assumed to be caused by latent variables, that is, the observations are assumed to be at the end of the causal chain. In practice, models for supervised learning often leave the probability for inputs undefined. This model is not needed as long as the inputs are available, but if some of the input values are missing, it is not possible to infer anything about the outputs. If the inputs are also modelled, then missing inputs cause no problem since they can be considered latent variables as in unsupervised learning.

8
SMOTE and Naive Bayes (part 1)
9
SMOTE and Naive Bayes (part 2)

### Sidebar on Boosting

1
Introduction to Boosting (from Rattle course)
2
Boosting Demo Basics using R

Boosting is a machine learning ensemble meta-algorithm for reducing bias primarily and also variance in supervised learning, and a family of machine learning algorithms which convert weak learners to strong ones.

3
Replicating Adaboost using Rpart (Recursive Partitioning) Package

Recursive partitioning is a statistical method for multivariable analysis. Recursive partitioning creates a decision tree that strives to correctly classify members of the population by splitting it into sub-populations based on several dichotomous independent variables.

4
Replicating Adaboost using Rpart (part 2)

AdaBoost, short for "Adaptive Boosting", is a machine learning meta-algorithm formulated by Yoav Freund and Robert Schapire who won the prestigious "Gödel Prize" in 2003 for their work.

5
Boosting Extensions and Variants
6
Boosting Exercise

### Introduction to Stock Market Prediction Case Study

You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.3
4.3 out of 5
81 Ratings

#### Detailed Rating

 Stars 5 29 Stars 4 28 Stars 3 16 Stars 2 6 Stars 1 2
30-Day Money-Back Guarantee

#### Includes

22 hours on-demand video
Access on mobile and TV
Certificate of Completion
Case Studies in Data Mining with R
\$188.98 \$139

#### For Professionals We support Sales, Marketing, Account Management and CX professionals. Learn new skills. Share your expertise. Connect with experts. Get inspired.

#### Company Information Register New Account
• Total (0)
0