Supervised Learning in R: Classification

Chapter 1 - k-Nearest Neighbors (kNN) 1.1 - Recognizing a road sign with kNN After several trips with a human behind the wheel, it is time for the self-driving car to attempt the test course alone. As it begins to drive away, its camera captures the following image: Figure 1: A caption Can you apply a kNN classifier to help the car recognize this sign? The dataset signs must be loaded in your workspace along with the dataframe next_sign, which holds the observation you want to classify.

Continue reading

Credit Card Fraud Detection

Objective Our goal is to train a Neural Network to detect fraudulent credit card transactions in a dataset referring to two days transactions by european cardholders. Source: Data credit = read.csv(path) The datasets contains transactions made by credit cards in September 2013 by european cardholders. This dataset presents transactions that occurred in two days. As we can see, this dataset consists of thirty explanatory variables, and a response variable which represents whether a transation was a fraud or not.

Continue reading

Classifying using Logistic Regression

1 - Objective The objective of this example is to identify each of a number of benign or malignant classes. 2 - Data Let’s getting the data. BCData <- read.table(url(""), sep = ",") # setting column names names(BCData)<- c('Id', 'ClumpThickness', 'CellSize','CellShape', 'MarginalAdhesion','SECellSize', 'BareNuclei', 'BlandChromatin','NormalNucleoli', 'Mitoses','Class') 3 - EDA - Exploratory Data Analysis It’s important to extract prelimionary knowledge from the dataset. dim(BCData) ## [1] 699 11 str(BCData) ## 'data.

Continue reading