Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Naive bayes on iris dataset in r

27/11/2021 Client: muhammad11 Deadline: 2 Day

School of Computer & Information Sciences

ITS 836 Data Science and Big Data Analytics

ITS 836

1

HW07 Lecture 07 Classification

Questions

Perform the ID3 Algorithm

R exercise for Decision Tree section 7_1

Explain how Random Forest Algorithm works

Iris Dataset with Decision Tree vs Random Forest

R exercise for Naïve Bayes section 7_2

Analyze Classifier Performance section 7_3

Redo calculations for ID3 and Naïve Bayes for the Golf

ITS 836

2

HW07-1 Apply ID3 Algorithm to demonstrate the Decision Tree for the data set

ITS 836

3

http://www.cse.unsw.edu.au/~billw/cs9414/notes/ml/06prop/id3/id3.html

Select Size Color Shape
yes medium blue brick
yes small red sphere
yes large green pillar
yes large green sphere
no small red wedge
no large red wedge
no large red pillar
Back to HW07 Overview

HW07 Q 2

Analyze R code in section 7_1 to create the decision tree classifier for the dataset: bank_sample.csv

Create and Explain all plots an d results

ITS 836

4

# install packages rpart,rpart.plot

# put this code into Rstudio source and execute lines via Ctrl/Enter

library("rpart")

library("rpart.plot")

setwd("c:/data/rstudiofiles/")

banktrain <- read.table("bank-sample.csv",header=TRUE,sep=",")

## drop a few columns to simplify the tree

drops<-c("age", "balance", "day", "campaign", "pdays", "previous", "month")

banktrain <- banktrain [,!(names(banktrain) %in% drops)]

summary(banktrain)

# Make a simple decision tree by only keeping the categorical variables

fit <- rpart(subscribed ~ job + marital + education + default + housing + loan + contact + poutcome,method="class",data=banktrain,control=rpart.control(minsplit=1),

parms=list(split='information'))

summary(fit)

# Plot the tree

rpart.plot(fit, type=4, extra=2, clip.right.labs=FALSE, varlen=0, faclen=3)

Back to HW07 Overview

4

HW07 Q 2

Analyze R code in section 7_1 to create the decision tree classifier for the dataset: bank_sample.csv

Create and Explain all plots an d results

ITS 836

5

5

HW07 Q 2

Analyze R code in section 7_1 to create the decision tree classifier for the dataset: bank_sample.csv

Create and Explain all plots and results

ITS 836

6

6

HW 7 Q3

Explain how a Random Forest Algorithm Works

ITS 836

7

http://blog.citizennet.com/blog/2012/11/10/random-forests-ensembles-and-performance-metrics

Back to HW07 Overview

ITS 836

Use Decision Tree Classifier and Random Forest

Attributes: sepal length, sepal width, petal length, petal width

All flowers contain a sepal and a petal

For the iris flowers three categories (Versicolor, Setosa, Virginica) different measurements

R.A. Fisher, 1936

8

HW07 Q4 Using Iris Dataset

Back to HW07 Overview

HW07 Q4 Using Iris Dataset

Decision Tree applied to Iris Dataset

https://rpubs.com/abhaypadda/k-nn-decision-tree-on-IRIS-dataset or

https://davetang.org/muse/2013/03/12/building-a-classification-tree-in-r/

What are the disadvantages of Decision Trees?

https://www.quora.com/What-are-the-disadvantages-of-using-a-decision-tree-for-classification

Random Forest applied to Iris Dataset and compare to

https://rpubs.com/rpadebet/269829

http://rischanlab.github.io/RandomForest.html

ITS 836

9

Get data and e1071 package

sample<-read.table("sample1.csv",header=TRUE,sep=",")

traindata<-as.data.frame(sample[1:14,])

testdata<-as.data.frame(sample[15,])

traindata #lists train data

testdata #lists test data, no Enrolls variable

install.packages("e1071", dep = TRUE)

library(e1071) #contains naïve Bayes function

model<-naiveBayes(Enrolls~Age+Income+JobSatisfaction+Desire,traindata)

model # generates model output

results<-predict(model,testdata)

Results # provides test prediction

ITS 836

10

Q5 HW07 Section 7.2 Naïve Bayes in R

Back to HW07 Overview

10

7.3 classifier performance

# install some packages

install.packages("ROCR")

library(ROCR)

# training set

banktrain <- read.table("bank-sample.csv",header=TRUE,sep=",")

# drop a few columns

drops <- c("balance", "day", "campaign", "pdays", "previous", "month")

banktrain <- banktrain [,!(names(banktrain) %in% drops)]

# testing set

banktest <- read.table("bank-sample-test.csv",header=TRUE,sep=",")

banktest <- banktest [,!(names(banktest) %in% drops)]

# build the na?ve Bayes classifier

nb_model <- naiveBayes(subscribed~.,

data=banktrain)

ITS 836

11

# perform on the testing set

nb_prediction <- predict(nb_model,

# remove column "subscribed"

banktest[,-ncol(banktest)],

type='raw')

score <- nb_prediction[, c("yes")]

actual_class <- banktest$subscribed == 'yes'

pred <- prediction(score, actual_class)

perf <- performance(pred, "tpr", "fpr")

plot(perf, lwd=2, xlab="False Positive Rate (FPR)",

ylab="True Positive Rate (TPR)")

abline(a=0, b=1, col="gray50", lty=3)

## corresponding AUC score

auc <- performance(pred, "auc")

auc <- unlist(slot(auc, "y.values"))

auc

Back to HW07 Overview

7.3 Diagnostics of Classifiers

We cover three classifiers

Logistic regression, decision trees, naïve Bayes

Tools to evaluate classifier performance

Confusion matrix

ITS 836

12

Back to HW07 Overview

12

7.3 Diagnostics of Classifiers

Bank marketing example

Training set of 2000 records

Test set of 100 records, evaluated below

ITS 836

13

Back to HW07 Overview

13

HW07 Q07 Review calculations for the ID3 and Naïve Bayes Algorithm

ITS 836

14

Record OUTLOOK TEMPERATURE HUMIDITY WINDY PLAY GOLF
X0 Rainy Hot High False No
X1 Rainy Hot High True No
X2 Overcast Hot High False Yes
X3 Sunny Mild High False Yes
4 Sunny Cool Normal False Yes
5 Sunny Cool Normal True No
6 Overcast Cool Normal True Yes
7 Rainy Mild High False No
8 Rainy Cool Normal False Yes
9 Sunny Mild Normal False Yes
10 Rainy Mild Normal True Yes
11 Overcast Mild High True Yes
12 Overcast Hot Normal False Yes
X13 Sunny Mild High True No
Back to HW07 Overview

Questions?

ITS 836

15

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Quality Homework Helper
Essay Writing Help
Assignment Solver
Coursework Helper
Engineering Solutions
Custom Coursework Service
Writer Writer Name Offer Chat
Quality Homework Helper

ONLINE

Quality Homework Helper

I am an experienced researcher here with master education. After reading your posting, I feel, you need an expert research writer to complete your project.Thank You

$41 Chat With Writer
Essay Writing Help

ONLINE

Essay Writing Help

I am a PhD writer with 10 years of experience. I will be delivering high-quality, plagiarism-free work to you in the minimum amount of time. Waiting for your message.

$15 Chat With Writer
Assignment Solver

ONLINE

Assignment Solver

I am an elite class writer with more than 6 years of experience as an academic writer. I will provide you the 100 percent original and plagiarism-free content.

$15 Chat With Writer
Coursework Helper

ONLINE

Coursework Helper

Being a Ph.D. in the Business field, I have been doing academic writing for the past 7 years and have a good command over writing research papers, essay, dissertations and all kinds of academic writing and proofreading.

$15 Chat With Writer
Engineering Solutions

ONLINE

Engineering Solutions

I will provide you with the well organized and well research papers from different primary and secondary sources will write the content that will support your points.

$28 Chat With Writer
Custom Coursework Service

ONLINE

Custom Coursework Service

After reading your project details, I feel myself as the best option for you to fulfill this project with 100 percent perfection.

$25 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

¿haber / alguien / aquí / que / bailar / salsa? - The holy spirit and the church lesson 9 - Module 2 assignment - Rn hours per patient day - What does reasonably practicable mean - Dan gartrell theory and methods - Case - Preoperative carbohydrate loading in diabetic patients - Monash 5 day extension - Annotated bibliography and outline leadership behavior - Account question paper 2016 - Authorized shares of common stock - Average daily census formula example - How to write a qualitative research critique paper - Proj Assessment 2 (KIm Woods) Due in 3 days - Melting point determination lab report - Leasa brand black eyed peas - Technology trends proposal part l - Medical cover letter template - But yesterday the word of caesar might - Economic Events Influence on Economic Activity - Strategic discipleship - Worth the help - Prentice hall reader 9th edition pdf - Homework computer - Michael and rose chaney - Pnw insect management handbook - Monument valley tattooed fists lyrics - Med surge - Rams discharge of mortgage form - Acne keloidalis nuchae icd 10 code - Martha, can you assist me please with a paper regarding emotional intelligence and it's importance to children development and or society please? - Energy and conservation of energy worksheet - You were hired as a consultant to quigley company - Uber ethical issues - Are psychopaths more likely to exhibit criminal behavior - Personal philosophy examples nursing - Jewish culture - Apple computer 2002 harvard business case - Puma segmentation targeting and positioning - Compliance - Chromogen free hot water system - Police scanner peter johnson - Compare and contrast - Algebra anticipated salary - Assignment 1.2: A Changing World Final Paper - Leccion 3 cultura el ultimo emperador inca completar - Beery vmi 6th edition - Asme b31 1 2018 pdf free download - Securing election machines - Recognizing your ________ is an important step in minimizing debilitative emotions. - Inferential questions reading comprehension - Answers to wileyplus accounting homework chapter 5 - Wuthering heights chapter 5 - Philosophy the power of ideas 9th edition pdf - Managing and organizations an introduction to theory and practice pdf - A norman window has the shape of a rectangle - Criminal procedure samaha 9th edition - Factor each completely algebra 1 - College bursar job description - Brocade switch snmp configuration - What are some of the ways in which one smooth stone delivers quality to its clients? - +971561686603 Abortion pills in Dubai/Abu Dhabi-mifepristone & misoprostol in DUBAI - How to read directional control valve symbol - Competency Final Paper - Spelling connections grade 8 unit 1 answers - 4 major organs of the respiratory system - Why are imports deducted when expenditure on gdp is calculated - Faw toyota changchun engine co ltd - Forth 1 listen live - Ids 100 project 2 kwl chart template - Tang empress wu zetian and pharaoh cleopatra - Significant quotes in the glass castle - What does the suffix eal mean - The curve representing ohm's law must be - Strategic group map craft beer industry - The work function of tungsten is 4.50 ev - Royal glamorgan hospital map - ) Discuss the extent to which the IASB conceptual framework satisfies the above definition of fairness in Leonard’s comment above. (40 Marks) b) Discuss the extent to which the above criticisms could be justified by reference to specific International Financial Reporting Standards. - Relationship between culture and communication - University of charleston forensic accounting - 6 shearers close ferny hills - Dna unit 4 letters - Earth cookie creations - Impact of team building exercises on team effectiveness - When a company purchases treasury stock - Ford pinto fuel tank 1977 - Nurse burnout pico question - Faye abdellah patient centered approach to nursing - Financial planning association code of professional practice - Greenwich university admissions number - Restricted psv operators licence - Continental airlines business intelligence - A clothier makes coats and slacks - BI: Week 9 Assignment 3 pages - There will come soft rains by ray bradbury summary - Acwa diploma of community services - Discussion week 3 - in 1 page Select one population and describe their current problems/issue discuss three to four types of complementary or alternative health modalities and one traditional medicine - Lululemon go getter bag dimensions