0% found this document useful (0 votes)
73 views17 pages

Chapter2 (Classification)

This document is about supervised learning in R using classification with Naive Bayes. It discusses key concepts like estimating probabilities, joint and conditional probabilities, building a Naive Bayes model in R, and making predictions. It also covers understanding the "naivety" of Naive Bayes models, applying Naive Bayes to different types of problems, and preparing various data types for Naive Bayes classification. The document is presented as a course on DataCamp for learning supervised learning in R.

Uploaded by

110me0313
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views17 pages

Chapter2 (Classification)

This document is about supervised learning in R using classification with Naive Bayes. It discusses key concepts like estimating probabilities, joint and conditional probabilities, building a Naive Bayes model in R, and making predictions. It also covers understanding the "naivety" of Naive Bayes models, applying Naive Bayes to different types of problems, and preparing various data types for Naive Bayes classification. The document is presented as a course on DataCamp for learning supervised learning in R.

Uploaded by

110me0313
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

DataCamp Supervised

Learning in R: Classification

SUPERVISED LEARNING IN R: CLASSIFICATION

Understanding
Bayesian methods

Brett Lantz
Instructor
DataCamp Supervised Learning in R: Classification

Estimating probability

The probability of A is denoted


P(A)

P(work) = 23 / 40 = 57.5%
P(store) = 4 / 40 = 10.0%
DataCamp Supervised Learning in R: Classification

Joint probability and independent events

The joint probability of events A


and B is denoted P(A and B)

P(work and evening) = 1%


P(work and afternoon) = 20%
DataCamp Supervised Learning in R: Classification

Conditional probability and dependent events

The conditional probability of


events A and B is denoted P(A | B)

P(A | B) = P(A and B) / P(B)


P(work | evening) = 1 / 25 = 4%
P(work | afternoon) = 20 / 25 =
80%
DataCamp Supervised Learning in R: Classification

Making predictions with Naive Bayes


# building a Naive Bayes model
library(naivebayes)
m <- naive_bayes(location ~ time_of_day, data = location_history)

# making predictions with Naive Bayes


future_location <- predict(m, future_conditions)
DataCamp Supervised Learning in R: Classification

SUPERVISED LEARNING IN R: CLASSIFICATION

Let's practice!
DataCamp Supervised Learning in R: Classification

SUPERVISED LEARNING IN R: CLASSIFICATION

Understanding NB's
"naivety"

Brett Lantz
Instructor
DataCamp Supervised Learning in R: Classification

The challenge of multiple predictors


DataCamp Supervised Learning in R: Classification

A "naive" simplification
DataCamp Supervised Learning in R: Classification

An "infrequent" problem
DataCamp Supervised Learning in R: Classification

The Laplace correction


DataCamp Supervised Learning in R: Classification

SUPERVISED LEARNING IN R: CLASSIFICATION

Let's practice!
DataCamp Supervised Learning in R: Classification

SUPERVISED LEARNING IN R: CLASSIFICATION

Applying Naive Bayes


to other problems

Brett Lantz
Instructor
DataCamp Supervised Learning in R: Classification

How Naive Bayes uses data


DataCamp Supervised Learning in R: Classification

Binning numeric data for Naive Bayes


DataCamp Supervised Learning in R: Classification

Preparing text data for Naive Bayes


DataCamp Supervised Learning in R: Classification

SUPERVISED LEARNING IN R: CLASSIFICATION

Let's practice!

You might also like