Finalproj Aml

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 69

FinalProj_AML

2024-04-20

# Exploration libraries
library(readr)
library(dplyr)

##
## Attaching package: ’dplyr’

## The following objects are masked from ’package:stats’:

tie
##
## filter, lag

at
Be
## The following objects are masked from ’package:base’:
## n
## intersect, setdiff, setequal, union
va

library(tidyr)
Jo

library(ggplot2)
library(stringr)
of

library(scales)
ty

##
er

## Attaching package: ’scales’


op

## The following object is masked from ’package:readr’:


Pr

##
## col_factor

# ARM libraries
library(arules)

## Loading required package: Matrix

##
## Attaching package: ’Matrix’

## The following objects are masked from ’package:tidyr’:


##
## expand, pack, unpack

##
## Attaching package: ’arules’

1
## The following object is masked from ’package:dplyr’:
##
## recode

## The following objects are masked from ’package:base’:


##
## abbreviate, write

library(arulesViz)

# Decision Tree libraries


library(rpart)
library(rpart.plot)
library(RColorBrewer)
library(rattle)

## Loading required package: tibble

tie
## Loading required package: bitops

at
##

Be
## Attaching package: ’bitops’
n
## The following object is masked from ’package:Matrix’:
va
##
Jo

## %&%
of

## Rattle: A free graphical interface for data science with R.


## Version 5.5.1 Copyright (c) 2006-2021 Togaware Pty Ltd.
ty

## Type ’rattle()’ to shake, rattle, and roll your data.


er

# Naive Bayes
op

library(e1071)
library(caret)
Pr

## Loading required package: lattice

# Text Mining
library(tm)

## Loading required package: NLP

##
## Attaching package: ’NLP’

## The following object is masked from ’package:ggplot2’:


##
## annotate

##
## Attaching package: ’tm’

2
## The following object is masked from ’package:arules’:
##
## inspect

library(stringr)
library(wordcloud)
library(wordcloud2)

# Options
options(digits=2)

zomato <- read_csv('C:/Users/jbeat/Desktop/zomato.csv')

## New names:
## Rows: 7105 Columns: 12
## -- Column specification
## -------------------------------------------------------- Delimiter: "," chr
## (7): restaurant name, restaurant type, online_order, table booking, cuis... dbl

tie
## (5): ...1, Unnamed: 0, rate (out of 5), num of ratings, avg cost (two pe...

at
## i Use ‘spec()‘ to retrieve the full column specification for this data. i
## Specify the column types or set ‘show_col_types = FALSE‘ to quiet this message.

Be
## * ‘‘ -> ‘...1‘
n
va
NA values
Jo
of

# Check for na values


sum(is.na(zomato))
ty
er

## [1] 125
op

# Remove rows with NA values


Pr

zomato <- na.omit(zomato)

Cuisine Pie Chart

# Remove unnecessary columns


zomato_Pie <- as.data.frame(zomato[,10])

# Rename
colnames(zomato_Pie)[1] ="cuisine"

# Split cuisine column


require(stringr)
zomato_Pie <- data.frame(str_split(zomato_Pie$'cuisine', ",", simplify=TRUE))

# Create one column


zomato_Pie <- data.frame(cuisine=unlist(zomato_Pie))

3
# Fix mispelling
zomato_Pie$cuisine[zomato_Pie$cuisine == ' North Indian'] <- 'North Indian'
zomato_Pie$cuisine[zomato_Pie$cuisine == ' South Indian'] <- 'South Indian'
zomato_Pie$cuisine[zomato_Pie$cuisine == ' Fast Food'] <- 'Fast Food'

# Remove blank rows


zomato_Pie[zomato_Pie==""] <- NA
zomato_Pie <- na.omit(zomato_Pie)

# Create frequency df
zomato_Pie <- as.data.frame(zomato_Pie %>%
group_by(cuisine) %>%
summarize(Freq=n()))
# Sort
zomato_Pie <- zomato_Pie[order(zomato_Pie$Freq,decreasing=TRUE),]
zomato_Pie <- head(zomato_Pie, 10)

tie
# Pie chart
ggplot(zomato_Pie, aes(x="", y=Freq, fill=cuisine)) +

at
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +

Be
theme_void()
n
va
Jo
of

cuisine
ty
er

Beverages
op

Biryani
Chinese
Pr

Continental
Biryani
Cafe
Chinese
Fast Food
North Indian
South Indian

# Restaurant Type Pie Chart

4
# Remove unnecessary columns
zomato_Pie2 <- as.data.frame(zomato[,4])

# Rename
colnames(zomato_Pie2)[1] ="type"

# Split cuisine column


require(stringr)
zomato_Pie2 <- data.frame(str_split(zomato_Pie2$'type', ",", simplify=TRUE))

# Create one column


zomato_Pie2 <- data.frame(type=unlist(zomato_Pie2))

# Remove blank rows


zomato_Pie2[zomato_Pie2==""] <- NA
zomato_Pie2 <- na.omit(zomato_Pie2)

# Create frequency df

tie
zomato_Pie2 <- as.data.frame(zomato_Pie2 %>%
group_by(type) %>%

at
summarize(Freq=n()))

Be
# Sort
zomato_Pie2 <- zomato_Pie2[order(zomato_Pie2$Freq,decreasing=TRUE),]
zomato_Pie2 <- head(zomato_Pie2, 10)
n
va
# Pie chart
Jo

ggplot(zomato_Pie2, aes(x="", y=Freq, fill=type)) +


geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
of

scale_fill_brewer(palette = 'RdYlBu') +
ty

theme_void()
er
op
Pr

5
type
Bar
Delivery
Bakery
Beverage Shop
Cafe
Casual Dining
Delivery
Dessert Parlor

tie
Quick Bites

at
Takeaway

Be
n
va
Jo

# Avg Ratings
of

# Separate types
zomato_QB <- zomato type`, "Quick Bites"))
ty

%>% filter(str_detect(`restaurant
zomato_CF <- zomato %>% filter(str_detect(`restaurant type`, "Cafe"))
er

zomato_CD <- zomato %>% filter(str_detect(`restaurant type`, "Casual Dining"))


op

zomato_TW <- zomato %>% filter(str_detect(`restaurant type`, "Takeaway"))


zomato_DL <- zomato %>% filter(str_detect(`restaurant type`, "Delivery"))
Pr

# Get avg
mean(zomato_QB$'rate (out of 5)')

## [1] 3.4

mean(zomato_CF$'rate (out of 5)')

## [1] 3.7

mean(zomato_CD$'rate (out of 5)')

## [1] 3.6

6
mean(zomato_TW$'rate (out of 5)')

## [1] 3.3

mean(zomato_DL$'rate (out of 5)')

## [1] 3.3

zamato_avgs <- zomato %>%


group_by('restaurant type') %>%
mutate(avg = mean('rate (out of 5)'))

## Warning: There was 1 warning in ‘mutate()‘.


## i In argument: ‘avg = mean("rate (out of 5)")‘.
## i In group 1: ‘"restaurant type" = "restaurant type"‘.
## Caused by warning in ‘mean.default()‘:

tie
## ! argument is not numeric or logical: returning NA

at
Be
Price/Rating Scatterplot
n
va
zomato_SP <- zomato
Jo

colnames(zomato_SP)[5] ="Rating"
of

colnames(zomato_SP)[7] ="Cost"
ty

ggplot(zomato_SP, aes(x=Rating, y=Cost)) +


er

geom_point(color="tomato3") +
op

geom_smooth(method=lm) +
labs(title="Zomato Avg Cost (in Rupee) vs Avg Rating",
Pr

x="Avg Rating", y = "Avg Cost(Rupee)") +


scale_y_continuous(label=comma)

## ‘geom_smooth()‘ using formula = ’y ~ x’

7
Zomato Avg Cost (in Rupee) vs Avg Rating
6,000

4,000
Avg Cost(Rupee)

2,000

tie
at
Be
0
n
va
2 3 4 5
Avg Rating
Jo
of

Data prep for ARM


ty
er

# Remove unnecessary columns


op

zomato_ARM <- zomato[,4:12]


Pr

# Convert all data frame columns


zomato_ARM <- zomato_ARM %>% mutate_at(1:9, as.factor)

# Remove more columns


zomato_ARM <- zomato_ARM[,-5]
zomato_ARM <- zomato_ARM[,-5]
zomato_ARM <- zomato_ARM[,-7]

ARM

# Generate rules, sort, then inspect


rules <- apriori(zomato_ARM, parameter=list(supp=0.02, conf=0.5))

## Apriori
##

8
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.5 0.1 1 none FALSE TRUE 5 0.02 1
## maxlen target ext
## 10 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 139
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[3293 item(s), 6984 transaction(s)] done [0.01s].
## sorting and recoding items ... [63 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [24 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].

tie
at
rules <- sort(rules, by='confidence', decreasing=TRUE)
arules::inspect(rules)

Be
## lhs rhs
n support confidence coverage li
va
## [1] {num of ratings=40,
## avg cost (two people)=300} => {rate (out of 5)=2.8} 0.021 0.96 0.022 8
Jo

## [2] {restaurant type=Quick Bites,


## num of ratings=40} => {rate (out of 5)=2.8} 0.049 0.95 0.052 8
of

## [3] {num of ratings=40} => {rate (out of 5)=2.8} 0.093 0.92 0.101 8
## [4] {rate (out of 5)=2.8,
ty

## avg cost (two people)=300} => {num of ratings=40} 0.021 0.91 0.024 9
er

## [5] {restaurant type=Quick Bites,


## rate (out of 5)=2.8} => {num of ratings=40} 0.049 0.90 0.055 8
op

## [6] {cuisines type=South Indian} => {restaurant type=Quick Bites} 0.043 0.87 0.049 2
## [7] {rate (out of 5)=2.8} => {num of ratings=40} 0.093 0.87 0.107 8
Pr

## [8] {avg cost (two people)=350} => {restaurant type=Quick Bites} 0.026 0.70 0.038 1
## [9] {avg cost (two people)=250} => {restaurant type=Quick Bites} 0.040 0.70 0.058 1
## [10] {avg cost (two people)=800} => {restaurant type=Casual Dining} 0.028 0.69 0.041 3
## [11] {avg cost (two people)=300} => {restaurant type=Quick Bites} 0.104 0.67 0.154 1
## [12] {avg cost (two people)=700} => {restaurant type=Casual Dining} 0.026 0.67 0.039 2
## [13] {avg cost (two people)=200} => {restaurant type=Quick Bites} 0.065 0.66 0.098 1
## [14] {avg cost (two people)=150} => {restaurant type=Quick Bites} 0.030 0.65 0.046 1
## [15] {num of ratings=4} => {restaurant type=Quick Bites} 0.026 0.58 0.045 1
## [16] {avg cost (two people)=600} => {restaurant type=Casual Dining} 0.038 0.57 0.066 2
## [17] {rate (out of 5)=3.2} => {restaurant type=Quick Bites} 0.034 0.55 0.061 1
## [18] {avg cost (two people)=400} => {restaurant type=Quick Bites} 0.071 0.54 0.131 1
## [19] {cuisines type=North Indian} => {restaurant type=Quick Bites} 0.032 0.54 0.059 1
## [20] {rate (out of 5)=2.8,
## num of ratings=40} => {restaurant type=Quick Bites} 0.049 0.53 0.093 1
## [21] {area=Banashankari} => {restaurant type=Quick Bites} 0.027 0.53 0.051 1
## [22] {rate (out of 5)=3.3} => {restaurant type=Quick Bites} 0.038 0.53 0.071 1
## [23] {num of ratings=40} => {restaurant type=Quick Bites} 0.052 0.52 0.101 1
## [24] {rate (out of 5)=2.8} => {restaurant type=Quick Bites} 0.055 0.51 0.107 1

9
Data Prep for Decision Tree

# Remove unnecessary columns


zomato_DT <- subset(zomato,select=c(4,5,6,7))

# Rename
zomato_DT <- rename(zomato_DT, type = 'restaurant type')

# Cull
zomato_DT <- zomato_DT[!grepl(",", zomato_DT$type), ]

# Train set
trainRatio <- .60
set.seed(11) # Set Seed so that same sample can be reproduced in future also
sample <- sample.int(n = nrow(zomato_DT), size = floor(trainRatio*nrow(zomato_DT)), replace = FALSE)
train <- zomato_DT[sample, ]

tie
# Test set
test <- zomato_DT[-sample, ]

at
Be
# Train/test ratio
length(sample)/nrow(zomato_DT)
n
va
## [1] 0.6
Jo

Decision Tree 1
of
ty
er

# Train Tree 1
train_tree1 <- rpart(type ~ ., data = train, method="class", control=rpart.control(cp=0))
op

summary(train_tree1)
Pr

## Call:
## rpart(formula = type ~ ., data = train, method = "class", control = rpart.control(cp = 0))
## n= 3681
##
## CP nsplit rel error xerror xstd
## 1 0.35764 0 1.00 1.00 0.015
## 2 0.01190 1 0.64 0.65 0.014
## 3 0.00248 4 0.61 0.62 0.014
## 4 0.00124 7 0.60 0.61 0.014
## 5 0.00099 9 0.60 0.62 0.014
## 6 0.00079 17 0.59 0.62 0.014
## 7 0.00074 22 0.58 0.62 0.014
## 8 0.00062 24 0.58 0.62 0.014
## 9 0.00050 37 0.57 0.62 0.014
## 10 0.00043 40 0.57 0.63 0.014
## 11 0.00033 47 0.57 0.63 0.014
## 12 0.00025 58 0.57 0.63 0.014
## 13 0.00000 64 0.56 0.65 0.014

10
##
## Variable importance
## avg cost (two people) num of ratings rate (out of 5)
## 64 21 15
##
## Node number 1: 3681 observations, complexity param=0.36
## predicted class=Quick Bites expected loss=0.55 P(node) =1
## class counts: 89 44 60 1 242 971 4 1 211 130 4 52 61 7
## probabilities: 0.024 0.012 0.016 0.000 0.066 0.264 0.001 0.000 0.057 0.035 0.001 0.014 0.017 0.002
## left son=2 (1611 obs) right son=3 (2070 obs)
## Primary splits:
## avg cost (two people) < 420 to the right, improve=590, (0 missing)
## num of ratings < 100 to the right, improve=120, (0 missing)
## rate (out of 5) < 3.8 to the right, improve= 61, (0 missing)
## Surrogate splits:
## num of ratings < 68 to the right, agree=0.68, adj=0.28, (0 split)
## rate (out of 5) < 3.8 to the right, agree=0.64, adj=0.18, (0 split)
##
## Node number 2: 1611 observations, complexity param=0.012

tie
## predicted class=Casual Dining expected loss=0.44 P(node) =0.44

at
## class counts: 27 44 0 0 185 908 4 1 85 25 1 52 23 1
## probabilities: 0.017 0.027 0.000 0.000 0.115 0.564 0.002 0.001 0.053 0.016 0.001 0.032 0.014 0.001

Be
## left son=4 (1145 obs) right son=5 (466 obs)
## Primary splits: n
## avg cost (two people) < 520 to the right, improve=59, (0 missing)
va
## num of ratings < 100 to the right, improve=13, (0 missing)
## rate (out of 5) < 4 to the right, improve=10, (0 missing)
Jo

## Surrogate splits:
## num of ratings < 7.5 to the right, agree=0.71, adj=0.013, (0 split)
of

##
## Node number 3: 2070 observations, complexity param=0.00043
ty

## predicted class=Quick Bites expected loss=0.29 P(node) =0.56


er

## class counts: 62 0 60 1 57 63 0 0 126 105 3 0 38 6


## probabilities: 0.030 0.000 0.029 0.000 0.028 0.030 0.000 0.000 0.061 0.051 0.001 0.000 0.018 0.003
op

## left son=6 (479 obs) right son=7 (1591 obs)


Pr

## Primary splits:
## avg cost (two people) < 380 to the right, improve=14.0, (0 missing)
## num of ratings < 76 to the left, improve= 3.8, (0 missing)
## rate (out of 5) < 3.6 to the right, improve= 1.8, (0 missing)
## Surrogate splits:
## rate (out of 5) < 2.7 to the left, agree=0.77, adj=0.004, (0 split)
##
## Node number 4: 1145 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.35 P(node) =0.31
## class counts: 9 44 0 0 136 741 4 1 33 10 0 52 10 0
## probabilities: 0.008 0.038 0.000 0.000 0.119 0.647 0.003 0.001 0.029 0.009 0.000 0.045 0.009 0.000
## left son=8 (1059 obs) right son=9 (86 obs)
## Primary splits:
## avg cost (two people) < 1800 to the left, improve=57.0, (0 missing)
## rate (out of 5) < 4 to the left, improve=11.0, (0 missing)
## num of ratings < 2300 to the left, improve= 5.5, (0 missing)
##
## Node number 5: 466 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.64 P(node) =0.13

11
## class counts: 18 0 0 0 49 167 0 0 52 15 1 0 13 1
## probabilities: 0.039 0.000 0.000 0.000 0.105 0.358 0.000 0.000 0.112 0.032 0.002 0.000 0.028 0.002
## left son=10 (165 obs) right son=11 (301 obs)
## Primary splits:
## num of ratings < 84 to the right, improve=9.0, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=4.0, (0 missing)
## avg cost (two people) < 480 to the right, improve=1.4, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.77, adj=0.34, (0 split)
##
## Node number 6: 479 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.39 P(node) =0.13
## class counts: 9 0 3 0 24 56 0 0 53 16 0 0 19 1
## probabilities: 0.019 0.000 0.006 0.000 0.050 0.117 0.000 0.000 0.111 0.033 0.000 0.000 0.040 0.002
## left son=12 (297 obs) right son=13 (182 obs)
## Primary splits:
## num of ratings < 48 to the left, improve=2.3, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=2.0, (0 missing)
## Surrogate splits:

tie
## rate (out of 5) < 3.6 to the left, agree=0.75, adj=0.35, (0 split)

at
##
## Node number 7: 1591 observations

Be
## predicted class=Quick Bites expected loss=0.25 P(node) =0.43
## class counts: 53 0 57 1 33n 7 0 0 73 89 3 0 19 5
## probabilities: 0.033 0.000 0.036 0.001 0.021 0.004 0.000 0.000 0.046 0.056 0.002 0.000 0.012 0.003
va
##
## Node number 8: 1059 observations, complexity param=0.00062
Jo

## predicted class=Casual Dining expected loss=0.31 P(node) =0.29


## class counts: 9 37 0 0 135 730 2 1 33 10 0 0 10 0
of

## probabilities: 0.008 0.035 0.000 0.000 0.127 0.689 0.002 0.001 0.031 0.009 0.000 0.000 0.009 0.000
## left son=16 (880 obs) right son=17 (179 obs)
ty

## Primary splits:
er

## avg cost (two people) < 1200 to the left, improve=9.5, (0 missing)
## rate (out of 5) < 4 to the left, improve=5.8, (0 missing)
op

## num of ratings < 2300 to the left, improve=5.5, (0 missing)


Pr

## Surrogate splits:
## num of ratings < 1600 to the left, agree=0.84, adj=0.061, (0 split)
## rate (out of 5) < 4.4 to the left, agree=0.84, adj=0.056, (0 split)
##
## Node number 9: 86 observations, complexity param=0.0012
## predicted class=Fine Dining expected loss=0.4 P(node) =0.023
## class counts: 0 7 0 0 1 11 2 0 0 0 0 52 0 0
## probabilities: 0.000 0.081 0.000 0.000 0.012 0.128 0.023 0.000 0.000 0.000 0.000 0.605 0.000 0.000
## left son=18 (51 obs) right son=19 (35 obs)
## Primary splits:
## avg cost (two people) < 2600 to the left, improve=6.2, (0 missing)
## num of ratings < 45 to the left, improve=5.8, (0 missing)
## rate (out of 5) < 4 to the left, improve=4.9, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4 to the left, agree=0.66, adj=0.171, (0 split)
## num of ratings < 230 to the left, agree=0.60, adj=0.029, (0 split)
##
## Node number 10: 165 observations, complexity param=0.00099
## predicted class=Casual Dining expected loss=0.5 P(node) =0.045

12
## class counts: 3 0 0 0 18 83 0 0 18 5 0 0 3 1
## probabilities: 0.018 0.000 0.000 0.000 0.109 0.503 0.000 0.000 0.109 0.030 0.000 0.000 0.018 0.006
## left son=20 (115 obs) right son=21 (50 obs)
## Primary splits:
## avg cost (two people) < 480 to the right, improve=4.2, (0 missing)
## rate (out of 5) < 4 to the right, improve=3.2, (0 missing)
## num of ratings < 120 to the left, improve=1.1, (0 missing)
## Surrogate splits:
## num of ratings < 1000 to the left, agree=0.7, adj=0.02, (0 split)
##
## Node number 11: 301 observations, complexity param=0.0025
## predicted class=Quick Bites expected loss=0.62 P(node) =0.082
## class counts: 15 0 0 0 31 84 0 0 34 10 1 0 10 0
## probabilities: 0.050 0.000 0.000 0.000 0.103 0.279 0.000 0.000 0.113 0.033 0.003 0.000 0.033 0.000
## left son=22 (264 obs) right son=23 (37 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the left, improve=2.70, (0 missing)
## num of ratings < 56 to the left, improve=1.60, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.45, (0 missing)

tie
## Surrogate splits:

at
## num of ratings < 72 to the left, agree=0.88, adj=0.054, (0 split)
##

Be
## Node number 12: 297 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.43 P(node) =0.081
n
## class counts: 9 0 3 0 17 27 0 0 40 10 0 0 14 1
va
## probabilities: 0.030 0.000 0.010 0.000 0.057 0.091 0.000 0.000 0.135 0.034 0.000 0.000 0.047 0.003
## left son=24 (28 obs) right son=25 (269 obs)
Jo

## Primary splits:
## rate (out of 5) < 3.8 to the right, improve=1.5, (0 missing)
of

## num of ratings < 4.5 to the right, improve=1.0, (0 missing)


## Surrogate splits:
ty

## num of ratings < 46 to the right, agree=0.91, adj=0.036, (0 split)


er

##
## Node number 13: 182 observations, complexity param=0.00043
op

## predicted class=Quick Bites expected loss=0.33 P(node) =0.049


Pr

## class counts: 0 0 0 0 7 29 0 0 13 6 0 0 5 0
## probabilities: 0.000 0.000 0.000 0.000 0.038 0.159 0.000 0.000 0.071 0.033 0.000 0.000 0.027 0.000
## left son=26 (8 obs) right son=27 (174 obs)
## Primary splits:
## rate (out of 5) < 4.2 to the right, improve=2.60, (0 missing)
## num of ratings < 96 to the right, improve=0.84, (0 missing)
## Surrogate splits:
## num of ratings < 1100 to the right, agree=0.97, adj=0.25, (0 split)
##
## Node number 16: 880 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.3 P(node) =0.24
## class counts: 9 17 0 0 132 620 0 1 33 8 0 0 10 0
## probabilities: 0.010 0.019 0.000 0.000 0.150 0.705 0.000 0.001 0.037 0.009 0.000 0.000 0.011 0.000
## left son=32 (212 obs) right son=33 (668 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=12.0, (0 missing)
## num of ratings < 2400 to the left, improve= 4.8, (0 missing)
## avg cost (two people) < 720 to the right, improve= 3.3, (0 missing)
## Surrogate splits:

13
## num of ratings < 430 to the right, agree=0.83, adj=0.316, (0 split)
## avg cost (two people) < 1100 to the right, agree=0.77, adj=0.047, (0 split)
##
## Node number 17: 179 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.39 P(node) =0.049
## class counts: 0 20 0 0 3 110 2 0 0 2 0 0 0 0
## probabilities: 0.000 0.112 0.000 0.000 0.017 0.615 0.011 0.000 0.000 0.011 0.000 0.000 0.000 0.000
## left son=34 (108 obs) right son=35 (71 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=5.0, (0 missing)
## num of ratings < 170 to the right, improve=4.4, (0 missing)
## avg cost (two people) < 1500 to the left, improve=1.2, (0 missing)
## Surrogate splits:
## num of ratings < 210 to the right, agree=0.85, adj=0.63, (0 split)
##
## Node number 18: 51 observations, complexity param=0.0012
## predicted class=Fine Dining expected loss=0.59 P(node) =0.014
## class counts: 0 6 0 0 1 11 1 0 0 0 0 21 0 0
## probabilities: 0.000 0.118 0.000 0.000 0.020 0.216 0.020 0.000 0.000 0.000 0.000 0.412 0.000 0.000

tie
## left son=36 (11 obs) right son=37 (40 obs)

at
## Primary splits:
## num of ratings < 44 to the left, improve=3.4, (0 missing)

Be
## rate (out of 5) < 4 to the right, improve=1.6, (0 missing)
## avg cost (two people) < 2300 to the left, improve=1.5, (0 missing)
n
## Surrogate splits:
va
## rate (out of 5) < 3.6 to the left, agree=0.82, adj=0.18, (0 split)
##
Jo

## Node number 19: 35 observations


## predicted class=Fine Dining expected loss=0.11 P(node) =0.0095
of

## class counts: 0 1 0 0 0 0 1 0 0 0 0 31 0 0
## probabilities: 0.000 0.029 0.000 0.000 0.000 0.000 0.029 0.000 0.000 0.000 0.000 0.886 0.000 0.000
ty

##
er

## Node number 20: 115 observations, complexity param=0.00074


## predicted class=Casual Dining expected loss=0.44 P(node) =0.031
op

## class counts: 3 0 0 0 15 64 0 0 13 4 0 0 2 0
Pr

## probabilities: 0.026 0.000 0.000 0.000 0.130 0.557 0.000 0.000 0.113 0.035 0.000 0.000 0.017 0.000
## left son=40 (23 obs) right son=41 (92 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=3.7, (0 missing)
## num of ratings < 120 to the left, improve=1.3, (0 missing)
##
## Node number 21: 50 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.6 P(node) =0.014
## class counts: 0 0 0 0 3 19 0 0 5 1 0 0 1 1
## probabilities: 0.000 0.000 0.000 0.000 0.060 0.380 0.000 0.000 0.100 0.020 0.000 0.000 0.020 0.020
## left son=42 (7 obs) right son=43 (43 obs)
## Primary splits:
## num of ratings < 500 to the right, improve=1.00, (0 missing)
## rate (out of 5) < 4 to the left, improve=0.93, (0 missing)
##
## Node number 22: 264 observations, complexity param=0.0025
## predicted class=Quick Bites expected loss=0.62 P(node) =0.072
## class counts: 14 0 0 0 21 79 0 0 33 6 1 0 9 0
## probabilities: 0.053 0.000 0.000 0.000 0.080 0.299 0.000 0.000 0.125 0.023 0.004 0.000 0.034 0.000

14
## left son=44 (70 obs) right son=45 (194 obs)
## Primary splits:
## rate (out of 5) < 3.6 to the right, improve=2.40, (0 missing)
## num of ratings < 56 to the left, improve=1.20, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.23, (0 missing)
##
## Node number 23: 37 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.62 P(node) =0.01
## class counts: 1 0 0 0 10 5 0 0 1 4 0 0 1 0
## probabilities: 0.027 0.000 0.000 0.000 0.270 0.135 0.000 0.000 0.027 0.108 0.000 0.000 0.027 0.000
## left son=46 (10 obs) right son=47 (27 obs)
## Primary splits:
## num of ratings < 62 to the right, improve=1.20, (0 missing)
## rate (out of 5) < 3.8 to the left, improve=0.68, (0 missing)
##
## Node number 24: 28 observations
## predicted class=Quick Bites expected loss=0.61 P(node) =0.0076
## class counts: 2 0 2 0 4 4 0 0 4 1 0 0 0 0
## probabilities: 0.071 0.000 0.071 0.000 0.143 0.143 0.000 0.000 0.143 0.036 0.000 0.000 0.000 0.000

tie
##

at
## Node number 25: 269 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.41 P(node) =0.073

Be
## class counts: 7 0 1 0 13 23 0 0 36 9 0 0 14 1
## probabilities: 0.026 0.000 0.004 0.000 0.048 0.086 0.000 0.000 0.134 0.033 0.000 0.000 0.052 0.004
n
## left son=50 (205 obs) right son=51 (64 obs)
va
## Primary splits:
## rate (out of 5) < 3 to the right, improve=0.95, (0 missing)
Jo

## num of ratings < 4.5 to the right, improve=0.85, (0 missing)


## Surrogate splits:
of

## num of ratings < 40 to the left, agree=0.89, adj=0.55, (0 split)


##
ty

## Node number 26: 8 observations


er

## predicted class=Delivery expected loss=0.62 P(node) =0.0022


## class counts: 0 0 0 0 2 1 0 0 3 0 0 0 0 0
op

## probabilities: 0.000 0.000 0.000 0.000 0.250 0.125 0.000 0.000 0.375 0.000 0.000 0.000 0.000 0.000
Pr

##
## Node number 27: 174 observations
## predicted class=Quick Bites expected loss=0.31 P(node) =0.047
## class counts: 0 0 0 0 5 28 0 0 10 6 0 0 5 0
## probabilities: 0.000 0.000 0.000 0.000 0.029 0.161 0.000 0.000 0.057 0.034 0.000 0.000 0.029 0.000
##
## Node number 32: 212 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.42 P(node) =0.058
## class counts: 0 2 0 0 66 124 0 0 2 4 0 0 0 0
## probabilities: 0.000 0.009 0.000 0.000 0.311 0.585 0.000 0.000 0.009 0.019 0.000 0.000 0.000 0.000
## left son=64 (103 obs) right son=65 (109 obs)
## Primary splits:
## avg cost (two people) < 780 to the right, improve=5.6, (0 missing)
## num of ratings < 2400 to the left, improve=2.8, (0 missing)
## rate (out of 5) < 4.4 to the right, improve=1.3, (0 missing)
## Surrogate splits:
## num of ratings < 590 to the right, agree=0.61, adj=0.194, (0 split)
## rate (out of 5) < 4.2 to the right, agree=0.56, adj=0.097, (0 split)
##

15
## Node number 33: 668 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.26 P(node) =0.18
## class counts: 9 15 0 0 66 496 0 1 31 4 0 0 10 0
## probabilities: 0.013 0.022 0.000 0.000 0.099 0.743 0.000 0.001 0.046 0.006 0.000 0.000 0.015 0.000
## left son=66 (216 obs) right son=67 (452 obs)
## Primary splits:
## num of ratings < 110 to the right, improve=5.8, (0 missing)
## avg cost (two people) < 720 to the right, improve=2.0, (0 missing)
## rate (out of 5) < 3 to the right, improve=0.7, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.73, adj=0.18, (0 split)
##
## Node number 34: 108 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.29 P(node) =0.029
## class counts: 0 6 0 0 3 77 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.056 0.000 0.000 0.028 0.713 0.009 0.000 0.000 0.009 0.000 0.000 0.000 0.000
## left son=68 (101 obs) right son=69 (7 obs)
## Primary splits:
## num of ratings < 3800 to the left, improve=3.90, (0 missing)

tie
## rate (out of 5) < 4.4 to the right, improve=1.40, (0 missing)

at
## avg cost (two people) < 1500 to the left, improve=0.76, (0 missing)
## Surrogate splits:

Be
## rate (out of 5) < 4.6 to the left, agree=0.94, adj=0.14, (0 split)
## n
## Node number 35: 71 observations, complexity param=0.00062
va
## predicted class=Casual Dining expected loss=0.54 P(node) =0.019
## class counts: 0 14 0 0 0 33 1 0 0 1 0 0 0 0
Jo

## probabilities: 0.000 0.197 0.000 0.000 0.000 0.465 0.014 0.000 0.000 0.014 0.000 0.000 0.000 0.000
## left son=70 (63 obs) right son=71 (8 obs)
of

## Primary splits:
## num of ratings < 660 to the left, improve=1.7, (0 missing)
ty

## rate (out of 5) < 3.8 to the right, improve=1.4, (0 missing)


er

## avg cost (two people) < 1600 to the left, improve=1.0, (0 missing)
##
op

## Node number 36: 11 observations


Pr

## predicted class=Casual Dining expected loss=0.55 P(node) =0.003


## class counts: 0 2 0 0 1 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.182 0.000 0.000 0.091 0.455 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 37: 40 observations
## predicted class=Fine Dining expected loss=0.47 P(node) =0.011
## class counts: 0 4 0 0 0 6 1 0 0 0 0 21 0 0
## probabilities: 0.000 0.100 0.000 0.000 0.000 0.150 0.025 0.000 0.000 0.000 0.000 0.525 0.000 0.000
##
## Node number 40: 23 observations, complexity param=0.00074
## predicted class=Cafe expected loss=0.7 P(node) =0.0062
## class counts: 2 0 0 0 7 6 0 0 4 1 0 0 0 0
## probabilities: 0.087 0.000 0.000 0.000 0.304 0.261 0.000 0.000 0.174 0.043 0.000 0.000 0.000 0.000
## left son=80 (8 obs) right son=81 (15 obs)
## Primary splits:
## num of ratings < 230 to the left, improve=1.50, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=0.66, (0 missing)
##
## Node number 41: 92 observations

16
## predicted class=Casual Dining expected loss=0.37 P(node) =0.025
## class counts: 1 0 0 0 8 58 0 0 9 3 0 0 2 0
## probabilities: 0.011 0.000 0.000 0.000 0.087 0.630 0.000 0.000 0.098 0.033 0.000 0.000 0.022 0.000
##
## Node number 42: 7 observations
## predicted class=Casual Dining expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 0 4 0 0 1 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.571 0.000 0.000 0.143 0.000 0.000 0.000 0.143 0.000
##
## Node number 43: 43 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.56 P(node) =0.012
## class counts: 0 0 0 0 3 15 0 0 4 1 0 0 0 1
## probabilities: 0.000 0.000 0.000 0.000 0.070 0.349 0.000 0.000 0.093 0.023 0.000 0.000 0.000 0.023
## left son=86 (35 obs) right son=87 (8 obs)
## Primary splits:
## rate (out of 5) < 4 to the left, improve=1.6, (0 missing)
## num of ratings < 180 to the left, improve=1.3, (0 missing)
## Surrogate splits:
## num of ratings < 370 to the left, agree=0.84, adj=0.12, (0 split)

tie
##

at
## Node number 44: 70 observations, complexity param=0.0025
## predicted class=Casual Dining expected loss=0.59 P(node) =0.019

Be
## class counts: 1 0 0 0 10 29 0 0 4 1 0 0 1 0
## probabilities: 0.014 0.000 0.000 0.000 0.143 0.414 0.000 0.000 0.057 0.014 0.000 0.000 0.014 0.000
n
## left son=88 (47 obs) right son=89 (23 obs)
va
## Primary splits:
## num of ratings < 24 to the right, improve=5.10, (0 missing)
Jo

## rate (out of 5) < 3.6 to the left, improve=0.25, (0 missing)


## avg cost (two people) < 480 to the right, improve=0.21, (0 missing)
of

##
## Node number 45: 194 observations, complexity param=0.00099
ty

## predicted class=Quick Bites expected loss=0.6 P(node) =0.053


er

## class counts: 13 0 0 0 11 50 0 0 29 5 1 0 8 0
## probabilities: 0.067 0.000 0.000 0.000 0.057 0.258 0.000 0.000 0.149 0.026 0.005 0.000 0.041 0.000
op

## left son=90 (182 obs) right son=91 (12 obs)


Pr

## Primary splits:
## num of ratings < 60 to the left, improve=3.20, (0 missing)
## rate (out of 5) < 3 to the right, improve=1.30, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.29, (0 missing)
##
## Node number 46: 10 observations
## predicted class=Cafe expected loss=0.5 P(node) =0.0027
## class counts: 0 0 0 0 5 0 0 0 0 1 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.500 0.000 0.000 0.000 0.000 0.100 0.000 0.000 0.100 0.000
##
## Node number 47: 27 observations
## predicted class=Quick Bites expected loss=0.59 P(node) =0.0073
## class counts: 1 0 0 0 5 5 0 0 1 3 0 0 0 0
## probabilities: 0.037 0.000 0.000 0.000 0.185 0.185 0.000 0.000 0.037 0.111 0.000 0.000 0.000 0.000
##
## Node number 50: 205 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.43 P(node) =0.056
## class counts: 6 0 0 0 7 21 0 0 30 7 0 0 11 1
## probabilities: 0.029 0.000 0.000 0.000 0.034 0.102 0.000 0.000 0.146 0.034 0.000 0.000 0.054 0.005

17
## left son=100 (79 obs) right son=101 (126 obs)
## Primary splits:
## rate (out of 5) < 3.4 to the left, improve=2.0, (0 missing)
## num of ratings < 4.5 to the right, improve=1.1, (0 missing)
## Surrogate splits:
## num of ratings < 5.5 to the left, agree=0.69, adj=0.2, (0 split)
##
## Node number 51: 64 observations
## predicted class=Quick Bites expected loss=0.34 P(node) =0.017
## class counts: 1 0 1 0 6 2 0 0 6 2 0 0 3 0
## probabilities: 0.016 0.000 0.016 0.000 0.094 0.031 0.000 0.000 0.094 0.031 0.000 0.000 0.047 0.000
##
## Node number 64: 103 observations, complexity param=5e-04
## predicted class=Casual Dining expected loss=0.28 P(node) =0.028
## class counts: 0 2 0 0 23 74 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.019 0.000 0.000 0.223 0.718 0.000 0.000 0.000 0.010 0.000 0.000 0.000 0.000
## left son=128 (41 obs) right son=129 (62 obs)
## Primary splits:
## avg cost (two people) < 980 to the right, improve=2.00, (0 missing)

tie
## num of ratings < 1400 to the left, improve=1.60, (0 missing)

at
## rate (out of 5) < 4.4 to the right, improve=0.72, (0 missing)
## Surrogate splits:

Be
## rate (out of 5) < 4.6 to the right, agree=0.62, adj=0.049, (0 split)
## num of ratings < 120 to the left, agree=0.62, adj=0.049, (0 split)
n
##
va
## Node number 65: 109 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.54 P(node) =0.03
Jo

## class counts: 0 0 0 0 43 50 0 0 2 3 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.394 0.459 0.000 0.000 0.018 0.028 0.000 0.000 0.000 0.000
of

## left son=130 (56 obs) right son=131 (53 obs)


## Primary splits:
ty

## avg cost (two people) < 620 to the right, improve=1.60, (0 missing)
er

## num of ratings < 170 to the right, improve=1.10, (0 missing)


## rate (out of 5) < 4 to the right, improve=0.87, (0 missing)
op

## Surrogate splits:
Pr

## rate (out of 5) < 4 to the left, agree=0.58, adj=0.13, (0 split)


## num of ratings < 250 to the right, agree=0.58, adj=0.13, (0 split)
##
## Node number 66: 216 observations
## predicted class=Casual Dining expected loss=0.14 P(node) =0.059
## class counts: 0 2 0 0 14 186 0 0 2 1 0 0 4 0
## probabilities: 0.000 0.009 0.000 0.000 0.065 0.861 0.000 0.000 0.009 0.005 0.000 0.000 0.019 0.000
##
## Node number 67: 452 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.31 P(node) =0.12
## class counts: 9 13 0 0 52 310 0 1 29 3 0 0 6 0
## probabilities: 0.020 0.029 0.000 0.000 0.115 0.686 0.000 0.002 0.064 0.007 0.000 0.000 0.013 0.000
## left son=134 (240 obs) right son=135 (212 obs)
## Primary splits:
## avg cost (two people) < 680 to the right, improve=2.2, (0 missing)
## num of ratings < 90 to the right, improve=2.1, (0 missing)
## rate (out of 5) < 2.7 to the left, improve=1.1, (0 missing)
## Surrogate splits:
## num of ratings < 26 to the right, agree=0.57, adj=0.075, (0 split)

18
## rate (out of 5) < 3.8 to the left, agree=0.53, adj=0.005, (0 split)
##
## Node number 68: 101 observations
## predicted class=Casual Dining expected loss=0.25 P(node) =0.027
## class counts: 0 6 0 0 3 76 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.059 0.000 0.000 0.030 0.752 0.010 0.000 0.000 0.010 0.000 0.000 0.000 0.000
##
## Node number 69: 7 observations
## predicted class=Lounge expected loss=0.57 P(node) =0.0019
## class counts: 0 0 0 0 0 1 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 70: 63 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.49 P(node) =0.017
## class counts: 0 11 0 0 0 32 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.175 0.000 0.000 0.000 0.508 0.016 0.000 0.000 0.016 0.000 0.000 0.000 0.000
## left son=140 (9 obs) right son=141 (54 obs)
## Primary splits:
## num of ratings < 170 to the right, improve=1.40, (0 missing)

tie
## rate (out of 5) < 3.8 to the right, improve=1.40, (0 missing)

at
## avg cost (two people) < 1600 to the left, improve=0.69, (0 missing)
##

Be
## Node number 71: 8 observations
## predicted class=Bar expected loss=0.62 P(node) =0.0022
n
## class counts: 0 3 0 0 0 1 0 0 0 0 0 0 0 0
va
## probabilities: 0.000 0.375 0.000 0.000 0.000 0.125 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
Jo

## Node number 80: 8 observations


## predicted class=Cafe expected loss=0.5 P(node) =0.0022
of

## class counts: 2 0 0 0 4 1 0 0 0 0 0 0 0 0
## probabilities: 0.250 0.000 0.000 0.000 0.500 0.125 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
ty

##
er

## Node number 81: 15 observations


## predicted class=Casual Dining expected loss=0.67 P(node) =0.0041
op

## class counts: 0 0 0 0 3 5 0 0 4 1 0 0 0 0
Pr

## probabilities: 0.000 0.000 0.000 0.000 0.200 0.333 0.000 0.000 0.267 0.067 0.000 0.000 0.000 0.000
##
## Node number 86: 35 observations, complexity param=0.00099
## predicted class=Casual Dining expected loss=0.57 P(node) =0.0095
## class counts: 0 0 0 0 2 15 0 0 2 0 0 0 0 1
## probabilities: 0.000 0.000 0.000 0.000 0.057 0.429 0.000 0.000 0.057 0.000 0.000 0.000 0.000 0.029
## left son=172 (8 obs) right son=173 (27 obs)
## Primary splits:
## rate (out of 5) < 3 to the left, improve=0.82, (0 missing)
## num of ratings < 180 to the left, improve=0.71, (0 missing)
##
## Node number 87: 8 observations
## predicted class=Quick Bites expected loss=0.5 P(node) =0.0022
## class counts: 0 0 0 0 1 0 0 0 2 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.125 0.000 0.000 0.000 0.250 0.125 0.000 0.000 0.000 0.000
##
## Node number 88: 47 observations
## predicted class=Casual Dining expected loss=0.43 P(node) =0.013
## class counts: 1 0 0 0 5 27 0 0 2 0 0 0 0 0

19
## probabilities: 0.021 0.000 0.000 0.000 0.106 0.574 0.000 0.000 0.043 0.000 0.000 0.000 0.000 0.000
##
## Node number 89: 23 observations
## predicted class=Quick Bites expected loss=0.48 P(node) =0.0062
## class counts: 0 0 0 0 5 2 0 0 2 1 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.217 0.087 0.000 0.000 0.087 0.043 0.000 0.000 0.043 0.000
##
## Node number 90: 182 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.63 P(node) =0.049
## class counts: 13 0 0 0 11 49 0 0 29 5 1 0 7 0
## probabilities: 0.071 0.000 0.000 0.000 0.060 0.269 0.000 0.000 0.159 0.027 0.005 0.000 0.038 0.000
## left son=180 (7 obs) right son=181 (175 obs)
## Primary splits:
## num of ratings < 50 to the right, improve=2.30, (0 missing)
## rate (out of 5) < 3 to the right, improve=1.20, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.25, (0 missing)
##
## Node number 91: 12 observations
## predicted class=Quick Bites expected loss=0.17 P(node) =0.0033

tie
## class counts: 0 0 0 0 0 1 0 0 0 0 0 0 1 0

at
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.083 0.000 0.000 0.000 0.000 0.000 0.000 0.083 0.000
##

Be
## Node number 100: 79 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.53 P(node) =0.021
n
## class counts: 3 0 0 0 3 10 0 0 14 1 0 0 8 0
va
## probabilities: 0.038 0.000 0.000 0.000 0.038 0.127 0.000 0.000 0.177 0.013 0.000 0.000 0.101 0.000
## left son=200 (11 obs) right son=201 (68 obs)
Jo

## Primary splits:
## num of ratings < 24 to the right, improve=4.00, (0 missing)
of

## rate (out of 5) < 3.2 to the right, improve=0.72, (0 missing)


##
ty

## Node number 101: 126 observations


er

## predicted class=Quick Bites expected loss=0.37 P(node) =0.034


## class counts: 3 0 0 0 4 11 0 0 16 6 0 0 3 1
op

## probabilities: 0.024 0.000 0.000 0.000 0.032 0.087 0.000 0.000 0.127 0.048 0.000 0.000 0.024 0.008
Pr

##
## Node number 128: 41 observations
## predicted class=Casual Dining expected loss=0.17 P(node) =0.011
## class counts: 0 2 0 0 4 34 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.049 0.000 0.000 0.098 0.829 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 129: 62 observations, complexity param=5e-04
## predicted class=Casual Dining expected loss=0.35 P(node) =0.017
## class counts: 0 0 0 0 19 40 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.306 0.645 0.000 0.000 0.000 0.016 0.000 0.000 0.000 0.000
## left son=258 (55 obs) right son=259 (7 obs)
## Primary splits:
## num of ratings < 1400 to the left, improve=1.70, (0 missing)
## avg cost (two people) < 820 to the left, improve=1.20, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=0.94, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4.4 to the left, agree=0.9, adj=0.14, (0 split)
##
## Node number 130: 56 observations, complexity param=0.00062

20
## predicted class=Cafe expected loss=0.52 P(node) =0.015
## class counts: 0 0 0 0 27 27 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.482 0.482 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=260 (35 obs) right son=261 (21 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=1.400, (0 missing)
## num of ratings < 790 to the right, improve=1.200, (0 missing)
## avg cost (two people) < 720 to the right, improve=0.082, (0 missing)
## Surrogate splits:
## num of ratings < 140 to the right, agree=0.71, adj=0.24, (0 split)
##
## Node number 131: 53 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.57 P(node) =0.014
## class counts: 0 0 0 0 16 23 0 0 2 3 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.302 0.434 0.000 0.000 0.038 0.057 0.000 0.000 0.000 0.000
## left son=262 (16 obs) right son=263 (37 obs)
## Primary splits:
## num of ratings < 500 to the right, improve=1.30, (0 missing)
## avg cost (two people) < 580 to the left, improve=0.61, (0 missing)

tie
## rate (out of 5) < 4 to the right, improve=0.23, (0 missing)

at
## Surrogate splits:
## rate (out of 5) < 4.2 to the right, agree=0.81, adj=0.375, (0 split)

Be
## avg cost (two people) < 580 to the left, agree=0.72, adj=0.062, (0 split)
## n
## Node number 134: 240 observations, complexity param=0.00033
va
## predicted class=Casual Dining expected loss=0.27 P(node) =0.065
## class counts: 2 13 0 0 24 176 0 1 10 1 0 0 3 0
Jo

## probabilities: 0.008 0.054 0.000 0.000 0.100 0.733 0.000 0.004 0.042 0.004 0.000 0.000 0.012 0.000
## left son=268 (8 obs) right son=269 (232 obs)
of

## Primary splits:
## num of ratings < 93 to the right, improve=4.40, (0 missing)
ty

## avg cost (two people) < 980 to the right, improve=1.50, (0 missing)
er

## rate (out of 5) < 3 to the left, improve=0.75, (0 missing)


##
op

## Node number 135: 212 observations, complexity param=0.00033


Pr

## predicted class=Casual Dining expected loss=0.37 P(node) =0.058


## class counts: 7 0 0 0 28 134 0 0 19 2 0 0 3 0
## probabilities: 0.033 0.000 0.000 0.000 0.132 0.632 0.000 0.000 0.090 0.009 0.000 0.000 0.014 0.000
## left son=270 (27 obs) right son=271 (185 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the right, improve=3.2, (0 missing)
## num of ratings < 38 to the right, improve=1.5, (0 missing)
## avg cost (two people) < 560 to the right, improve=1.5, (0 missing)
## Surrogate splits:
## num of ratings < 84 to the right, agree=0.88, adj=0.037, (0 split)
##
## Node number 140: 9 observations
## predicted class=Casual Dining expected loss=0.22 P(node) =0.0024
## class counts: 0 0 0 0 0 7 1 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.778 0.111 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 141: 54 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.54 P(node) =0.015
## class counts: 0 11 0 0 0 25 0 0 0 1 0 0 0 0

21
## probabilities: 0.000 0.204 0.000 0.000 0.000 0.463 0.000 0.000 0.000 0.019 0.000 0.000 0.000 0.000
## left son=282 (15 obs) right son=283 (39 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the right, improve=2.40, (0 missing)
## num of ratings < 65 to the right, improve=1.70, (0 missing)
## avg cost (two people) < 1600 to the left, improve=0.81, (0 missing)
## Surrogate splits:
## num of ratings < 65 to the right, agree=0.8, adj=0.27, (0 split)
##
## Node number 172: 8 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 1 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.125 0.625 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 173: 27 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.52 P(node) =0.0073
## class counts: 0 0 0 0 1 10 0 0 2 0 0 0 0 1
## probabilities: 0.000 0.000 0.000 0.000 0.037 0.370 0.000 0.000 0.074 0.000 0.000 0.000 0.000 0.037
## left son=346 (8 obs) right son=347 (19 obs)

tie
## Primary splits:

at
## rate (out of 5) < 3.8 to the right, improve=1.50, (0 missing)
## num of ratings < 220 to the right, improve=0.49, (0 missing)

Be
## Surrogate splits:
## num of ratings < 280 to the right, agree=0.81, adj=0.38, (0 split)
n
##
va
## Node number 180: 7 observations
## predicted class=Delivery expected loss=0.43 P(node) =0.0019
Jo

## class counts: 0 0 0 0 1 2 0 0 4 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.143 0.286 0.000 0.000 0.571 0.000 0.000 0.000 0.000 0.000
of

##
## Node number 181: 175 observations, complexity param=0.00079
ty

## predicted class=Quick Bites expected loss=0.62 P(node) =0.048


er

## class counts: 13 0 0 0 10 47 0 0 25 5 1 0 7 0
## probabilities: 0.074 0.000 0.000 0.000 0.057 0.269 0.000 0.000 0.143 0.029 0.006 0.000 0.040 0.000
op

## left son=362 (123 obs) right son=363 (52 obs)


Pr

## Primary splits:
## num of ratings < 34 to the left, improve=1.90, (0 missing)
## rate (out of 5) < 3 to the right, improve=1.40, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.29, (0 missing)
## Surrogate splits:
## rate (out of 5) < 2.8 to the right, agree=0.9, adj=0.65, (0 split)
##
## Node number 200: 11 observations
## predicted class=Delivery expected loss=0.36 P(node) =0.003
## class counts: 1 0 0 0 0 1 0 0 7 0 0 0 0 0
## probabilities: 0.091 0.000 0.000 0.000 0.000 0.091 0.000 0.000 0.636 0.000 0.000 0.000 0.000 0.000
##
## Node number 201: 68 observations
## predicted class=Quick Bites expected loss=0.49 P(node) =0.018
## class counts: 2 0 0 0 3 9 0 0 7 1 0 0 8 0
## probabilities: 0.029 0.000 0.000 0.000 0.044 0.132 0.000 0.000 0.103 0.015 0.000 0.000 0.118 0.000
##
## Node number 258: 55 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.31 P(node) =0.015

22
## class counts: 0 0 0 0 15 38 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.273 0.691 0.000 0.000 0.000 0.018 0.000 0.000 0.000 0.000
## left son=516 (46 obs) right son=517 (9 obs)
## Primary splits:
## num of ratings < 150 to the right, improve=0.88, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=0.55, (0 missing)
## avg cost (two people) < 820 to the left, improve=0.48, (0 missing)
##
## Node number 259: 7 observations
## predicted class=Cafe expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 4 2 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.571 0.286 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 260: 35 observations, complexity param=5e-04
## predicted class=Cafe expected loss=0.43 P(node) =0.0095
## class counts: 0 0 0 0 20 14 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.571 0.400 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=520 (21 obs) right son=521 (14 obs)
## Primary splits:

tie
## num of ratings < 310 to the right, improve=0.75, (0 missing)

at
## avg cost (two people) < 720 to the right, improve=0.30, (0 missing)
## rate (out of 5) < 4.2 to the left, improve=0.25, (0 missing)

Be
## Surrogate splits:
## avg cost (two people) < 680 to the right, agree=0.66, adj=0.14, (0 split)
n
##
va
## Node number 261: 21 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0057
Jo

## class counts: 0 0 0 0 7 13 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.619 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
of

##
## Node number 262: 16 observations
ty

## predicted class=Cafe expected loss=0.5 P(node) =0.0043


er

## class counts: 0 0 0 0 8 6 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.500 0.375 0.000 0.000 0.000 0.062 0.000 0.000 0.000 0.000
op

##
Pr

## Node number 263: 37 observations, complexity param=0.00025


## predicted class=Casual Dining expected loss=0.54 P(node) =0.01
## class counts: 0 0 0 0 8 17 0 0 2 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.216 0.459 0.000 0.000 0.054 0.054 0.000 0.000 0.000 0.000
## left son=526 (7 obs) right son=527 (30 obs)
## Primary splits:
## num of ratings < 340 to the right, improve=1.90, (0 missing)
## rate (out of 5) < 4 to the right, improve=0.19, (0 missing)
##
## Node number 268: 8 observations
## predicted class=Cafe expected loss=0.62 P(node) =0.0022
## class counts: 0 2 0 0 3 1 0 0 2 0 0 0 0 0
## probabilities: 0.000 0.250 0.000 0.000 0.375 0.125 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000
##
## Node number 269: 232 observations
## predicted class=Casual Dining expected loss=0.25 P(node) =0.063
## class counts: 2 11 0 0 21 175 0 1 8 1 0 0 3 0
## probabilities: 0.009 0.047 0.000 0.000 0.091 0.754 0.000 0.004 0.034 0.004 0.000 0.000 0.013 0.000
##

23
## Node number 270: 27 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.59 P(node) =0.0073
## class counts: 0 0 0 0 9 11 0 0 4 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.407 0.000 0.000 0.148 0.074 0.000 0.000 0.000 0.000
## left son=540 (16 obs) right son=541 (11 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the left, improve=0.80, (0 missing)
## num of ratings < 50 to the right, improve=0.53, (0 missing)
## Surrogate splits:
## num of ratings < 48 to the left, agree=0.67, adj=0.18, (0 split)
##
## Node number 271: 185 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.34 P(node) =0.05
## class counts: 7 0 0 0 19 123 0 0 15 0 0 0 3 0
## probabilities: 0.038 0.000 0.000 0.000 0.103 0.665 0.000 0.000 0.081 0.000 0.000 0.000 0.016 0.000
## left son=542 (148 obs) right son=543 (37 obs)
## Primary splits:
## avg cost (two people) < 560 to the right, improve=1.30, (0 missing)
## num of ratings < 66 to the right, improve=0.91, (0 missing)

tie
## rate (out of 5) < 3.6 to the right, improve=0.47, (0 missing)

at
##
## Node number 282: 15 observations

Be
## predicted class=Bar expected loss=0.53 P(node) =0.0041
## class counts: 0 7 0 0 0n 4 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.467 0.000 0.000 0.000 0.267 0.000 0.000 0.000 0.067 0.000 0.000 0.000 0.000
va
##
## Node number 283: 39 observations, complexity param=0.00062
Jo

## predicted class=Casual Dining expected loss=0.46 P(node) =0.011


## class counts: 0 4 0 0 0 21 0 0 0 0 0 0 0 0
of

## probabilities: 0.000 0.103 0.000 0.000 0.000 0.538 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=566 (17 obs) right son=567 (22 obs)
ty

## Primary splits:
er

## rate (out of 5) < 3.4 to the left, improve=1.60, (0 missing)


## num of ratings < 21 to the right, improve=0.69, (0 missing)
op

## avg cost (two people) < 1200 to the left, improve=0.54, (0 missing)
Pr

## Surrogate splits:
## num of ratings < 6.5 to the left, agree=0.64, adj=0.176, (0 split)
## avg cost (two people) < 1300 to the left, agree=0.59, adj=0.059, (0 split)
##
## Node number 346: 8 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 1 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.125 0.625 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 347: 19 observations
## predicted class=Quick Bites expected loss=0.42 P(node) =0.0052
## class counts: 0 0 0 0 0 5 0 0 2 0 0 0 0 1
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.263 0.000 0.000 0.105 0.000 0.000 0.000 0.000 0.053
##
## Node number 362: 123 observations, complexity param=0.00079
## predicted class=Quick Bites expected loss=0.65 P(node) =0.033
## class counts: 10 0 0 0 6 39 0 0 14 4 1 0 6 0
## probabilities: 0.081 0.000 0.000 0.000 0.049 0.317 0.000 0.000 0.114 0.033 0.008 0.000 0.049 0.000
## left son=724 (107 obs) right son=725 (16 obs)

24
## Primary splits:
## num of ratings < 22 to the left, improve=1.00, (0 missing)
## rate (out of 5) < 2.8 to the left, improve=0.94, (0 missing)
## avg cost (two people) < 480 to the left, improve=0.71, (0 missing)
##
## Node number 363: 52 observations
## predicted class=Quick Bites expected loss=0.54 P(node) =0.014
## class counts: 3 0 0 0 4 8 0 0 11 1 0 0 1 0
## probabilities: 0.058 0.000 0.000 0.000 0.077 0.154 0.000 0.000 0.212 0.019 0.000 0.000 0.019 0.000
##
## Node number 516: 46 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.26 P(node) =0.012
## class counts: 0 0 0 0 12 34 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.261 0.739 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=1032 (9 obs) right son=1033 (37 obs)
## Primary splits:
## avg cost (two people) < 820 to the right, improve=0.75, (0 missing)
## num of ratings < 500 to the right, improve=0.70, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=0.64, (0 missing)

tie
##

at
## Node number 517: 9 observations
## predicted class=Casual Dining expected loss=0.56 P(node) =0.0024

Be
## class counts: 0 0 0 0 3 4 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.444 0.000 0.000 0.000 0.111 0.000 0.000 0.000 0.000
n
##
va
## Node number 520: 21 observations
## predicted class=Cafe expected loss=0.33 P(node) =0.0057
Jo

## class counts: 0 0 0 0 14 7 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.667 0.333 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
of

##
## Node number 521: 14 observations
ty

## predicted class=Casual Dining expected loss=0.5 P(node) =0.0038


er

## class counts: 0 0 0 0 6 7 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.429 0.500 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
op

##
Pr

## Node number 526: 7 observations


## predicted class=Casual Dining expected loss=0.14 P(node) =0.0019
## class counts: 0 0 0 0 0 6 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.857 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 527: 30 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.63 P(node) =0.0081
## class counts: 0 0 0 0 8 11 0 0 2 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.267 0.367 0.000 0.000 0.067 0.067 0.000 0.000 0.000 0.000
## left son=1054 (12 obs) right son=1055 (18 obs)
## Primary splits:
## num of ratings < 150 to the left, improve=0.93, (0 missing)
## rate (out of 5) < 4 to the right, improve=0.23, (0 missing)
##
## Node number 540: 16 observations
## predicted class=Cafe expected loss=0.56 P(node) =0.0043
## class counts: 0 0 0 0 7 6 0 0 3 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.438 0.375 0.000 0.000 0.188 0.000 0.000 0.000 0.000 0.000
##

25
## Node number 541: 11 observations
## predicted class=Casual Dining expected loss=0.55 P(node) =0.003
## class counts: 0 0 0 0 2 5 0 0 1 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.182 0.455 0.000 0.000 0.091 0.182 0.000 0.000 0.000 0.000
##
## Node number 542: 148 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.37 P(node) =0.04
## class counts: 7 0 0 0 17 93 0 0 14 0 0 0 3 0
## probabilities: 0.047 0.000 0.000 0.000 0.115 0.628 0.000 0.000 0.095 0.000 0.000 0.000 0.020 0.000
## left son=1084 (17 obs) right son=1085 (131 obs)
## Primary splits:
## num of ratings < 66 to the right, improve=1.20, (0 missing)
## rate (out of 5) < 2.8 to the left, improve=0.38, (0 missing)
## avg cost (two people) < 620 to the left, improve=0.31, (0 missing)
##
## Node number 543: 37 observations
## predicted class=Casual Dining expected loss=0.19 P(node) =0.01
## class counts: 0 0 0 0 2 30 0 0 1 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.054 0.811 0.000 0.000 0.027 0.000 0.000 0.000 0.000 0.000

tie
##

at
## Node number 566: 17 observations
## predicted class=Casual Dining expected loss=0.35 P(node) =0.0046

Be
## class counts: 0 2 0 0 0 11 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.118 0.000 0.000 0.000 0.647 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
n
##
va
## Node number 567: 22 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.55 P(node) =0.006
Jo

## class counts: 0 2 0 0 0 10 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.091 0.000 0.000 0.000 0.455 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
of

## left son=1134 (14 obs) right son=1135 (8 obs)


## Primary splits:
ty

## num of ratings < 28 to the right, improve=1.70, (0 missing)


er

## avg cost (two people) < 1200 to the left, improve=0.69, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=0.36, (0 missing)
op

## Surrogate splits:
Pr

## rate (out of 5) < 3.6 to the right, agree=0.77, adj=0.38, (0 split)


## avg cost (two people) < 1400 to the right, agree=0.68, adj=0.12, (0 split)
##
## Node number 724: 107 observations, complexity param=0.00079
## predicted class=Quick Bites expected loss=0.64 P(node) =0.029
## class counts: 10 0 0 0 5 32 0 0 14 4 1 0 3 0
## probabilities: 0.093 0.000 0.000 0.000 0.047 0.299 0.000 0.000 0.131 0.037 0.009 0.000 0.028 0.000
## left son=1448 (83 obs) right son=1449 (24 obs)
## Primary splits:
## num of ratings < 5.5 to the right, improve=0.87, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.70, (0 missing)
## rate (out of 5) < 3.4 to the right, improve=0.68, (0 missing)
##
## Node number 725: 16 observations
## predicted class=Casual Dining expected loss=0.56 P(node) =0.0043
## class counts: 0 0 0 0 1 7 0 0 0 0 0 0 3 0
## probabilities: 0.000 0.000 0.000 0.000 0.062 0.438 0.000 0.000 0.000 0.000 0.000 0.000 0.188 0.000
##
## Node number 1032: 9 observations

26
## predicted class=Casual Dining expected loss=0.44 P(node) =0.0024
## class counts: 0 0 0 0 4 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.444 0.556 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 1033: 37 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.22 P(node) =0.01
## class counts: 0 0 0 0 8 29 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.216 0.784 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=2066 (21 obs) right son=2067 (16 obs)
## Primary splits:
## num of ratings < 400 to the right, improve=1.30, (0 missing)
## rate (out of 5) < 4 to the right, improve=0.95, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4.2 to the left, agree=0.59, adj=0.063, (0 split)
##
## Node number 1054: 12 observations
## predicted class=Cafe expected loss=0.58 P(node) =0.0033
## class counts: 0 0 0 0 5 4 0 0 1 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.417 0.333 0.000 0.000 0.083 0.083 0.000 0.000 0.000 0.000

tie
##

at
## Node number 1055: 18 observations
## predicted class=Casual Dining expected loss=0.61 P(node) =0.0049

Be
## class counts: 0 0 0 0 3 7 0 0 1 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.167 0.389 0.000 0.000 0.056 0.056 0.000 0.000 0.000 0.000
n
##
va
## Node number 1084: 17 observations
## predicted class=Casual Dining expected loss=0.18 P(node) =0.0046
Jo

## class counts: 0 0 0 0 0 14 0 0 2 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.824 0.000 0.000 0.118 0.000 0.000 0.000 0.000 0.000
of

##
## Node number 1085: 131 observations, complexity param=0.00033
ty

## predicted class=Casual Dining expected loss=0.4 P(node) =0.036


er

## class counts: 7 0 0 0 17 79 0 0 12 0 0 0 3 0
## probabilities: 0.053 0.000 0.000 0.000 0.130 0.603 0.000 0.000 0.092 0.000 0.000 0.000 0.023 0.000
op

## left son=2170 (124 obs) right son=2171 (7 obs)


Pr

## Primary splits:
## num of ratings < 58 to the left, improve=3.20, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=0.61, (0 missing)
## avg cost (two people) < 620 to the left, improve=0.52, (0 missing)
##
## Node number 1134: 14 observations
## predicted class=Casual Dining expected loss=0.43 P(node) =0.0038
## class counts: 0 2 0 0 0 8 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.143 0.000 0.000 0.000 0.571 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 1135: 8 observations
## predicted class=Lounge expected loss=0.25 P(node) =0.0022
## class counts: 0 0 0 0 0 2 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 1448: 83 observations, complexity param=0.00079
## predicted class=Quick Bites expected loss=0.65 P(node) =0.023
## class counts: 10 0 0 0 5 22 0 0 10 4 1 0 2 0
## probabilities: 0.120 0.000 0.000 0.000 0.060 0.265 0.000 0.000 0.120 0.048 0.012 0.000 0.024 0.000

27
## left son=2896 (19 obs) right son=2897 (64 obs)
## Primary splits:
## avg cost (two people) < 480 to the left, improve=0.89, (0 missing)
## num of ratings < 6.5 to the left, improve=0.69, (0 missing)
## rate (out of 5) < 3.4 to the right, improve=0.61, (0 missing)
##
## Node number 1449: 24 observations, complexity param=0.00079
## predicted class=Casual Dining expected loss=0.58 P(node) =0.0065
## class counts: 0 0 0 0 0 10 0 0 4 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.417 0.000 0.000 0.167 0.000 0.000 0.000 0.042 0.000
## left son=2898 (8 obs) right son=2899 (16 obs)
## Primary splits:
## rate (out of 5) < 3.2 to the right, improve=1.40, (0 missing)
## num of ratings < 4.5 to the right, improve=0.38, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.25, (0 missing)
##
## Node number 2066: 21 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.33 P(node) =0.0057
## class counts: 0 0 0 0 7 14 0 0 0 0 0 0 0 0

tie
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.667 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000

at
## left son=4132 (8 obs) right son=4133 (13 obs)
## Primary splits:

Be
## rate (out of 5) < 4.2 to the right, improve=2.20, (0 missing)
## num of ratings < 740 to the left, improve=0.72, (0 missing)
n
##
va
## Node number 2067: 16 observations
## predicted class=Casual Dining expected loss=0.062 P(node) =0.0043
Jo

## class counts: 0 0 0 0 1 15 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.062 0.938 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
of

##
## Node number 2170: 124 observations
ty

## predicted class=Casual Dining expected loss=0.37 P(node) =0.034


er

## class counts: 7 0 0 0 13 78 0 0 12 0 0 0 2 0
## probabilities: 0.056 0.000 0.000 0.000 0.105 0.629 0.000 0.000 0.097 0.000 0.000 0.000 0.016 0.000
op

##
Pr

## Node number 2171: 7 observations


## predicted class=Cafe expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 4 1 0 0 0 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.571 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.143 0.000
##
## Node number 2896: 19 observations
## predicted class=Casual Dining expected loss=0.58 P(node) =0.0052
## class counts: 2 0 0 0 0 8 0 0 1 1 1 0 0 0
## probabilities: 0.105 0.000 0.000 0.000 0.000 0.421 0.000 0.000 0.053 0.053 0.053 0.000 0.000 0.000
##
## Node number 2897: 64 observations, complexity param=0.00033
## predicted class=Quick Bites expected loss=0.64 P(node) =0.017
## class counts: 8 0 0 0 5 14 0 0 9 3 0 0 2 0
## probabilities: 0.125 0.000 0.000 0.000 0.078 0.219 0.000 0.000 0.141 0.047 0.000 0.000 0.031 0.000
## left son=5794 (35 obs) right son=5795 (29 obs)
## Primary splits:
## num of ratings < 8.5 to the right, improve=0.93, (0 missing)
## rate (out of 5) < 3.4 to the right, improve=0.76, (0 missing)
## Surrogate splits:

28
## rate (out of 5) < 3 to the left, agree=0.61, adj=0.14, (0 split)
##
## Node number 2898: 8 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 0 5 0 0 2 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.625 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000
##
## Node number 2899: 16 observations
## predicted class=Quick Bites expected loss=0.5 P(node) =0.0043
## class counts: 0 0 0 0 0 5 0 0 2 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.312 0.000 0.000 0.125 0.000 0.000 0.000 0.062 0.000
##
## Node number 4132: 8 observations
## predicted class=Cafe expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 5 3 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.625 0.375 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 4133: 13 observations
## predicted class=Casual Dining expected loss=0.15 P(node) =0.0035

tie
## class counts: 0 0 0 0 2 11 0 0 0 0 0 0 0 0

at
## probabilities: 0.000 0.000 0.000 0.000 0.154 0.846 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##

Be
## Node number 5794: 35 observations, complexity param=0.00033
## predicted class=Quick Bites expected loss=0.71 P(node) =0.0095
n
## class counts: 6 0 0 0 3 9 0 0 5 0 0 0 2 0
va
## probabilities: 0.171 0.000 0.000 0.000 0.086 0.257 0.000 0.000 0.143 0.000 0.000 0.000 0.057 0.000
## left son=11588 (19 obs) right son=11589 (16 obs)
Jo

## Primary splits:
## num of ratings < 13 to the right, improve=0.85, (0 missing)
of

## rate (out of 5) < 3 to the right, improve=0.78, (0 missing)


## Surrogate splits:
ty

## rate (out of 5) < 3.4 to the right, agree=0.63, adj=0.19, (0 split)


er

##
## Node number 5795: 29 observations, complexity param=0.00033
op

## predicted class=Quick Bites expected loss=0.55 P(node) =0.0079


Pr

## class counts: 2 0 0 0 2 5 0 0 4 3 0 0 0 0
## probabilities: 0.069 0.000 0.000 0.000 0.069 0.172 0.000 0.000 0.138 0.103 0.000 0.000 0.000 0.000
## left son=11590 (7 obs) right son=11591 (22 obs)
## Primary splits:
## rate (out of 5) < 3.4 to the right, improve=1.6, (0 missing)
## num of ratings < 6.5 to the left, improve=1.1, (0 missing)
##
## Node number 11588: 19 observations
## predicted class=Quick Bites expected loss=0.74 P(node) =0.0052
## class counts: 3 0 0 0 3 3 0 0 4 0 0 0 1 0
## probabilities: 0.158 0.000 0.000 0.000 0.158 0.158 0.000 0.000 0.211 0.000 0.000 0.000 0.053 0.000
##
## Node number 11589: 16 observations
## predicted class=Casual Dining expected loss=0.62 P(node) =0.0043
## class counts: 3 0 0 0 0 6 0 0 1 0 0 0 1 0
## probabilities: 0.188 0.000 0.000 0.000 0.000 0.375 0.000 0.000 0.062 0.000 0.000 0.000 0.062 0.000
##
## Node number 11590: 7 observations
## predicted class=Dessert Parlor expected loss=0.57 P(node) =0.0019

29
## class counts: 1 0 0 0 0 0 0 0 1 3 0 0 0 0
## probabilities: 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.143 0.429 0.000 0.000 0.000 0.000
##
## Node number 11591: 22 observations
## predicted class=Quick Bites expected loss=0.5 P(node) =0.006
## class counts: 1 0 0 0 2 5 0 0 3 0 0 0 0 0
## probabilities: 0.045 0.000 0.000 0.000 0.091 0.227 0.000 0.000 0.136 0.000 0.000 0.000 0.000 0.000

Prediction 1

predicted1= predict(train_tree1, test, type="class")


summary(train_tree1)

## Call:
## rpart(formula = type ~ ., data = train, method = "class", control = rpart.control(cp = 0))

tie
## n= 3681
##

at
## CP nsplit rel error xerror xstd

Be
## 1 0.35764 0 1.00 1.00 0.015
## 2 0.01190 1 0.64 0.65 0.014
## 3 0.00248 4 0.61 0.62 0.014
n
## 4 0.00124 7 0.60 0.61 0.014
va
## 5 0.00099 9 0.60 0.62 0.014
## 6 0.00079 17 0.59 0.62 0.014
Jo

## 7 0.00074 22 0.58 0.62 0.014


## 8 0.00062 24 0.58 0.62 0.014
of

## 9 0.00050 37 0.57 0.62 0.014


## 10 0.00043 40 0.57 0.63 0.014
ty

## 11 0.00033 47 0.57 0.63 0.014


er

## 12 0.00025 58 0.57 0.63 0.014


op

## 13 0.00000 64 0.56 0.65 0.014


##
Pr

## Variable importance
## avg cost (two people) num of ratings rate (out of 5)
## 64 21 15
##
## Node number 1: 3681 observations, complexity param=0.36
## predicted class=Quick Bites expected loss=0.55 P(node) =1
## class counts: 89 44 60 1 242 971 4 1 211 130 4 52 61 7
## probabilities: 0.024 0.012 0.016 0.000 0.066 0.264 0.001 0.000 0.057 0.035 0.001 0.014 0.017 0.002
## left son=2 (1611 obs) right son=3 (2070 obs)
## Primary splits:
## avg cost (two people) < 420 to the right, improve=590, (0 missing)
## num of ratings < 100 to the right, improve=120, (0 missing)
## rate (out of 5) < 3.8 to the right, improve= 61, (0 missing)
## Surrogate splits:
## num of ratings < 68 to the right, agree=0.68, adj=0.28, (0 split)
## rate (out of 5) < 3.8 to the right, agree=0.64, adj=0.18, (0 split)
##
## Node number 2: 1611 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.44 P(node) =0.44

30
## class counts: 27 44 0 0 185 908 4 1 85 25 1 52 23 1
## probabilities: 0.017 0.027 0.000 0.000 0.115 0.564 0.002 0.001 0.053 0.016 0.001 0.032 0.014 0.001
## left son=4 (1145 obs) right son=5 (466 obs)
## Primary splits:
## avg cost (two people) < 520 to the right, improve=59, (0 missing)
## num of ratings < 100 to the right, improve=13, (0 missing)
## rate (out of 5) < 4 to the right, improve=10, (0 missing)
## Surrogate splits:
## num of ratings < 7.5 to the right, agree=0.71, adj=0.013, (0 split)
##
## Node number 3: 2070 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.29 P(node) =0.56
## class counts: 62 0 60 1 57 63 0 0 126 105 3 0 38 6
## probabilities: 0.030 0.000 0.029 0.000 0.028 0.030 0.000 0.000 0.061 0.051 0.001 0.000 0.018 0.003
## left son=6 (479 obs) right son=7 (1591 obs)
## Primary splits:
## avg cost (two people) < 380 to the right, improve=14.0, (0 missing)
## num of ratings < 76 to the left, improve= 3.8, (0 missing)
## rate (out of 5) < 3.6 to the right, improve= 1.8, (0 missing)

tie
## Surrogate splits:

at
## rate (out of 5) < 2.7 to the left, agree=0.77, adj=0.004, (0 split)
##

Be
## Node number 4: 1145 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.35 P(node) =0.31
n
## class counts: 9 44 0 0 136 741 4 1 33 10 0 52 10 0
va
## probabilities: 0.008 0.038 0.000 0.000 0.119 0.647 0.003 0.001 0.029 0.009 0.000 0.045 0.009 0.000
## left son=8 (1059 obs) right son=9 (86 obs)
Jo

## Primary splits:
## avg cost (two people) < 1800 to the left, improve=57.0, (0 missing)
of

## rate (out of 5) < 4 to the left, improve=11.0, (0 missing)


## num of ratings < 2300 to the left, improve= 5.5, (0 missing)
ty

##
er

## Node number 5: 466 observations, complexity param=0.012


## predicted class=Casual Dining expected loss=0.64 P(node) =0.13
op

## class counts: 18 0 0 0 49 167 0 0 52 15 1 0 13 1


Pr

## probabilities: 0.039 0.000 0.000 0.000 0.105 0.358 0.000 0.000 0.112 0.032 0.002 0.000 0.028 0.002
## left son=10 (165 obs) right son=11 (301 obs)
## Primary splits:
## num of ratings < 84 to the right, improve=9.0, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=4.0, (0 missing)
## avg cost (two people) < 480 to the right, improve=1.4, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.77, adj=0.34, (0 split)
##
## Node number 6: 479 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.39 P(node) =0.13
## class counts: 9 0 3 0 24 56 0 0 53 16 0 0 19 1
## probabilities: 0.019 0.000 0.006 0.000 0.050 0.117 0.000 0.000 0.111 0.033 0.000 0.000 0.040 0.002
## left son=12 (297 obs) right son=13 (182 obs)
## Primary splits:
## num of ratings < 48 to the left, improve=2.3, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=2.0, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.6 to the left, agree=0.75, adj=0.35, (0 split)

31
##
## Node number 7: 1591 observations
## predicted class=Quick Bites expected loss=0.25 P(node) =0.43
## class counts: 53 0 57 1 33 7 0 0 73 89 3 0 19 5
## probabilities: 0.033 0.000 0.036 0.001 0.021 0.004 0.000 0.000 0.046 0.056 0.002 0.000 0.012 0.003
##
## Node number 8: 1059 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.31 P(node) =0.29
## class counts: 9 37 0 0 135 730 2 1 33 10 0 0 10 0
## probabilities: 0.008 0.035 0.000 0.000 0.127 0.689 0.002 0.001 0.031 0.009 0.000 0.000 0.009 0.000
## left son=16 (880 obs) right son=17 (179 obs)
## Primary splits:
## avg cost (two people) < 1200 to the left, improve=9.5, (0 missing)
## rate (out of 5) < 4 to the left, improve=5.8, (0 missing)
## num of ratings < 2300 to the left, improve=5.5, (0 missing)
## Surrogate splits:
## num of ratings < 1600 to the left, agree=0.84, adj=0.061, (0 split)
## rate (out of 5) < 4.4 to the left, agree=0.84, adj=0.056, (0 split)
##

tie
## Node number 9: 86 observations, complexity param=0.0012

at
## predicted class=Fine Dining expected loss=0.4 P(node) =0.023
## class counts: 0 7 0 0 1 11 2 0 0 0 0 52 0 0

Be
## probabilities: 0.000 0.081 0.000 0.000 0.012 0.128 0.023 0.000 0.000 0.000 0.000 0.605 0.000 0.000
## left son=18 (51 obs) right son=19 (35 obs) n
## Primary splits:
va
## avg cost (two people) < 2600 to the left, improve=6.2, (0 missing)
## num of ratings < 45 to the left, improve=5.8, (0 missing)
Jo

## rate (out of 5) < 4 to the left, improve=4.9, (0 missing)


## Surrogate splits:
of

## rate (out of 5) < 4 to the left, agree=0.66, adj=0.171, (0 split)


## num of ratings < 230 to the left, agree=0.60, adj=0.029, (0 split)
ty

##
er

## Node number 10: 165 observations, complexity param=0.00099


## predicted class=Casual Dining expected loss=0.5 P(node) =0.045
op

## class counts: 3 0 0 0 18 83 0 0 18 5 0 0 3 1
Pr

## probabilities: 0.018 0.000 0.000 0.000 0.109 0.503 0.000 0.000 0.109 0.030 0.000 0.000 0.018 0.006
## left son=20 (115 obs) right son=21 (50 obs)
## Primary splits:
## avg cost (two people) < 480 to the right, improve=4.2, (0 missing)
## rate (out of 5) < 4 to the right, improve=3.2, (0 missing)
## num of ratings < 120 to the left, improve=1.1, (0 missing)
## Surrogate splits:
## num of ratings < 1000 to the left, agree=0.7, adj=0.02, (0 split)
##
## Node number 11: 301 observations, complexity param=0.0025
## predicted class=Quick Bites expected loss=0.62 P(node) =0.082
## class counts: 15 0 0 0 31 84 0 0 34 10 1 0 10 0
## probabilities: 0.050 0.000 0.000 0.000 0.103 0.279 0.000 0.000 0.113 0.033 0.003 0.000 0.033 0.000
## left son=22 (264 obs) right son=23 (37 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the left, improve=2.70, (0 missing)
## num of ratings < 56 to the left, improve=1.60, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.45, (0 missing)
## Surrogate splits:

32
## num of ratings < 72 to the left, agree=0.88, adj=0.054, (0 split)
##
## Node number 12: 297 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.43 P(node) =0.081
## class counts: 9 0 3 0 17 27 0 0 40 10 0 0 14 1
## probabilities: 0.030 0.000 0.010 0.000 0.057 0.091 0.000 0.000 0.135 0.034 0.000 0.000 0.047 0.003
## left son=24 (28 obs) right son=25 (269 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the right, improve=1.5, (0 missing)
## num of ratings < 4.5 to the right, improve=1.0, (0 missing)
## Surrogate splits:
## num of ratings < 46 to the right, agree=0.91, adj=0.036, (0 split)
##
## Node number 13: 182 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.33 P(node) =0.049
## class counts: 0 0 0 0 7 29 0 0 13 6 0 0 5 0
## probabilities: 0.000 0.000 0.000 0.000 0.038 0.159 0.000 0.000 0.071 0.033 0.000 0.000 0.027 0.000
## left son=26 (8 obs) right son=27 (174 obs)
## Primary splits:

tie
## rate (out of 5) < 4.2 to the right, improve=2.60, (0 missing)

at
## num of ratings < 96 to the right, improve=0.84, (0 missing)
## Surrogate splits:

Be
## num of ratings < 1100 to the right, agree=0.97, adj=0.25, (0 split)
## n
## Node number 16: 880 observations, complexity param=0.00062
va
## predicted class=Casual Dining expected loss=0.3 P(node) =0.24
## class counts: 9 17 0 0 132 620 0 1 33 8 0 0 10 0
Jo

## probabilities: 0.010 0.019 0.000 0.000 0.150 0.705 0.000 0.001 0.037 0.009 0.000 0.000 0.011 0.000
## left son=32 (212 obs) right son=33 (668 obs)
of

## Primary splits:
## rate (out of 5) < 4 to the right, improve=12.0, (0 missing)
ty

## num of ratings < 2400 to the left, improve= 4.8, (0 missing)


er

## avg cost (two people) < 720 to the right, improve= 3.3, (0 missing)
## Surrogate splits:
op

## num of ratings < 430 to the right, agree=0.83, adj=0.316, (0 split)


Pr

## avg cost (two people) < 1100 to the right, agree=0.77, adj=0.047, (0 split)
##
## Node number 17: 179 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.39 P(node) =0.049
## class counts: 0 20 0 0 3 110 2 0 0 2 0 0 0 0
## probabilities: 0.000 0.112 0.000 0.000 0.017 0.615 0.011 0.000 0.000 0.011 0.000 0.000 0.000 0.000
## left son=34 (108 obs) right son=35 (71 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=5.0, (0 missing)
## num of ratings < 170 to the right, improve=4.4, (0 missing)
## avg cost (two people) < 1500 to the left, improve=1.2, (0 missing)
## Surrogate splits:
## num of ratings < 210 to the right, agree=0.85, adj=0.63, (0 split)
##
## Node number 18: 51 observations, complexity param=0.0012
## predicted class=Fine Dining expected loss=0.59 P(node) =0.014
## class counts: 0 6 0 0 1 11 1 0 0 0 0 21 0 0
## probabilities: 0.000 0.118 0.000 0.000 0.020 0.216 0.020 0.000 0.000 0.000 0.000 0.412 0.000 0.000
## left son=36 (11 obs) right son=37 (40 obs)

33
## Primary splits:
## num of ratings < 44 to the left, improve=3.4, (0 missing)
## rate (out of 5) < 4 to the right, improve=1.6, (0 missing)
## avg cost (two people) < 2300 to the left, improve=1.5, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.6 to the left, agree=0.82, adj=0.18, (0 split)
##
## Node number 19: 35 observations
## predicted class=Fine Dining expected loss=0.11 P(node) =0.0095
## class counts: 0 1 0 0 0 0 1 0 0 0 0 31 0 0
## probabilities: 0.000 0.029 0.000 0.000 0.000 0.000 0.029 0.000 0.000 0.000 0.000 0.886 0.000 0.000
##
## Node number 20: 115 observations, complexity param=0.00074
## predicted class=Casual Dining expected loss=0.44 P(node) =0.031
## class counts: 3 0 0 0 15 64 0 0 13 4 0 0 2 0
## probabilities: 0.026 0.000 0.000 0.000 0.130 0.557 0.000 0.000 0.113 0.035 0.000 0.000 0.017 0.000
## left son=40 (23 obs) right son=41 (92 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=3.7, (0 missing)

tie
## num of ratings < 120 to the left, improve=1.3, (0 missing)

at
##
## Node number 21: 50 observations, complexity param=0.00099

Be
## predicted class=Quick Bites expected loss=0.6 P(node) =0.014
## class counts: 0 0 0 0 3
n 19 0 0 5 1 0 0 1 1
## probabilities: 0.000 0.000 0.000 0.000 0.060 0.380 0.000 0.000 0.100 0.020 0.000 0.000 0.020 0.020
va
## left son=42 (7 obs) right son=43 (43 obs)
## Primary splits:
Jo

## num of ratings < 500 to the right, improve=1.00, (0 missing)


## rate (out of 5) < 4 to the left, improve=0.93, (0 missing)
of

##
## Node number 22: 264 observations, complexity param=0.0025
ty

## predicted class=Quick Bites expected loss=0.62 P(node) =0.072


er

## class counts: 14 0 0 0 21 79 0 0 33 6 1 0 9 0
## probabilities: 0.053 0.000 0.000 0.000 0.080 0.299 0.000 0.000 0.125 0.023 0.004 0.000 0.034 0.000
op

## left son=44 (70 obs) right son=45 (194 obs)


Pr

## Primary splits:
## rate (out of 5) < 3.6 to the right, improve=2.40, (0 missing)
## num of ratings < 56 to the left, improve=1.20, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.23, (0 missing)
##
## Node number 23: 37 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.62 P(node) =0.01
## class counts: 1 0 0 0 10 5 0 0 1 4 0 0 1 0
## probabilities: 0.027 0.000 0.000 0.000 0.270 0.135 0.000 0.000 0.027 0.108 0.000 0.000 0.027 0.000
## left son=46 (10 obs) right son=47 (27 obs)
## Primary splits:
## num of ratings < 62 to the right, improve=1.20, (0 missing)
## rate (out of 5) < 3.8 to the left, improve=0.68, (0 missing)
##
## Node number 24: 28 observations
## predicted class=Quick Bites expected loss=0.61 P(node) =0.0076
## class counts: 2 0 2 0 4 4 0 0 4 1 0 0 0 0
## probabilities: 0.071 0.000 0.071 0.000 0.143 0.143 0.000 0.000 0.143 0.036 0.000 0.000 0.000 0.000
##

34
## Node number 25: 269 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.41 P(node) =0.073
## class counts: 7 0 1 0 13 23 0 0 36 9 0 0 14 1
## probabilities: 0.026 0.000 0.004 0.000 0.048 0.086 0.000 0.000 0.134 0.033 0.000 0.000 0.052 0.004
## left son=50 (205 obs) right son=51 (64 obs)
## Primary splits:
## rate (out of 5) < 3 to the right, improve=0.95, (0 missing)
## num of ratings < 4.5 to the right, improve=0.85, (0 missing)
## Surrogate splits:
## num of ratings < 40 to the left, agree=0.89, adj=0.55, (0 split)
##
## Node number 26: 8 observations
## predicted class=Delivery expected loss=0.62 P(node) =0.0022
## class counts: 0 0 0 0 2 1 0 0 3 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.250 0.125 0.000 0.000 0.375 0.000 0.000 0.000 0.000 0.000
##
## Node number 27: 174 observations
## predicted class=Quick Bites expected loss=0.31 P(node) =0.047
## class counts: 0 0 0 0 5 28 0 0 10 6 0 0 5 0

tie
## probabilities: 0.000 0.000 0.000 0.000 0.029 0.161 0.000 0.000 0.057 0.034 0.000 0.000 0.029 0.000

at
##
## Node number 32: 212 observations, complexity param=0.00062

Be
## predicted class=Casual Dining expected loss=0.42 P(node) =0.058
## class counts: 0 2 0 0 66n 124 0 0 2 4 0 0 0 0
## probabilities: 0.000 0.009 0.000 0.000 0.311 0.585 0.000 0.000 0.009 0.019 0.000 0.000 0.000 0.000
va
## left son=64 (103 obs) right son=65 (109 obs)
## Primary splits:
Jo

## avg cost (two people) < 780 to the right, improve=5.6, (0 missing)
## num of ratings < 2400 to the left, improve=2.8, (0 missing)
of

## rate (out of 5) < 4.4 to the right, improve=1.3, (0 missing)


## Surrogate splits:
ty

## num of ratings < 590 to the right, agree=0.61, adj=0.194, (0 split)


er

## rate (out of 5) < 4.2 to the right, agree=0.56, adj=0.097, (0 split)


##
op

## Node number 33: 668 observations, complexity param=0.00033


Pr

## predicted class=Casual Dining expected loss=0.26 P(node) =0.18


## class counts: 9 15 0 0 66 496 0 1 31 4 0 0 10 0
## probabilities: 0.013 0.022 0.000 0.000 0.099 0.743 0.000 0.001 0.046 0.006 0.000 0.000 0.015 0.000
## left son=66 (216 obs) right son=67 (452 obs)
## Primary splits:
## num of ratings < 110 to the right, improve=5.8, (0 missing)
## avg cost (two people) < 720 to the right, improve=2.0, (0 missing)
## rate (out of 5) < 3 to the right, improve=0.7, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.73, adj=0.18, (0 split)
##
## Node number 34: 108 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.29 P(node) =0.029
## class counts: 0 6 0 0 3 77 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.056 0.000 0.000 0.028 0.713 0.009 0.000 0.000 0.009 0.000 0.000 0.000 0.000
## left son=68 (101 obs) right son=69 (7 obs)
## Primary splits:
## num of ratings < 3800 to the left, improve=3.90, (0 missing)
## rate (out of 5) < 4.4 to the right, improve=1.40, (0 missing)

35
## avg cost (two people) < 1500 to the left, improve=0.76, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4.6 to the left, agree=0.94, adj=0.14, (0 split)
##
## Node number 35: 71 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.54 P(node) =0.019
## class counts: 0 14 0 0 0 33 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.197 0.000 0.000 0.000 0.465 0.014 0.000 0.000 0.014 0.000 0.000 0.000 0.000
## left son=70 (63 obs) right son=71 (8 obs)
## Primary splits:
## num of ratings < 660 to the left, improve=1.7, (0 missing)
## rate (out of 5) < 3.8 to the right, improve=1.4, (0 missing)
## avg cost (two people) < 1600 to the left, improve=1.0, (0 missing)
##
## Node number 36: 11 observations
## predicted class=Casual Dining expected loss=0.55 P(node) =0.003
## class counts: 0 2 0 0 1 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.182 0.000 0.000 0.091 0.455 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##

tie
## Node number 37: 40 observations

at
## predicted class=Fine Dining expected loss=0.47 P(node) =0.011
## class counts: 0 4 0 0 0 6 1 0 0 0 0 21 0 0

Be
## probabilities: 0.000 0.100 0.000 0.000 0.000 0.150 0.025 0.000 0.000 0.000 0.000 0.525 0.000 0.000
## n
## Node number 40: 23 observations, complexity param=0.00074
va
## predicted class=Cafe expected loss=0.7 P(node) =0.0062
## class counts: 2 0 0 0 7 6 0 0 4 1 0 0 0 0
Jo

## probabilities: 0.087 0.000 0.000 0.000 0.304 0.261 0.000 0.000 0.174 0.043 0.000 0.000 0.000 0.000
## left son=80 (8 obs) right son=81 (15 obs)
of

## Primary splits:
## num of ratings < 230 to the left, improve=1.50, (0 missing)
ty

## rate (out of 5) < 4.2 to the right, improve=0.66, (0 missing)


er

##
## Node number 41: 92 observations
op

## predicted class=Casual Dining expected loss=0.37 P(node) =0.025


Pr

## class counts: 1 0 0 0 8 58 0 0 9 3 0 0 2 0
## probabilities: 0.011 0.000 0.000 0.000 0.087 0.630 0.000 0.000 0.098 0.033 0.000 0.000 0.022 0.000
##
## Node number 42: 7 observations
## predicted class=Casual Dining expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 0 4 0 0 1 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.571 0.000 0.000 0.143 0.000 0.000 0.000 0.143 0.000
##
## Node number 43: 43 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.56 P(node) =0.012
## class counts: 0 0 0 0 3 15 0 0 4 1 0 0 0 1
## probabilities: 0.000 0.000 0.000 0.000 0.070 0.349 0.000 0.000 0.093 0.023 0.000 0.000 0.000 0.023
## left son=86 (35 obs) right son=87 (8 obs)
## Primary splits:
## rate (out of 5) < 4 to the left, improve=1.6, (0 missing)
## num of ratings < 180 to the left, improve=1.3, (0 missing)
## Surrogate splits:
## num of ratings < 370 to the left, agree=0.84, adj=0.12, (0 split)
##

36
## Node number 44: 70 observations, complexity param=0.0025
## predicted class=Casual Dining expected loss=0.59 P(node) =0.019
## class counts: 1 0 0 0 10 29 0 0 4 1 0 0 1 0
## probabilities: 0.014 0.000 0.000 0.000 0.143 0.414 0.000 0.000 0.057 0.014 0.000 0.000 0.014 0.000
## left son=88 (47 obs) right son=89 (23 obs)
## Primary splits:
## num of ratings < 24 to the right, improve=5.10, (0 missing)
## rate (out of 5) < 3.6 to the left, improve=0.25, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.21, (0 missing)
##
## Node number 45: 194 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.6 P(node) =0.053
## class counts: 13 0 0 0 11 50 0 0 29 5 1 0 8 0
## probabilities: 0.067 0.000 0.000 0.000 0.057 0.258 0.000 0.000 0.149 0.026 0.005 0.000 0.041 0.000
## left son=90 (182 obs) right son=91 (12 obs)
## Primary splits:
## num of ratings < 60 to the left, improve=3.20, (0 missing)
## rate (out of 5) < 3 to the right, improve=1.30, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.29, (0 missing)

tie
##

at
## Node number 46: 10 observations
## predicted class=Cafe expected loss=0.5 P(node) =0.0027

Be
## class counts: 0 0 0 0 5 0 0 0 0 1 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.500 0.000 0.000 0.000 0.000 0.100 0.000 0.000 0.100 0.000
n
##
va
## Node number 47: 27 observations
## predicted class=Quick Bites expected loss=0.59 P(node) =0.0073
Jo

## class counts: 1 0 0 0 5 5 0 0 1 3 0 0 0 0
## probabilities: 0.037 0.000 0.000 0.000 0.185 0.185 0.000 0.000 0.037 0.111 0.000 0.000 0.000 0.000
of

##
## Node number 50: 205 observations, complexity param=0.00043
ty

## predicted class=Quick Bites expected loss=0.43 P(node) =0.056


er

## class counts: 6 0 0 0 7 21 0 0 30 7 0 0 11 1
## probabilities: 0.029 0.000 0.000 0.000 0.034 0.102 0.000 0.000 0.146 0.034 0.000 0.000 0.054 0.005
op

## left son=100 (79 obs) right son=101 (126 obs)


Pr

## Primary splits:
## rate (out of 5) < 3.4 to the left, improve=2.0, (0 missing)
## num of ratings < 4.5 to the right, improve=1.1, (0 missing)
## Surrogate splits:
## num of ratings < 5.5 to the left, agree=0.69, adj=0.2, (0 split)
##
## Node number 51: 64 observations
## predicted class=Quick Bites expected loss=0.34 P(node) =0.017
## class counts: 1 0 1 0 6 2 0 0 6 2 0 0 3 0
## probabilities: 0.016 0.000 0.016 0.000 0.094 0.031 0.000 0.000 0.094 0.031 0.000 0.000 0.047 0.000
##
## Node number 64: 103 observations, complexity param=5e-04
## predicted class=Casual Dining expected loss=0.28 P(node) =0.028
## class counts: 0 2 0 0 23 74 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.019 0.000 0.000 0.223 0.718 0.000 0.000 0.000 0.010 0.000 0.000 0.000 0.000
## left son=128 (41 obs) right son=129 (62 obs)
## Primary splits:
## avg cost (two people) < 980 to the right, improve=2.00, (0 missing)
## num of ratings < 1400 to the left, improve=1.60, (0 missing)

37
## rate (out of 5) < 4.4 to the right, improve=0.72, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4.6 to the right, agree=0.62, adj=0.049, (0 split)
## num of ratings < 120 to the left, agree=0.62, adj=0.049, (0 split)
##
## Node number 65: 109 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.54 P(node) =0.03
## class counts: 0 0 0 0 43 50 0 0 2 3 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.394 0.459 0.000 0.000 0.018 0.028 0.000 0.000 0.000 0.000
## left son=130 (56 obs) right son=131 (53 obs)
## Primary splits:
## avg cost (two people) < 620 to the right, improve=1.60, (0 missing)
## num of ratings < 170 to the right, improve=1.10, (0 missing)
## rate (out of 5) < 4 to the right, improve=0.87, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4 to the left, agree=0.58, adj=0.13, (0 split)
## num of ratings < 250 to the right, agree=0.58, adj=0.13, (0 split)
##
## Node number 66: 216 observations

tie
## predicted class=Casual Dining expected loss=0.14 P(node) =0.059

at
## class counts: 0 2 0 0 14 186 0 0 2 1 0 0 4 0
## probabilities: 0.000 0.009 0.000 0.000 0.065 0.861 0.000 0.000 0.009 0.005 0.000 0.000 0.019 0.000

Be
##
## Node number 67: 452 observations, complexity param=0.00033
n
## predicted class=Casual Dining expected loss=0.31 P(node) =0.12
va
## class counts: 9 13 0 0 52 310 0 1 29 3 0 0 6 0
## probabilities: 0.020 0.029 0.000 0.000 0.115 0.686 0.000 0.002 0.064 0.007 0.000 0.000 0.013 0.000
Jo

## left son=134 (240 obs) right son=135 (212 obs)


## Primary splits:
of

## avg cost (two people) < 680 to the right, improve=2.2, (0 missing)
## num of ratings < 90 to the right, improve=2.1, (0 missing)
ty

## rate (out of 5) < 2.7 to the left, improve=1.1, (0 missing)


er

## Surrogate splits:
## num of ratings < 26 to the right, agree=0.57, adj=0.075, (0 split)
op

## rate (out of 5) < 3.8 to the left, agree=0.53, adj=0.005, (0 split)


Pr

##
## Node number 68: 101 observations
## predicted class=Casual Dining expected loss=0.25 P(node) =0.027
## class counts: 0 6 0 0 3 76 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.059 0.000 0.000 0.030 0.752 0.010 0.000 0.000 0.010 0.000 0.000 0.000 0.000
##
## Node number 69: 7 observations
## predicted class=Lounge expected loss=0.57 P(node) =0.0019
## class counts: 0 0 0 0 0 1 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 70: 63 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.49 P(node) =0.017
## class counts: 0 11 0 0 0 32 1 0 0 1 0 0 0 0
## probabilities: 0.000 0.175 0.000 0.000 0.000 0.508 0.016 0.000 0.000 0.016 0.000 0.000 0.000 0.000
## left son=140 (9 obs) right son=141 (54 obs)
## Primary splits:
## num of ratings < 170 to the right, improve=1.40, (0 missing)
## rate (out of 5) < 3.8 to the right, improve=1.40, (0 missing)

38
## avg cost (two people) < 1600 to the left, improve=0.69, (0 missing)
##
## Node number 71: 8 observations
## predicted class=Bar expected loss=0.62 P(node) =0.0022
## class counts: 0 3 0 0 0 1 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.375 0.000 0.000 0.000 0.125 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 80: 8 observations
## predicted class=Cafe expected loss=0.5 P(node) =0.0022
## class counts: 2 0 0 0 4 1 0 0 0 0 0 0 0 0
## probabilities: 0.250 0.000 0.000 0.000 0.500 0.125 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 81: 15 observations
## predicted class=Casual Dining expected loss=0.67 P(node) =0.0041
## class counts: 0 0 0 0 3 5 0 0 4 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.200 0.333 0.000 0.000 0.267 0.067 0.000 0.000 0.000 0.000
##
## Node number 86: 35 observations, complexity param=0.00099
## predicted class=Casual Dining expected loss=0.57 P(node) =0.0095

tie
## class counts: 0 0 0 0 2 15 0 0 2 0 0 0 0 1

at
## probabilities: 0.000 0.000 0.000 0.000 0.057 0.429 0.000 0.000 0.057 0.000 0.000 0.000 0.000 0.029
## left son=172 (8 obs) right son=173 (27 obs)

Be
## Primary splits:
## rate (out of 5) < 3 to the left, improve=0.82, (0 missing)
n
## num of ratings < 180 to the left, improve=0.71, (0 missing)
va
##
## Node number 87: 8 observations
Jo

## predicted class=Quick Bites expected loss=0.5 P(node) =0.0022


## class counts: 0 0 0 0 1 0 0 0 2 1 0 0 0 0
of

## probabilities: 0.000 0.000 0.000 0.000 0.125 0.000 0.000 0.000 0.250 0.125 0.000 0.000 0.000 0.000
##
ty

## Node number 88: 47 observations


er

## predicted class=Casual Dining expected loss=0.43 P(node) =0.013


## class counts: 1 0 0 0 5 27 0 0 2 0 0 0 0 0
op

## probabilities: 0.021 0.000 0.000 0.000 0.106 0.574 0.000 0.000 0.043 0.000 0.000 0.000 0.000 0.000
Pr

##
## Node number 89: 23 observations
## predicted class=Quick Bites expected loss=0.48 P(node) =0.0062
## class counts: 0 0 0 0 5 2 0 0 2 1 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.217 0.087 0.000 0.000 0.087 0.043 0.000 0.000 0.043 0.000
##
## Node number 90: 182 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.63 P(node) =0.049
## class counts: 13 0 0 0 11 49 0 0 29 5 1 0 7 0
## probabilities: 0.071 0.000 0.000 0.000 0.060 0.269 0.000 0.000 0.159 0.027 0.005 0.000 0.038 0.000
## left son=180 (7 obs) right son=181 (175 obs)
## Primary splits:
## num of ratings < 50 to the right, improve=2.30, (0 missing)
## rate (out of 5) < 3 to the right, improve=1.20, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.25, (0 missing)
##
## Node number 91: 12 observations
## predicted class=Quick Bites expected loss=0.17 P(node) =0.0033
## class counts: 0 0 0 0 0 1 0 0 0 0 0 0 1 0

39
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.083 0.000 0.000 0.000 0.000 0.000 0.000 0.083 0.000
##
## Node number 100: 79 observations, complexity param=0.00043
## predicted class=Quick Bites expected loss=0.53 P(node) =0.021
## class counts: 3 0 0 0 3 10 0 0 14 1 0 0 8 0
## probabilities: 0.038 0.000 0.000 0.000 0.038 0.127 0.000 0.000 0.177 0.013 0.000 0.000 0.101 0.000
## left son=200 (11 obs) right son=201 (68 obs)
## Primary splits:
## num of ratings < 24 to the right, improve=4.00, (0 missing)
## rate (out of 5) < 3.2 to the right, improve=0.72, (0 missing)
##
## Node number 101: 126 observations
## predicted class=Quick Bites expected loss=0.37 P(node) =0.034
## class counts: 3 0 0 0 4 11 0 0 16 6 0 0 3 1
## probabilities: 0.024 0.000 0.000 0.000 0.032 0.087 0.000 0.000 0.127 0.048 0.000 0.000 0.024 0.008
##
## Node number 128: 41 observations
## predicted class=Casual Dining expected loss=0.17 P(node) =0.011
## class counts: 0 2 0 0 4 34 0 0 0 0 0 0 0 0

tie
## probabilities: 0.000 0.049 0.000 0.000 0.098 0.829 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000

at
##
## Node number 129: 62 observations, complexity param=5e-04

Be
## predicted class=Casual Dining expected loss=0.35 P(node) =0.017
## class counts: 0 0 0 0 19n 40 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.306 0.645 0.000 0.000 0.000 0.016 0.000 0.000 0.000 0.000
va
## left son=258 (55 obs) right son=259 (7 obs)
## Primary splits:
Jo

## num of ratings < 1400 to the left, improve=1.70, (0 missing)


## avg cost (two people) < 820 to the left, improve=1.20, (0 missing)
of

## rate (out of 5) < 4.2 to the right, improve=0.94, (0 missing)


## Surrogate splits:
ty

## rate (out of 5) < 4.4 to the left, agree=0.9, adj=0.14, (0 split)


er

##
## Node number 130: 56 observations, complexity param=0.00062
op

## predicted class=Cafe expected loss=0.52 P(node) =0.015


Pr

## class counts: 0 0 0 0 27 27 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.482 0.482 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=260 (35 obs) right son=261 (21 obs)
## Primary splits:
## rate (out of 5) < 4 to the right, improve=1.400, (0 missing)
## num of ratings < 790 to the right, improve=1.200, (0 missing)
## avg cost (two people) < 720 to the right, improve=0.082, (0 missing)
## Surrogate splits:
## num of ratings < 140 to the right, agree=0.71, adj=0.24, (0 split)
##
## Node number 131: 53 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.57 P(node) =0.014
## class counts: 0 0 0 0 16 23 0 0 2 3 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.302 0.434 0.000 0.000 0.038 0.057 0.000 0.000 0.000 0.000
## left son=262 (16 obs) right son=263 (37 obs)
## Primary splits:
## num of ratings < 500 to the right, improve=1.30, (0 missing)
## avg cost (two people) < 580 to the left, improve=0.61, (0 missing)
## rate (out of 5) < 4 to the right, improve=0.23, (0 missing)

40
## Surrogate splits:
## rate (out of 5) < 4.2 to the right, agree=0.81, adj=0.375, (0 split)
## avg cost (two people) < 580 to the left, agree=0.72, adj=0.062, (0 split)
##
## Node number 134: 240 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.27 P(node) =0.065
## class counts: 2 13 0 0 24 176 0 1 10 1 0 0 3 0
## probabilities: 0.008 0.054 0.000 0.000 0.100 0.733 0.000 0.004 0.042 0.004 0.000 0.000 0.012 0.000
## left son=268 (8 obs) right son=269 (232 obs)
## Primary splits:
## num of ratings < 93 to the right, improve=4.40, (0 missing)
## avg cost (two people) < 980 to the right, improve=1.50, (0 missing)
## rate (out of 5) < 3 to the left, improve=0.75, (0 missing)
##
## Node number 135: 212 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.37 P(node) =0.058
## class counts: 7 0 0 0 28 134 0 0 19 2 0 0 3 0
## probabilities: 0.033 0.000 0.000 0.000 0.132 0.632 0.000 0.000 0.090 0.009 0.000 0.000 0.014 0.000
## left son=270 (27 obs) right son=271 (185 obs)

tie
## Primary splits:

at
## rate (out of 5) < 3.8 to the right, improve=3.2, (0 missing)
## num of ratings < 38 to the right, improve=1.5, (0 missing)

Be
## avg cost (two people) < 560 to the right, improve=1.5, (0 missing)
## Surrogate splits: n
## num of ratings < 84 to the right, agree=0.88, adj=0.037, (0 split)
va
##
## Node number 140: 9 observations
Jo

## predicted class=Casual Dining expected loss=0.22 P(node) =0.0024


## class counts: 0 0 0 0 0 7 1 0 0 0 0 0 0 0
of

## probabilities: 0.000 0.000 0.000 0.000 0.000 0.778 0.111 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
ty

## Node number 141: 54 observations, complexity param=0.00062


er

## predicted class=Casual Dining expected loss=0.54 P(node) =0.015


## class counts: 0 11 0 0 0 25 0 0 0 1 0 0 0 0
op

## probabilities: 0.000 0.204 0.000 0.000 0.000 0.463 0.000 0.000 0.000 0.019 0.000 0.000 0.000 0.000
Pr

## left son=282 (15 obs) right son=283 (39 obs)


## Primary splits:
## rate (out of 5) < 3.8 to the right, improve=2.40, (0 missing)
## num of ratings < 65 to the right, improve=1.70, (0 missing)
## avg cost (two people) < 1600 to the left, improve=0.81, (0 missing)
## Surrogate splits:
## num of ratings < 65 to the right, agree=0.8, adj=0.27, (0 split)
##
## Node number 172: 8 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 1 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.125 0.625 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 173: 27 observations, complexity param=0.00099
## predicted class=Quick Bites expected loss=0.52 P(node) =0.0073
## class counts: 0 0 0 0 1 10 0 0 2 0 0 0 0 1
## probabilities: 0.000 0.000 0.000 0.000 0.037 0.370 0.000 0.000 0.074 0.000 0.000 0.000 0.000 0.037
## left son=346 (8 obs) right son=347 (19 obs)
## Primary splits:

41
## rate (out of 5) < 3.8 to the right, improve=1.50, (0 missing)
## num of ratings < 220 to the right, improve=0.49, (0 missing)
## Surrogate splits:
## num of ratings < 280 to the right, agree=0.81, adj=0.38, (0 split)
##
## Node number 180: 7 observations
## predicted class=Delivery expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 1 2 0 0 4 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.143 0.286 0.000 0.000 0.571 0.000 0.000 0.000 0.000 0.000
##
## Node number 181: 175 observations, complexity param=0.00079
## predicted class=Quick Bites expected loss=0.62 P(node) =0.048
## class counts: 13 0 0 0 10 47 0 0 25 5 1 0 7 0
## probabilities: 0.074 0.000 0.000 0.000 0.057 0.269 0.000 0.000 0.143 0.029 0.006 0.000 0.040 0.000
## left son=362 (123 obs) right son=363 (52 obs)
## Primary splits:
## num of ratings < 34 to the left, improve=1.90, (0 missing)
## rate (out of 5) < 3 to the right, improve=1.40, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.29, (0 missing)

tie
## Surrogate splits:

at
## rate (out of 5) < 2.8 to the right, agree=0.9, adj=0.65, (0 split)
##

Be
## Node number 200: 11 observations
## predicted class=Delivery expected loss=0.36 P(node) =0.003
n
## class counts: 1 0 0 0 0 1 0 0 7 0 0 0 0 0
va
## probabilities: 0.091 0.000 0.000 0.000 0.000 0.091 0.000 0.000 0.636 0.000 0.000 0.000 0.000 0.000
##
Jo

## Node number 201: 68 observations


## predicted class=Quick Bites expected loss=0.49 P(node) =0.018
of

## class counts: 2 0 0 0 3 9 0 0 7 1 0 0 8 0
## probabilities: 0.029 0.000 0.000 0.000 0.044 0.132 0.000 0.000 0.103 0.015 0.000 0.000 0.118 0.000
ty

##
er

## Node number 258: 55 observations, complexity param=0.00025


## predicted class=Casual Dining expected loss=0.31 P(node) =0.015
op

## class counts: 0 0 0 0 15 38 0 0 0 1 0 0 0 0
Pr

## probabilities: 0.000 0.000 0.000 0.000 0.273 0.691 0.000 0.000 0.000 0.018 0.000 0.000 0.000 0.000
## left son=516 (46 obs) right son=517 (9 obs)
## Primary splits:
## num of ratings < 150 to the right, improve=0.88, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=0.55, (0 missing)
## avg cost (two people) < 820 to the left, improve=0.48, (0 missing)
##
## Node number 259: 7 observations
## predicted class=Cafe expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 4 2 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.571 0.286 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 260: 35 observations, complexity param=5e-04
## predicted class=Cafe expected loss=0.43 P(node) =0.0095
## class counts: 0 0 0 0 20 14 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.571 0.400 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=520 (21 obs) right son=521 (14 obs)
## Primary splits:
## num of ratings < 310 to the right, improve=0.75, (0 missing)

42
## avg cost (two people) < 720 to the right, improve=0.30, (0 missing)
## rate (out of 5) < 4.2 to the left, improve=0.25, (0 missing)
## Surrogate splits:
## avg cost (two people) < 680 to the right, agree=0.66, adj=0.14, (0 split)
##
## Node number 261: 21 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0057
## class counts: 0 0 0 0 7 13 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.619 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 262: 16 observations
## predicted class=Cafe expected loss=0.5 P(node) =0.0043
## class counts: 0 0 0 0 8 6 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.500 0.375 0.000 0.000 0.000 0.062 0.000 0.000 0.000 0.000
##
## Node number 263: 37 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.54 P(node) =0.01
## class counts: 0 0 0 0 8 17 0 0 2 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.216 0.459 0.000 0.000 0.054 0.054 0.000 0.000 0.000 0.000

tie
## left son=526 (7 obs) right son=527 (30 obs)

at
## Primary splits:
## num of ratings < 340 to the right, improve=1.90, (0 missing)

Be
## rate (out of 5) < 4 to the right, improve=0.19, (0 missing)
## n
## Node number 268: 8 observations
va
## predicted class=Cafe expected loss=0.62 P(node) =0.0022
## class counts: 0 2 0 0 3 1 0 0 2 0 0 0 0 0
Jo

## probabilities: 0.000 0.250 0.000 0.000 0.375 0.125 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000
##
of

## Node number 269: 232 observations


## predicted class=Casual Dining expected loss=0.25 P(node) =0.063
ty

## class counts: 2 11 0 0 21 175 0 1 8 1 0 0 3 0


er

## probabilities: 0.009 0.047 0.000 0.000 0.091 0.754 0.000 0.004 0.034 0.004 0.000 0.000 0.013 0.000
##
op

## Node number 270: 27 observations, complexity param=0.00033


Pr

## predicted class=Casual Dining expected loss=0.59 P(node) =0.0073


## class counts: 0 0 0 0 9 11 0 0 4 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.407 0.000 0.000 0.148 0.074 0.000 0.000 0.000 0.000
## left son=540 (16 obs) right son=541 (11 obs)
## Primary splits:
## rate (out of 5) < 3.8 to the left, improve=0.80, (0 missing)
## num of ratings < 50 to the right, improve=0.53, (0 missing)
## Surrogate splits:
## num of ratings < 48 to the left, agree=0.67, adj=0.18, (0 split)
##
## Node number 271: 185 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.34 P(node) =0.05
## class counts: 7 0 0 0 19 123 0 0 15 0 0 0 3 0
## probabilities: 0.038 0.000 0.000 0.000 0.103 0.665 0.000 0.000 0.081 0.000 0.000 0.000 0.016 0.000
## left son=542 (148 obs) right son=543 (37 obs)
## Primary splits:
## avg cost (two people) < 560 to the right, improve=1.30, (0 missing)
## num of ratings < 66 to the right, improve=0.91, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=0.47, (0 missing)

43
##
## Node number 282: 15 observations
## predicted class=Bar expected loss=0.53 P(node) =0.0041
## class counts: 0 7 0 0 0 4 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.467 0.000 0.000 0.000 0.267 0.000 0.000 0.000 0.067 0.000 0.000 0.000 0.000
##
## Node number 283: 39 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.46 P(node) =0.011
## class counts: 0 4 0 0 0 21 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.103 0.000 0.000 0.000 0.538 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=566 (17 obs) right son=567 (22 obs)
## Primary splits:
## rate (out of 5) < 3.4 to the left, improve=1.60, (0 missing)
## num of ratings < 21 to the right, improve=0.69, (0 missing)
## avg cost (two people) < 1200 to the left, improve=0.54, (0 missing)
## Surrogate splits:
## num of ratings < 6.5 to the left, agree=0.64, adj=0.176, (0 split)
## avg cost (two people) < 1300 to the left, agree=0.59, adj=0.059, (0 split)
##

tie
## Node number 346: 8 observations

at
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 1 5 0 0 0 0 0 0 0 0

Be
## probabilities: 0.000 0.000 0.000 0.000 0.125 0.625 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## n
## Node number 347: 19 observations
va
## predicted class=Quick Bites expected loss=0.42 P(node) =0.0052
## class counts: 0 0 0 0 0 5 0 0 2 0 0 0 0 1
Jo

## probabilities: 0.000 0.000 0.000 0.000 0.000 0.263 0.000 0.000 0.105 0.000 0.000 0.000 0.000 0.053
##
of

## Node number 362: 123 observations, complexity param=0.00079


## predicted class=Quick Bites expected loss=0.65 P(node) =0.033
ty

## class counts: 10 0 0 0 6 39 0 0 14 4 1 0 6 0
er

## probabilities: 0.081 0.000 0.000 0.000 0.049 0.317 0.000 0.000 0.114 0.033 0.008 0.000 0.049 0.000
## left son=724 (107 obs) right son=725 (16 obs)
op

## Primary splits:
Pr

## num of ratings < 22 to the left, improve=1.00, (0 missing)


## rate (out of 5) < 2.8 to the left, improve=0.94, (0 missing)
## avg cost (two people) < 480 to the left, improve=0.71, (0 missing)
##
## Node number 363: 52 observations
## predicted class=Quick Bites expected loss=0.54 P(node) =0.014
## class counts: 3 0 0 0 4 8 0 0 11 1 0 0 1 0
## probabilities: 0.058 0.000 0.000 0.000 0.077 0.154 0.000 0.000 0.212 0.019 0.000 0.000 0.019 0.000
##
## Node number 516: 46 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.26 P(node) =0.012
## class counts: 0 0 0 0 12 34 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.261 0.739 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=1032 (9 obs) right son=1033 (37 obs)
## Primary splits:
## avg cost (two people) < 820 to the right, improve=0.75, (0 missing)
## num of ratings < 500 to the right, improve=0.70, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=0.64, (0 missing)
##

44
## Node number 517: 9 observations
## predicted class=Casual Dining expected loss=0.56 P(node) =0.0024
## class counts: 0 0 0 0 3 4 0 0 0 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.444 0.000 0.000 0.000 0.111 0.000 0.000 0.000 0.000
##
## Node number 520: 21 observations
## predicted class=Cafe expected loss=0.33 P(node) =0.0057
## class counts: 0 0 0 0 14 7 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.667 0.333 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 521: 14 observations
## predicted class=Casual Dining expected loss=0.5 P(node) =0.0038
## class counts: 0 0 0 0 6 7 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.429 0.500 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 526: 7 observations
## predicted class=Casual Dining expected loss=0.14 P(node) =0.0019
## class counts: 0 0 0 0 0 6 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.857 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000

tie
##

at
## Node number 527: 30 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.63 P(node) =0.0081

Be
## class counts: 0 0 0 0 8 11 0 0 2 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.267 0.367 0.000 0.000 0.067 0.067 0.000 0.000 0.000 0.000
n
## left son=1054 (12 obs) right son=1055 (18 obs)
va
## Primary splits:
## num of ratings < 150 to the left, improve=0.93, (0 missing)
Jo

## rate (out of 5) < 4 to the right, improve=0.23, (0 missing)


##
of

## Node number 540: 16 observations


## predicted class=Cafe expected loss=0.56 P(node) =0.0043
ty

## class counts: 0 0 0 0 7 6 0 0 3 0 0 0 0 0
er

## probabilities: 0.000 0.000 0.000 0.000 0.438 0.375 0.000 0.000 0.188 0.000 0.000 0.000 0.000 0.000
##
op

## Node number 541: 11 observations


Pr

## predicted class=Casual Dining expected loss=0.55 P(node) =0.003


## class counts: 0 0 0 0 2 5 0 0 1 2 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.182 0.455 0.000 0.000 0.091 0.182 0.000 0.000 0.000 0.000
##
## Node number 542: 148 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.37 P(node) =0.04
## class counts: 7 0 0 0 17 93 0 0 14 0 0 0 3 0
## probabilities: 0.047 0.000 0.000 0.000 0.115 0.628 0.000 0.000 0.095 0.000 0.000 0.000 0.020 0.000
## left son=1084 (17 obs) right son=1085 (131 obs)
## Primary splits:
## num of ratings < 66 to the right, improve=1.20, (0 missing)
## rate (out of 5) < 2.8 to the left, improve=0.38, (0 missing)
## avg cost (two people) < 620 to the left, improve=0.31, (0 missing)
##
## Node number 543: 37 observations
## predicted class=Casual Dining expected loss=0.19 P(node) =0.01
## class counts: 0 0 0 0 2 30 0 0 1 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.054 0.811 0.000 0.000 0.027 0.000 0.000 0.000 0.000 0.000
##

45
## Node number 566: 17 observations
## predicted class=Casual Dining expected loss=0.35 P(node) =0.0046
## class counts: 0 2 0 0 0 11 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.118 0.000 0.000 0.000 0.647 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 567: 22 observations, complexity param=0.00062
## predicted class=Casual Dining expected loss=0.55 P(node) =0.006
## class counts: 0 2 0 0 0 10 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.091 0.000 0.000 0.000 0.455 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=1134 (14 obs) right son=1135 (8 obs)
## Primary splits:
## num of ratings < 28 to the right, improve=1.70, (0 missing)
## avg cost (two people) < 1200 to the left, improve=0.69, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=0.36, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.6 to the right, agree=0.77, adj=0.38, (0 split)
## avg cost (two people) < 1400 to the right, agree=0.68, adj=0.12, (0 split)
##
## Node number 724: 107 observations, complexity param=0.00079

tie
## predicted class=Quick Bites expected loss=0.64 P(node) =0.029

at
## class counts: 10 0 0 0 5 32 0 0 14 4 1 0 3 0
## probabilities: 0.093 0.000 0.000 0.000 0.047 0.299 0.000 0.000 0.131 0.037 0.009 0.000 0.028 0.000

Be
## left son=1448 (83 obs) right son=1449 (24 obs)
## Primary splits: n
## num of ratings < 5.5 to the right, improve=0.87, (0 missing)
va
## avg cost (two people) < 480 to the right, improve=0.70, (0 missing)
## rate (out of 5) < 3.4 to the right, improve=0.68, (0 missing)
Jo

##
## Node number 725: 16 observations
of

## predicted class=Casual Dining expected loss=0.56 P(node) =0.0043


## class counts: 0 0 0 0 1 7 0 0 0 0 0 0 3 0
ty

## probabilities: 0.000 0.000 0.000 0.000 0.062 0.438 0.000 0.000 0.000 0.000 0.000 0.000 0.188 0.000
er

##
## Node number 1032: 9 observations
op

## predicted class=Casual Dining expected loss=0.44 P(node) =0.0024


Pr

## class counts: 0 0 0 0 4 5 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.444 0.556 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 1033: 37 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.22 P(node) =0.01
## class counts: 0 0 0 0 8 29 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.216 0.784 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## left son=2066 (21 obs) right son=2067 (16 obs)
## Primary splits:
## num of ratings < 400 to the right, improve=1.30, (0 missing)
## rate (out of 5) < 4 to the right, improve=0.95, (0 missing)
## Surrogate splits:
## rate (out of 5) < 4.2 to the left, agree=0.59, adj=0.063, (0 split)
##
## Node number 1054: 12 observations
## predicted class=Cafe expected loss=0.58 P(node) =0.0033
## class counts: 0 0 0 0 5 4 0 0 1 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.417 0.333 0.000 0.000 0.083 0.083 0.000 0.000 0.000 0.000
##

46
## Node number 1055: 18 observations
## predicted class=Casual Dining expected loss=0.61 P(node) =0.0049
## class counts: 0 0 0 0 3 7 0 0 1 1 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.167 0.389 0.000 0.000 0.056 0.056 0.000 0.000 0.000 0.000
##
## Node number 1084: 17 observations
## predicted class=Casual Dining expected loss=0.18 P(node) =0.0046
## class counts: 0 0 0 0 0 14 0 0 2 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.824 0.000 0.000 0.118 0.000 0.000 0.000 0.000 0.000
##
## Node number 1085: 131 observations, complexity param=0.00033
## predicted class=Casual Dining expected loss=0.4 P(node) =0.036
## class counts: 7 0 0 0 17 79 0 0 12 0 0 0 3 0
## probabilities: 0.053 0.000 0.000 0.000 0.130 0.603 0.000 0.000 0.092 0.000 0.000 0.000 0.023 0.000
## left son=2170 (124 obs) right son=2171 (7 obs)
## Primary splits:
## num of ratings < 58 to the left, improve=3.20, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=0.61, (0 missing)
## avg cost (two people) < 620 to the left, improve=0.52, (0 missing)

tie
##

at
## Node number 1134: 14 observations
## predicted class=Casual Dining expected loss=0.43 P(node) =0.0038

Be
## class counts: 0 2 0 0 0 8 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.143 0.000 0.000 0.000 0.571 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
n
##
va
## Node number 1135: 8 observations
## predicted class=Lounge expected loss=0.25 P(node) =0.0022
Jo

## class counts: 0 0 0 0 0 2 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
of

##
## Node number 1448: 83 observations, complexity param=0.00079
ty

## predicted class=Quick Bites expected loss=0.65 P(node) =0.023


er

## class counts: 10 0 0 0 5 22 0 0 10 4 1 0 2 0
## probabilities: 0.120 0.000 0.000 0.000 0.060 0.265 0.000 0.000 0.120 0.048 0.012 0.000 0.024 0.000
op

## left son=2896 (19 obs) right son=2897 (64 obs)


Pr

## Primary splits:
## avg cost (two people) < 480 to the left, improve=0.89, (0 missing)
## num of ratings < 6.5 to the left, improve=0.69, (0 missing)
## rate (out of 5) < 3.4 to the right, improve=0.61, (0 missing)
##
## Node number 1449: 24 observations, complexity param=0.00079
## predicted class=Casual Dining expected loss=0.58 P(node) =0.0065
## class counts: 0 0 0 0 0 10 0 0 4 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.417 0.000 0.000 0.167 0.000 0.000 0.000 0.042 0.000
## left son=2898 (8 obs) right son=2899 (16 obs)
## Primary splits:
## rate (out of 5) < 3.2 to the right, improve=1.40, (0 missing)
## num of ratings < 4.5 to the right, improve=0.38, (0 missing)
## avg cost (two people) < 480 to the right, improve=0.25, (0 missing)
##
## Node number 2066: 21 observations, complexity param=0.00025
## predicted class=Casual Dining expected loss=0.33 P(node) =0.0057
## class counts: 0 0 0 0 7 14 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.333 0.667 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000

47
## left son=4132 (8 obs) right son=4133 (13 obs)
## Primary splits:
## rate (out of 5) < 4.2 to the right, improve=2.20, (0 missing)
## num of ratings < 740 to the left, improve=0.72, (0 missing)
##
## Node number 2067: 16 observations
## predicted class=Casual Dining expected loss=0.062 P(node) =0.0043
## class counts: 0 0 0 0 1 15 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.062 0.938 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 2170: 124 observations
## predicted class=Casual Dining expected loss=0.37 P(node) =0.034
## class counts: 7 0 0 0 13 78 0 0 12 0 0 0 2 0
## probabilities: 0.056 0.000 0.000 0.000 0.105 0.629 0.000 0.000 0.097 0.000 0.000 0.000 0.016 0.000
##
## Node number 2171: 7 observations
## predicted class=Cafe expected loss=0.43 P(node) =0.0019
## class counts: 0 0 0 0 4 1 0 0 0 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.571 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.143 0.000

tie
##

at
## Node number 2896: 19 observations
## predicted class=Casual Dining expected loss=0.58 P(node) =0.0052

Be
## class counts: 2 0 0 0 0 8 0 0 1 1 1 0 0 0
## probabilities: 0.105 0.000 0.000 0.000 0.000 0.421 0.000 0.000 0.053 0.053 0.053 0.000 0.000 0.000
n
##
va
## Node number 2897: 64 observations, complexity param=0.00033
## predicted class=Quick Bites expected loss=0.64 P(node) =0.017
Jo

## class counts: 8 0 0 0 5 14 0 0 9 3 0 0 2 0
## probabilities: 0.125 0.000 0.000 0.000 0.078 0.219 0.000 0.000 0.141 0.047 0.000 0.000 0.031 0.000
of

## left son=5794 (35 obs) right son=5795 (29 obs)


## Primary splits:
ty

## num of ratings < 8.5 to the right, improve=0.93, (0 missing)


er

## rate (out of 5) < 3.4 to the right, improve=0.76, (0 missing)


## Surrogate splits:
op

## rate (out of 5) < 3 to the left, agree=0.61, adj=0.14, (0 split)


Pr

##
## Node number 2898: 8 observations
## predicted class=Casual Dining expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 0 5 0 0 2 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.625 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000
##
## Node number 2899: 16 observations
## predicted class=Quick Bites expected loss=0.5 P(node) =0.0043
## class counts: 0 0 0 0 0 5 0 0 2 0 0 0 1 0
## probabilities: 0.000 0.000 0.000 0.000 0.000 0.312 0.000 0.000 0.125 0.000 0.000 0.000 0.062 0.000
##
## Node number 4132: 8 observations
## predicted class=Cafe expected loss=0.38 P(node) =0.0022
## class counts: 0 0 0 0 5 3 0 0 0 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.625 0.375 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 4133: 13 observations
## predicted class=Casual Dining expected loss=0.15 P(node) =0.0035
## class counts: 0 0 0 0 2 11 0 0 0 0 0 0 0 0

48
## probabilities: 0.000 0.000 0.000 0.000 0.154 0.846 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
##
## Node number 5794: 35 observations, complexity param=0.00033
## predicted class=Quick Bites expected loss=0.71 P(node) =0.0095
## class counts: 6 0 0 0 3 9 0 0 5 0 0 0 2 0
## probabilities: 0.171 0.000 0.000 0.000 0.086 0.257 0.000 0.000 0.143 0.000 0.000 0.000 0.057 0.000
## left son=11588 (19 obs) right son=11589 (16 obs)
## Primary splits:
## num of ratings < 13 to the right, improve=0.85, (0 missing)
## rate (out of 5) < 3 to the right, improve=0.78, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.4 to the right, agree=0.63, adj=0.19, (0 split)
##
## Node number 5795: 29 observations, complexity param=0.00033
## predicted class=Quick Bites expected loss=0.55 P(node) =0.0079
## class counts: 2 0 0 0 2 5 0 0 4 3 0 0 0 0
## probabilities: 0.069 0.000 0.000 0.000 0.069 0.172 0.000 0.000 0.138 0.103 0.000 0.000 0.000 0.000
## left son=11590 (7 obs) right son=11591 (22 obs)
## Primary splits:

tie
## rate (out of 5) < 3.4 to the right, improve=1.6, (0 missing)

at
## num of ratings < 6.5 to the left, improve=1.1, (0 missing)
##

Be
## Node number 11588: 19 observations
## predicted class=Quick Bites expected loss=0.74 P(node) =0.0052
n
## class counts: 3 0 0 0 3 3 0 0 4 0 0 0 1 0
va
## probabilities: 0.158 0.000 0.000 0.000 0.158 0.158 0.000 0.000 0.211 0.000 0.000 0.000 0.053 0.000
##
Jo

## Node number 11589: 16 observations


## predicted class=Casual Dining expected loss=0.62 P(node) =0.0043
of

## class counts: 3 0 0 0 0 6 0 0 1 0 0 0 1 0
## probabilities: 0.188 0.000 0.000 0.000 0.000 0.375 0.000 0.000 0.062 0.000 0.000 0.000 0.062 0.000
ty

##
er

## Node number 11590: 7 observations


## predicted class=Dessert Parlor expected loss=0.57 P(node) =0.0019
op

## class counts: 1 0 0 0 0 0 0 0 1 3 0 0 0 0
Pr

## probabilities: 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.143 0.429 0.000 0.000 0.000 0.000
##
## Node number 11591: 22 observations
## predicted class=Quick Bites expected loss=0.5 P(node) =0.006
## class counts: 1 0 0 0 2 5 0 0 3 0 0 0 0 0
## probabilities: 0.045 0.000 0.000 0.000 0.091 0.227 0.000 0.000 0.136 0.000 0.000 0.000 0.000 0.000

options(repr.plot.width = 10, repr.plot.height = 10)

# Plot prediction
fancyRpartPlot(train_tree1)

## Warning: labs do not fit even at cex 0.15, there may be some overplotting

49
1

Quick Bites
.02 .01 .02 .00 .07 .26
.00 .00 .06 .04 .00 .01
.02 .00 .01 .01 .01 .00
2 .01 .45 .01 .00 3

Casual Dining 100% Quick Bites


.02 .03 .00 .00 .11 .56 .03 .00 .03 .00 .03 .03
.00 .00 .05 .02 .00 .03
yes avg cost (two people) >= 425 no
.00 .00 .06 .05 .00 .00
.01 .00 .00 .02 .00 .00 .02 .00 .01 .00 .01 .00
4 .01 .12 .00 .00 5 6 .00 .71 .01 .00
Casual Dining Casual Dining44% Quick Bites 56%
.01 .04 .00 .00 .12 .65 .04 .00 .00 .00 .11 .36 .02 .00 .01 .00 .05 .12
avg cost (two people) >= 525
.00 .00 .03 .01 .00 .05 .00 .00 .11 .03 .00 .00 avg cost
.00 .00 .11 .03 .00 (two people) >= 375
.00
.01 .00 .00 .03 .00 .00 .03 .00 .00 .00 .00 .00 .04 .00 .00 .00 .00 .00
8 .02 .03 .00 .00
9 10 .00 .32 .00 .00 11 12 .00 .61 .00 .00 13

Casual Dining 31%


Fine Dining Casual Dining 13% Quick Bites Quick Bites 13% Quick Bites
.01 .03 .00 .00 .13 .69 .00 .08 .00 .00 .01 .13 .02 .00 .00 .00 .11 .50 .05 .00 .00 .00 .10 .28 .03 .00 .01 .00 .06 .09 .00 .00 .00 .00 .04 .16
.00 .00 .03 .01 .00 .00 avg cost (two people) < 1850
.02 .00 .00 .00 .00 .60 .00 .00 .11 .03 .00 .00 num of ratings >= 84 .00 .00 .11 .03 .00 .00 num of ratings < 48
.00 .00 .13 .03 .00 .00 .00 .00 .07 .03 .00 .00
.01 .00 .00 .02 .00 .00 .00 .00 .00 .14 .00 .00 .02 .01 .01 .00 .00 .00 .03 .00 .00 .00 .00 .00 .05 .00 .00 .00 .01 .00 .03 .00 .00 .00 .00 .00
16 .02 .04 .00 .00 17 .0118 .00 .00 .00 20 .00 .20 .00 .00 21 22 .00 .38 .00 .00 23 .00 .57 .01 .00 25 .00 .67 .00 .00
Casual Dining 29% Casual Dining Fine Dining2% Casual Dining 4% Quick Bites Quick Bites 8% Quick Bites 8% Quick Bites 5%
.01 .02 .00 .00 .15 .70 .00 .11 .00 .00 .02 .61 .00 .12 .00 .00 .02 .22 .03 .00 .00 .00 .13 .00 .56 .00 .00 .00 .06 .38 .05 .00 .00 .00 .08 .30 .03 .00 .00 .00 .27 .14 .03 .00 .00 .00 .05 .09
.00 .00 .04 .01 .00 .00 avg cost (two people) < 1150 .01 .00 .00 .01 .00 .00 .02avg
.00cost
.00 (two
.00 people) < 2550
.00 .41 .00 .00 avg
.11 cost (two.00
.03 .00 people)
.00 .00 .10>= .02
475 .00 .00 .00 .00 .12 .02 .00 .00 rate (out of 5) < 3.8 rate (out.00
.00 .00 .03 .11 .00 .00 of 5) >=.13
.00 3.8 .03 .00rate.00
(out of 5) >= 4.3
.01 .00 .00 .00 .00 .00 .00 .00 .00 .15 .00 .02 .00 .00 .00 .20 .00 .00 .02 .00 .01 .00 .00 .02 .00 .02 .00 .00 .00 .00 .03 .00 .00 .00 .00 .00 .03 .00 .03 .00 .00 .00 .05 .00 .00 .00 .01 .00
32 .01 .04 .00 .00 33 34 .07 .00 .00 .00 35 .02 .00 .00 .00 .0040 .11 .00 .00 .00 .40 .00 .00 43 44 .00 .38 .00 .00 45 .00 .38 .00 .00 .00
50 .59 .01 .00

Casual Dining 24% Casual Dining Casual Dining 5% Casual Dining 1% Cafe 3% 1% Quick Bites Casual Dining 7% Quick Bites 1% Quick Bites 7%
.00 .01 .00 .00 .31 .58 .01 .02 .00 .00 .10 .74 .00 .06 .00 .00 .03 .71 .00 .20 .00 .00 .00 .46 .09 .00 .00 .00 .30 .26 .00 .00 .00 .00 .07 .01 .35
.00 .00 .00 .14 .41 .07 .00 .00 .00 .06 .26 .03 .00 .00 .00 .03 .10
.00 .00 .01 .02 .00 .00 rate (out of 5) >= 4 .00 .00 .05 .01 .00 .00 rate.00
.01 .00 .00 .01 .00 (out of .015) >=.004 .00 .01 .00 .00 num of ratings < .00 44 .00rate
.17(out
.04 of.00 .00 4.1num of ratings
5) >= .00 .00>= 498
.09 .02 .00 .00 .06 .01 .00 .00 rate (out of 5) >= 3.6 .00 .00 .15 .03 .01 .00 num of ratings >= 63 .00 .00 rate .15 .03(out.00
of 5) >= 3
.00
.00 .00 .00 .00 .00 .00 .01 .00 .00 .00 .00 .00 .00 .00 .00 .07 .00 .03 .00 .00 .00 .25 .00 .00 .00 .00 .04 .00 .00 .00 .00 .02 .00 .00 .00 .01 .00 .00 .00 .00 .00 .04 .00 .00 .00 .00 .00 .05 .00 .00 .00 .00 .00
64 .01 .06 .00 .00 65 .01 .04 .00 .00 67 .08 .00 .00 .00 70 .06 .00 .00 .00 .00 .09 .00 .00 .00 .44 .00 .00 .00 .34 .00 .00
86 90 .00 .40 .00 .00 .00100 .57 .01 .00
Casual Dining 6% Casual Dining 18% Casual Dining 3% Casual Dining 2% 1% Casual Dining1% 2% Quick Bites 5% Quick Bites6%
.00 .02 .00 .00 .22 .72 .00 .00 .00 .00 .39 .46 .02 .03 .00 .00 .12 .69 .00 .17 .00 .00 .00 .51 .00 .00 .00 .00 .06 .43 .07 .00 .00 .00 .06 .27 .04 .00 .00 .00 .04 .13
.00 .00 .00 .01 .00 avg .00 cost (two people) >= 775 .00 .00 .02 .03 .00 .00 num of ratings
.00 .00 >= .06
106 .01 .00 .00 num of ratings.02
< 3758
.00 .00 .02num .00of.00ratings < 665 num of ratings < 233 .00 .00 .06rate .00(out 5) <num
.00of.00 4 of ratings >= 24 .00 .00 .16 .03 .01 .00 num of ratings < 60 .00 .00rate
.18 (out
.01 of
.005).00
< 3.4
.00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .01 .00 .00 .00 .00 .00 .00 .00 .00 .25 .00 .00 .00 .03 .00 .00 .00 .00 .04 .00 .00 .00 .00 .00 .10 .00 .01 .00 .00 .00
.02 .01 .00 .00 129 130.00 .10 .00 .00131 134 .00 .06 .00 .00 135 .03 .00 .00 .00 141 .00 .43 .00 173.00 .00 .37 .00 .00 181 .00 .47 .03 .00
3% Casual Dining Cafe 3% Casual Dining Casual Dining 12% Casual Dining 2%Casual Dining 1%
Quick Bites 5% Quick Bites 2%
.00 .00 .00 .00 .31 .65 .00 .00 .00 .00 .48 .00 .48
.00 .00 .00 .30 .43 .01 .05 .00 .00 .10 .73.03 .00 .00 .00 .13 .63 .00 .20 .00 .00 .00 .46 .00 .00 .00 .00 .04 .37 .07 .00 .00 .00 .06 .27
avg cost (two people) .00 .00>= 975.00 .02 .00 .00 .00 .00avg cost
.00 .00(two
.00 people)
.00 .04>= .06625.00 .00 avg.00
.00 .00 .04 cost.00(two
.00people)
.00 .00 >= .09675
.01 .00 .00 num of .00ratings
.00 .00>=.02 173.00 .00 rate
.00(out
.00 of 5) .00
.07 < 3 .00 .00 num of ratings >= 51 .00 .00 .14 .03 .01 .00 num of ratings >= 24
.00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .01 .00 .00 .00 .00 .00.01 .00 .01 .00 .00 .00 .00 .00 .00 .28 .00 .00 .00 .04 .00 .00 .00 .00 .04 .00 .00 .00 .00 .00
.02 .02 .00 .00
258 .00260 .04 .00 .00 .00 .17 .00 263 .00 .01 .03 .00 .00 270 .00 .08 .00 .00 271 .04 .00 .00 283 .00 .00 .48 .00 .00 362 .00 .38 .00 .00

Casual Dining2% Cafe 2% 1%


Casual Dining 7% Casual Dining 6% Casual Dining 1%
Casual Dining 1% Quick Bites 5%
.00 .00 .00 .00 .27 .69 .00 .00 .00 .00 .57 .40 .00 .00 .00 .00 .22 .46 .00 .00 .00 .00 .33 .41 .04 .00 .00 .00 .10 .66 .00 .10 .00 .00 .00 .54 .08 .00 .00 .00 .05 .32
.00 .00 .00 num.02 of ratings
.00 .00 <.00
1407.00rate
.00(out.00 of.00
5) >=
.00num
4.1 .00of ratings
.00 .05>=.05 502.00 .00 num of ratings .00 >=.0093 rate .00
.15 .07 (out.00
of 5).00
.00 >= 3.8
.08 .00 .00 .00 rate.00 (out.00
of 5)
.00>=.00
3.8 .00 .00 rate (out of 5) >= 3.9 .00 .00 .11num .03 of .01ratings
.00 < 35
.00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .02 .00 .01 .00 .00 .00 .00 .00 .00 .31 .00 .00 .05 .00 .00 .00 .00 .00
516 .00 .02 .00 .00 .00 .03 .00 .00 .00 .22 .00 527.00 .00 .04 .00 .00 .00 .09 .00 .00
542 .05 .00 .00 567.00 724 .00 .35 .00 .00
Casual Dining 1% 1% 1%
Casual Dining 1% Casual Dining5% 1%
Casual Dining Quick Bites 3%
.00 .00 .00 .00 .26 .74 .00 .00 .00 .00 .27 .37 .05 .00 .00 .00 .11 .63 .00 .09 .00 .00 .00 .45 .09 .00 .00 .00 .05 .30
num of
.00 .00 .00 .00 .00 .00 ratings >= 151 num of ratings >= 314 num of ratings >= 336
.00 .00 .07 .07 .00 .00 rate (out of 5) < avg
3.9 cost (two
.00 .00 .09 .00 .00 .00 people) >= 555 rate (out of 5) < 3.5
.00 .00 .00 .00 .00 .00 .00 .00 .13 .04 .01of.00
num ratings < 23
.00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .00 .02 .00 .01 .00 .00 .00 .00 .00 .00 .45 .00 .00 .03 .00 .00 .00 .00 .00
.00 .00 .00 .00 1033 .00 .23 .00 .00 .00 .09 .001085 .00 .00 .00 .00 .00 1448 .00 .36 .00 .00 1449
1%Casual Dining 1% 4%
Casual Dining 1% Quick Bites 3% Casual Dining
.00 .00 .00 .00 .22 .78 .05 .00 .00 .00 .13 .60 .12 .00 .00 .00 .06 .27 .00 .00 .00 .00 .00 .42
avg cost (two people)
.00 .00 >= 825
.00 .00 .00 .00 num of ratings < 151 num of .00
.00 ratings.09 >=
.0067.00 .00 num of ratings >= 28 .00 .00 .12 .05num .01 of.00 ratings.00>= 5.5.17 .00 .00 .00
.00
.00 .00 .00 .00 .00 .00 .02 .00 .00 .00 .00 .00 .02 .00 .00 .00 .00 .00 .04 .00 .00 .00 .00 .00
.002066 .00 .00 .00 .00 .10 .00 .00 .00 .35 .00 .002897 .00 .38 .00 .00
Casual Dining 1% 4% 2% Quick Bites 1%
.00 .00 .00 .00 .33 .67 .12 .00 .00 .00 .08 .22
.00 .00num.00of.00 ratings
.00 .00>= 402 num of ratings < 58 avg cost (two people)
.00 .00 .14 <.05 475 rate (out of 5) >= 3.3
.00 .00
.00 .00 .00 .00 .00 .00 .03 .00 .00 .00 .00 .00
.00 .00 .00 .00 .00
5794 .36 .00 .00
5795
1% Quick Bites2%Quick Bites
.17 .00 .00 .00.07 .09
.00 .26
.00 .00 .07 .17
rate (out of 5) >= 4.2 .00 .00 num of
.00ratings
.14 .00 .00
.00 .00>=.10
.14 8.5 .00 .00
.06 .00 .00 .00.00 .00
.00 .00
.00 .00 .00 .00
.00 .29 .00 .00 .00 .45 .00 .00
1% 1%

tie
num of ratings >=(out
rate 13 of 5) >= 3.4

128 1032 4132 4133 2067 517 259 520 521 261 262 526 1054 1055 66 268 269 540 541 1084 2170 2171 543 68 69 140 282 566 1134 1135 71 36 37 19 80 81 41 42 172 346 347 87 88 89 180 2896 11588 11589 11590 11591 2898 2899 725 363 91 46 47 24 200 201 101 51 26 27 7

CasualCasual
Dining Dining Cafe
CasualCasual DiningCasual
Dining Dining Cafe Cafe CasualCasual Dining Dining Cafe
Casual Dining Cafe
CasualCasual Dining Dining Cafe
Casual Dining Cafe
CasualCasual DiningCasual
Dining Dining Cafe
CasualCasual Dining Dining Lounge
Casual Dining Bar
CasualCasual Dining Dining Lounge Bar Casual Dining Fine DiningFine Dining Cafe
CasualCasual DiningCasual
DiningCasual
DiningCasual
Dining Dining
Quick BitesQuickCasual
Bites DiningQuick Bites Delivery
Casual Dining QuickCasual
Bites Dessert
Dining QuickParlorCasual
Bites DiningQuickCasual
Bites DiningQuick BitesQuick Bites Cafe Quick BitesQuick Bites Delivery Quick BitesQuick BitesQuick Bites Delivery Quick BitesQuick Bites
.00 .05.00.00.00.00
.00.00.10
.00.00
.00
.83
.00.44
.00.00
.00
.56
.00.62
.00.00
.00
.38
.00.15
.00.00
.00
.85
.00.06
.00.00
.00
.94
.00.33
.00.00
.00
.44
.00.57
.00.00
.00
.29
.00.67
.00.00
.00
.33
.00.43
.00.00
.00
.50
.00.33
.00.00
.00
.62
.00.50
.00.00
.00
.38
.00.00
.00.00
.00
.86
.00.42
.01.00
.00
.33
.00.17
.25.00
.01
.39
.00.06
.05.00
.00
.86
.00.38
.00.00
.00
.12
.00.09
.00.00
.00
.75
.00.44
.00.00
.06
.38
.00.18
.00.00
.00
.45
.00.00
.00.00
.00
.82
.00.10
.00.00
.00
.63
.00.57
.06.00
.00
.14
.00.05
.00.00
.00
.81
.00.03
.00.00
.00
.75
.00.00
.47.00
.00
.14
.00.00
.12.00
.00
.78
.00.00
.14.00
.00
.27
.00.00
.00.00
.00
.65
.00.00
.38.00
.00
.57
.00.00
.18.00
.00
.25
.00.00
.10.00
.00
.12
.00.09
.03.00
.25
.45
.00.00
.00.00
.00
.15
.00.00
.00.00
.01
.00
.00.50
.00.00
.00
.12
.00.20
.00.00
.00
.33
.00.09
.00.00
.00
.63
.00.00
.00.00
.00
.57
.00.12
.00.00
.00
.62
.00.12
.00.00
.02
.62
.00.00
.00.00
.00
.26
.00.12
.00.00
.00
.00
.00.11
.00.00
.11
.57
.00.22
.00.00
.16
.09
.00.14
.00.00
.19
.29
.00.00
.00.00
.14
.42
.00.16
.00.00
.05
.16
.00.00
.00.00
.00
.38
.00.00
.00.00
.00
.00
.00.09
.00.00
.00
.23
.00.00
.00.00
.06
.62
.00.00
.00.00
.00
.31
.00.06
.00.00
.00
.44
.00.08
.00.00
.04
.15
.00.00
.00.00
.07
.08
.00.50
.00.00
.09
.00
.07.19
.00.00
.03
.19
.00.14
.00.00
.02
.14
.00.00
.00.00
.02
.09
.00.04
.00.00
.00
.13
.02.03
.00.00
.00
.09
.00.09
.00.00
.03
.03
.00.25
.00.00.12
.04.03.00.16.02 .00
.00 .00.00.00.00.00
.00.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.11
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.06
.00
.00
.00.00
.00.00
.00
.00
.08.00
.00.08
.00
.00
.06.00
.00.06
.00
.00
.01.00
.00.00
.00
.00
.25.00
.00.00
.00
.00
.03.00
.00.00
.00
.00
.19.00
.00.00
.00
.00
.09.00
.00.18
.00
.00
.12.00
.00.00
.00
.00
.10.00
.00.00
.00
.00
.00.00
.00.00
.01
.00
.03.00
.00.00
.00
.00
.00.00
.00.01
.11
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.07
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.02
.00
.00.00
.00.00
.03
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.52
.00.00
.00.00
.00
.89
.27.00
.00.07
.00
.00
.10.00
.00.03
.00
.00
.14.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.11.00
.00.00
.00
.00
.25.00
.00.12
.00
.00
.04.00
.00.00
.00
.00
.09.00
.00.04
.00
.00
.57.00
.00.00
.00
.00
.05.00
.00.05
.00
.00
.21.05
.00.00
.00
.00
.06.00
.00.00
.00
.00
.14.00
.00.43
.00
.00
.14.00
.00.00
.00
.00
.25.00
.00.00
.00
.00
.12.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.21.00
.00.02
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.10
.00
.00
.04.00
.00.11
.00
.00
.14.00
.00.04
.00
.00
.64.00
.00.00
.00
.00
.10.00
.00.01
.00
.00
.13.00
.00.05
.00
.00
.09.00
.00.03
.00
.00
.38.00
.00.00
.00
.00
.06.00
.00.03.00
.05.00.06.00.00 .00
.00 .00.00.00.00.00
.00.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.02
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.01
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.02
.00
.06.00
.00.00
.14
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.03.00
.00.00
.00
.00
.00.00
.00.05
.00
.00
.00.00
.00.43
.00
.01
.00.00
.00.11
.00
.29
.00.00
.00.20
.00
.00
.00.00
.00.12
.00
.00
.00.00
.00.29
.00
.00
.00.00
.00.75
.00
.00
.00.00
.00.25
.00
.00
.00.00
.00.27
.00
.00
.00.00
.00.18
.00
.00
.00.00
.00.06
.00
.00
.00.00
.00.00
.02
.00
.07.00
.00.00
.14
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.05.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.04
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.05
.00
.00.00
.00.00
.06
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.06
.00
.00.00
.00.00
.19
.00
.00.00
.00.00
.02
.00
.00.00
.00.00
.08
.00
.00.00
.00.00
.10
.00
.00.00
.00.00
.00
.00
.00.00
.00.00
.00
.00
.04.00
.00.00
.00
.00
.00.00
.00.00
.12
.00
.00.00
.00.00
.02
.00
.01.00
.01.00
.05
.00
.00.00
.00.00
.00
.00
.00.01
.00.00
.03
.00
.00.02
.00.00
.01
.00
.00.00
.00.00.00
.01.00.00.00.01 .00

at
.02 .00.00.00.00.00 .00.00.00.00
.00.00.00.00
.00.00.00.00
.00.00.11.00
.14.00.00.00
.00.00.00.00
.00.00.07.00
.00.00.05.00
.00.00.06.00
.00.00.14.00
.00.00.08.00
.00.00.33.00
.02.00.01.00
.00.00.00.00
.01.00.03.00
.00.00.00.00
.00.00.09.00
.00.00.00.00
.00.00.10.00
.00.00.14.00
.00.00.08.00
.08.00.00.00
.14.00.00.00
.00.00.00.00
.00.00.00.00
.12.00.00.00
.00.00.00.00
.00.00.00.00
.25.00.00.00
.00.00.00.00
.02.00.00.00
.00.00.00.00
.00.00.12.00
.00.00.07.00
.00.00.12.00
.00.00.14.00
.00.00.25.00
.00.00.25.00
.00.00.58.00
.00.00.50.00
.00.00.26.00
.00.00.52.00
.00.00.00.00
.00.00.32.00
.00.00.26.00
.00.00.31.00
.00.00.29.00
.00.00.50.00
.00.00.12.00
.00.00.50.00
.00.00.31.00
.00.00.46.00
.00.00.83.00
.00.00.30.00
.00.00.41.00
.00.00.39.00
.00.00.18.00
.00.00.51.00
.00.03.63.00
.00.00.66.01
.00.00.25.00
.00.00.69.00
.00.00.75.00.01 .00
1% 0% 0% 0% 0% 0% 0% 1% 0% 1% 0% 0% 0% 0% 6% 0% 6% 0% 0% 0% 3% 0% 1% 3% 0% 0% 0% 0% 0% 0% 0% 0% 1% 1% 0% 0% 2% 0% 0% 0% 1% 0% 1% 1% 0% 1% 1% 0% 0% 1% 0% 0% 0% 1% 0% 0% 1% 1% 0% 2% 3% 2% 0% 5% 43%

Be
n
va
Rattle 2024−Apr−20 18:23:12 jbeat
Jo

# Confusion matrix
of

table(Type=predicted1, true=test$type)
ty

## true
er

## Type Bakery Bar Beverage Shop Cafe Casual Dining Club


op

## Bakery 0 0 0 0 0 0
## Bar 0 3 0 0 4 0
Pr

## Beverage Shop 0 0 0 0 0 0
## Bhojanalya 0 0 0 0 0 0
## Cafe 1 0 0 14 38 0
## Casual Dining 5 31 1 94 513 0
## Club 0 0 0 0 0 0
## Confectionery 0 0 0 0 0 0
## Delivery 1 0 0 0 4 0
## Dessert Parlor 2 0 0 1 4 0
## Dhaba 0 0 0 0 0 0
## Fine Dining 0 1 0 1 12 1
## Food Court 0 0 0 0 0 0
## Food Truck 0 0 0 0 0 0
## Kiosk 0 0 0 0 0 0
## Lounge 0 2 0 0 1 0
## Mess 0 0 0 0 0 0
## Microbrewery 0 0 0 0 0 0
## Pub 0 0 0 0 0 0
## Quick Bites 51 0 54 43 73 0
## Sweet Shop 0 0 0 0 0 0

50
## Takeaway 0 0 0 0 0 0
## true
## Type Confectionery Delivery Dessert Parlor Dhaba Fine Dining
## Bakery 0 0 0 0 0
## Bar 0 0 0 0 0
## Beverage Shop 0 0 0 0 0
## Bhojanalya 0 0 0 0 0
## Cafe 0 3 1 0 0
## Casual Dining 0 35 7 0 4
## Club 0 0 0 0 0
## Confectionery 0 0 0 0 0
## Delivery 0 4 6 1 0
## Dessert Parlor 0 1 0 0 0
## Dhaba 0 0 0 0 0
## Fine Dining 0 0 0 0 23
## Food Court 0 0 0 0 0
## Food Truck 0 0 0 0 0
## Kiosk 0 0 0 0 0
## Lounge 0 0 0 0 0

tie
## Mess 0 0 0 0 0

at
## Microbrewery 0 0 0 0 0
## Pub 0 0 0 0 0

Be
## Quick Bites 1 92 68 2 0
## Sweet Shop 0 0 n 0 0 0
## Takeaway 0 0 0 0 0
va
## true
## Type Food Court Food Truck Kiosk Lounge Mess Microbrewery Pub
Jo

## Bakery 0 0 0 0 0 0 0
## Bar 0 0 0 2 0 0 1
of

## Beverage Shop 0 0 0 0 0 0 0
## Bhojanalya 0 0 0 0 0 0 0
ty

## Cafe 0 0 0 0 0 0 0
er

## Casual Dining 8 0 0 13 0 2 10
## Club 0 0 0 0 0 0 0
op

## Confectionery 0 0 0 0 0 0 0
Pr

## Delivery 0 0 0 0 0 0 0
## Dessert Parlor 0 0 0 0 0 0 0
## Dhaba 0 0 0 0 0 0 0
## Fine Dining 0 0 0 5 0 0 0
## Food Court 0 0 0 0 0 0 0
## Food Truck 0 0 0 0 0 0 0
## Kiosk 0 0 0 0 0 0 0
## Lounge 0 0 0 0 0 1 1
## Mess 0 0 0 0 0 0 0
## Microbrewery 0 0 0 0 0 0 0
## Pub 0 0 0 0 0 0 0
## Quick Bites 10 12 16 0 20 0 0
## Sweet Shop 0 0 0 0 0 0 0
## Takeaway 0 0 0 0 0 0 0
## true
## Type Quick Bites Sweet Shop Takeaway
## Bakery 0 0 0
## Bar 0 0 0
## Beverage Shop 0 0 0

51
## Bhojanalya 0 0 0
## Cafe 5 0 0
## Casual Dining 77 0 2
## Club 0 0 0
## Confectionery 0 0 0
## Delivery 9 0 0
## Dessert Parlor 4 0 0
## Dhaba 0 0 0
## Fine Dining 0 0 0
## Food Court 0 0 0
## Food Truck 0 0 0
## Kiosk 0 0 0
## Lounge 0 0 0
## Mess 0 0 0
## Microbrewery 0 0 0
## Pub 0 0 0
## Quick Bites 1024 23 7
## Sweet Shop 0 0 0
## Takeaway 0 0 0

tie
at
Decision Tree 2

Be
n
train_tree2 <- rpart(type ~ ., data = train, method="class", control=rpart.control(cp=0, minsplit = 2, m
va
summary(train_tree2)
Jo

## Call:
of

## rpart(formula = type ~ ., data = train, method = "class", control = rpart.control(cp = 0,


## minsplit = 2, maxdepth = 3))
ty

## n= 3681
er

##
op

## CP nsplit rel error xerror xstd


## 1 0.358 0 1.00 1.00 0.015
Pr

## 2 0.012 1 0.64 0.64 0.014


## 3 0.000 4 0.61 0.61 0.014
##
## Variable importance
## avg cost (two people) num of ratings rate (out of 5)
## 71 18 11
##
## Node number 1: 3681 observations, complexity param=0.36
## predicted class=Quick Bites expected loss=0.55 P(node) =1
## class counts: 89 44 60 1 242 971 4 1 211 130 4 52 61 7
## probabilities: 0.024 0.012 0.016 0.000 0.066 0.264 0.001 0.000 0.057 0.035 0.001 0.014 0.017 0.002
## left son=2 (1611 obs) right son=3 (2070 obs)
## Primary splits:
## avg cost (two people) < 420 to the right, improve=590, (0 missing)
## num of ratings < 100 to the right, improve=120, (0 missing)
## rate (out of 5) < 3.8 to the right, improve= 61, (0 missing)
## Surrogate splits:
## num of ratings < 68 to the right, agree=0.68, adj=0.28, (0 split)
## rate (out of 5) < 3.8 to the right, agree=0.64, adj=0.18, (0 split)

52
##
## Node number 2: 1611 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.44 P(node) =0.44
## class counts: 27 44 0 0 185 908 4 1 85 25 1 52 23 1
## probabilities: 0.017 0.027 0.000 0.000 0.115 0.564 0.002 0.001 0.053 0.016 0.001 0.032 0.014 0.001
## left son=4 (1145 obs) right son=5 (466 obs)
## Primary splits:
## avg cost (two people) < 520 to the right, improve=59, (0 missing)
## num of ratings < 100 to the right, improve=13, (0 missing)
## rate (out of 5) < 4 to the right, improve=10, (0 missing)
## Surrogate splits:
## num of ratings < 7.5 to the right, agree=0.71, adj=0.013, (0 split)
##
## Node number 3: 2070 observations
## predicted class=Quick Bites expected loss=0.29 P(node) =0.56
## class counts: 62 0 60 1 57 63 0 0 126 105 3 0 38 6
## probabilities: 0.030 0.000 0.029 0.000 0.028 0.030 0.000 0.000 0.061 0.051 0.001 0.000 0.018 0.003
##
## Node number 4: 1145 observations, complexity param=0.012

tie
## predicted class=Casual Dining expected loss=0.35 P(node) =0.31

at
## class counts: 9 44 0 0 136 741 4 1 33 10 0 52 10 0
## probabilities: 0.008 0.038 0.000 0.000 0.119 0.647 0.003 0.001 0.029 0.009 0.000 0.045 0.009 0.000

Be
## left son=8 (1059 obs) right son=9 (86 obs)
## Primary splits: n
## avg cost (two people) < 1800 to the left, improve=57.0, (0 missing)
va
## rate (out of 5) < 4 to the left, improve=11.0, (0 missing)
## num of ratings < 2300 to the left, improve= 5.5, (0 missing)
Jo

##
## Node number 5: 466 observations, complexity param=0.012
of

## predicted class=Casual Dining expected loss=0.64 P(node) =0.13


## class counts: 18 0 0 0 49 167 0 0 52 15 1 0 13 1
ty

## probabilities: 0.039 0.000 0.000 0.000 0.105 0.358 0.000 0.000 0.112 0.032 0.002 0.000 0.028 0.002
er

## left son=10 (165 obs) right son=11 (301 obs)


## Primary splits:
op

## num of ratings < 84 to the right, improve=9.0, (0 missing)


Pr

## rate (out of 5) < 3.6 to the right, improve=4.0, (0 missing)


## avg cost (two people) < 480 to the right, improve=1.4, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.77, adj=0.34, (0 split)
##
## Node number 8: 1059 observations
## predicted class=Casual Dining expected loss=0.31 P(node) =0.29
## class counts: 9 37 0 0 135 730 2 1 33 10 0 0 10 0
## probabilities: 0.008 0.035 0.000 0.000 0.127 0.689 0.002 0.001 0.031 0.009 0.000 0.000 0.009 0.000
##
## Node number 9: 86 observations
## predicted class=Fine Dining expected loss=0.4 P(node) =0.023
## class counts: 0 7 0 0 1 11 2 0 0 0 0 52 0 0
## probabilities: 0.000 0.081 0.000 0.000 0.012 0.128 0.023 0.000 0.000 0.000 0.000 0.605 0.000 0.000
##
## Node number 10: 165 observations
## predicted class=Casual Dining expected loss=0.5 P(node) =0.045
## class counts: 3 0 0 0 18 83 0 0 18 5 0 0 3 1
## probabilities: 0.018 0.000 0.000 0.000 0.109 0.503 0.000 0.000 0.109 0.030 0.000 0.000 0.018 0.006

53
##
## Node number 11: 301 observations
## predicted class=Quick Bites expected loss=0.62 P(node) =0.082
## class counts: 15 0 0 0 31 84 0 0 34 10 1 0 10 0
## probabilities: 0.050 0.000 0.000 0.000 0.103 0.279 0.000 0.000 0.113 0.033 0.003 0.000 0.033 0.000

Prediction 2

predicted2= predict(train_tree2, test, type="class")


summary(train_tree2)

## Call:
## rpart(formula = type ~ ., data = train, method = "class", control = rpart.control(cp = 0,
## minsplit = 2, maxdepth = 3))
## n= 3681

tie
##
## CP nsplit rel error xerror xstd

at
## 1 0.358 0 1.00 1.00 0.015

Be
## 2 0.012 1 0.64 0.64 0.014
## 3 0.000 4 0.61 0.61 0.014
##
n
## Variable importance
va
## avg cost (two people) num of ratings rate (out of 5)
## 71 18 11
Jo

##
## Node number 1: 3681 observations, complexity param=0.36
of

## predicted class=Quick Bites expected loss=0.55 P(node) =1


## class counts: 89 44 60 1 242 971 4 1 211 130 4 52 61 7
ty

## probabilities: 0.024 0.012 0.016 0.000 0.066 0.264 0.001 0.000 0.057 0.035 0.001 0.014 0.017 0.002
er

## left son=2 (1611 obs) right son=3 (2070 obs)


op

## Primary splits:
## avg cost (two people) < 420 to the right, improve=590, (0 missing)
Pr

## num of ratings < 100 to the right, improve=120, (0 missing)


## rate (out of 5) < 3.8 to the right, improve= 61, (0 missing)
## Surrogate splits:
## num of ratings < 68 to the right, agree=0.68, adj=0.28, (0 split)
## rate (out of 5) < 3.8 to the right, agree=0.64, adj=0.18, (0 split)
##
## Node number 2: 1611 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.44 P(node) =0.44
## class counts: 27 44 0 0 185 908 4 1 85 25 1 52 23 1
## probabilities: 0.017 0.027 0.000 0.000 0.115 0.564 0.002 0.001 0.053 0.016 0.001 0.032 0.014 0.001
## left son=4 (1145 obs) right son=5 (466 obs)
## Primary splits:
## avg cost (two people) < 520 to the right, improve=59, (0 missing)
## num of ratings < 100 to the right, improve=13, (0 missing)
## rate (out of 5) < 4 to the right, improve=10, (0 missing)
## Surrogate splits:
## num of ratings < 7.5 to the right, agree=0.71, adj=0.013, (0 split)
##
## Node number 3: 2070 observations

54
## predicted class=Quick Bites expected loss=0.29 P(node) =0.56
## class counts: 62 0 60 1 57 63 0 0 126 105 3 0 38 6
## probabilities: 0.030 0.000 0.029 0.000 0.028 0.030 0.000 0.000 0.061 0.051 0.001 0.000 0.018 0.003
##
## Node number 4: 1145 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.35 P(node) =0.31
## class counts: 9 44 0 0 136 741 4 1 33 10 0 52 10 0
## probabilities: 0.008 0.038 0.000 0.000 0.119 0.647 0.003 0.001 0.029 0.009 0.000 0.045 0.009 0.000
## left son=8 (1059 obs) right son=9 (86 obs)
## Primary splits:
## avg cost (two people) < 1800 to the left, improve=57.0, (0 missing)
## rate (out of 5) < 4 to the left, improve=11.0, (0 missing)
## num of ratings < 2300 to the left, improve= 5.5, (0 missing)
##
## Node number 5: 466 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.64 P(node) =0.13
## class counts: 18 0 0 0 49 167 0 0 52 15 1 0 13 1
## probabilities: 0.039 0.000 0.000 0.000 0.105 0.358 0.000 0.000 0.112 0.032 0.002 0.000 0.028 0.002
## left son=10 (165 obs) right son=11 (301 obs)

tie
## Primary splits:

at
## num of ratings < 84 to the right, improve=9.0, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=4.0, (0 missing)

Be
## avg cost (two people) < 480 to the right, improve=1.4, (0 missing)
## Surrogate splits: n
## rate (out of 5) < 3.8 to the right, agree=0.77, adj=0.34, (0 split)
va
##
## Node number 8: 1059 observations
Jo

## predicted class=Casual Dining expected loss=0.31 P(node) =0.29


## class counts: 9 37 0 0 135 730 2 1 33 10 0 0 10 0
of

## probabilities: 0.008 0.035 0.000 0.000 0.127 0.689 0.002 0.001 0.031 0.009 0.000 0.000 0.009 0.000
##
ty

## Node number 9: 86 observations


er

## predicted class=Fine Dining expected loss=0.4 P(node) =0.023


## class counts: 0 7 0 0 1 11 2 0 0 0 0 52 0 0
op

## probabilities: 0.000 0.081 0.000 0.000 0.012 0.128 0.023 0.000 0.000 0.000 0.000 0.605 0.000 0.000
Pr

##
## Node number 10: 165 observations
## predicted class=Casual Dining expected loss=0.5 P(node) =0.045
## class counts: 3 0 0 0 18 83 0 0 18 5 0 0 3 1
## probabilities: 0.018 0.000 0.000 0.000 0.109 0.503 0.000 0.000 0.109 0.030 0.000 0.000 0.018 0.006
##
## Node number 11: 301 observations
## predicted class=Quick Bites expected loss=0.62 P(node) =0.082
## class counts: 15 0 0 0 31 84 0 0 34 10 1 0 10 0
## probabilities: 0.050 0.000 0.000 0.000 0.103 0.279 0.000 0.000 0.113 0.033 0.003 0.000 0.033 0.000

# Plot prediction
fancyRpartPlot(train_tree2, split.cex = 0.8, tweak=1.1)

55
1
Quick Bites
.02 .01 .02 .00 .07 .26
.00 .00 .06 .04 .00 .01
.02 .00 .01 .01 .01 .00
.01 .45 .01 .00
2 100%
Casual Dining
yes avg cost (two people) >= 425 no
.02 .03 .00 .00 .11 .56
.00 .00 .05 .02 .00 .03
.01 .00 .00 .02 .00 .00
.01 .12 .00 .00
4 44% 5
Casual Dining Casual Dining
avg cost (two people) >= 525
.01 .04 .00 .00 .12 .65 .04 .00 .00 .00 .11 .36
.00 .00 .03 .01 .00 .05 .00 .00 .11 .03 .00 .00
.01 .00 .00 .03 .00 .00 .03 .00 .00 .00 .00 .00
.02 .03 .00 .00 .00 .32 .00 .00
31% 13%
8 avg cost (two people) < 1850 9 10 num of ratings >= 84 11 3
Casual Dining Fine Dining Casual Dining Quick Bites Quick Bites
.01 .03 .00 .00 .13 .69 .00 .08 .00 .00 .01 .13 .02 .00 .00 .00 .11 .50 .05 .00 .00 .00 .10 .28 .03 .00 .03 .00 .03 .03

tie
.00 .00 .03 .01 .00 .00 .02 .00 .00 .00 .00 .60 .00 .00 .11 .03 .00 .00 .00 .00 .11 .03 .00 .00 .00 .00 .06 .05 .00 .00
.01 .00 .00 .02 .00 .00 .00 .00 .00 .14 .00 .00 .02 .01 .01 .00 .00 .00 .03 .00 .00 .00 .00 .00 .02 .00 .01 .00 .01 .00
.02 .04 .00 .00 .01 .00 .00 .00 .00 .20 .00 .00 .00 .38 .00 .00 .00 .71 .01 .00

at
29% 2% 4% 8% 56%

Be
n
va
Rattle 2024−Apr−20 18:23:14 jbeat
Jo

# Confusion matrix
of

table(Type=predicted2, true=test$type)
ty

## true
er

## Type Bakery Bar Beverage Shop Cafe Casual Dining Club


op

## Bakery 0 0 0 0 0 0
## Bar 0 0 0 0 0 0
Pr

## Beverage Shop 0 0 0 0 0 0
## Bhojanalya 0 0 0 0 0 0
## Cafe 0 0 0 0 0 0
## Casual Dining 4 34 1 101 531 0
## Club 0 0 0 0 0 0
## Confectionery 0 0 0 0 0 0
## Delivery 0 0 0 0 0 0
## Dessert Parlor 0 0 0 0 0 0
## Dhaba 0 0 0 0 0 0
## Fine Dining 0 3 0 1 13 1
## Food Court 0 0 0 0 0 0
## Food Truck 0 0 0 0 0 0
## Kiosk 0 0 0 0 0 0
## Lounge 0 0 0 0 0 0
## Mess 0 0 0 0 0 0
## Microbrewery 0 0 0 0 0 0
## Pub 0 0 0 0 0 0
## Quick Bites 56 0 54 51 105 0
## Sweet Shop 0 0 0 0 0 0

56
## Takeaway 0 0 0 0 0 0
## true
## Type Confectionery Delivery Dessert Parlor Dhaba Fine Dining
## Bakery 0 0 0 0 0
## Bar 0 0 0 0 0
## Beverage Shop 0 0 0 0 0
## Bhojanalya 0 0 0 0 0
## Cafe 0 0 0 0 0
## Casual Dining 0 34 6 0 2
## Club 0 0 0 0 0
## Confectionery 0 0 0 0 0
## Delivery 0 0 0 0 0
## Dessert Parlor 0 0 0 0 0
## Dhaba 0 0 0 0 0
## Fine Dining 0 0 0 0 25
## Food Court 0 0 0 0 0
## Food Truck 0 0 0 0 0
## Kiosk 0 0 0 0 0
## Lounge 0 0 0 0 0

tie
## Mess 0 0 0 0 0

at
## Microbrewery 0 0 0 0 0
## Pub 0 0 0 0 0

Be
## Quick Bites 1 101 76 3 0
## Sweet Shop 0 0 n 0 0 0
## Takeaway 0 0 0 0 0
va
## true
## Type Food Court Food Truck Kiosk Lounge Mess Microbrewery Pub
Jo

## Bakery 0 0 0 0 0 0 0
## Bar 0 0 0 0 0 0 0
of

## Beverage Shop 0 0 0 0 0 0 0
## Bhojanalya 0 0 0 0 0 0 0
ty

## Cafe 0 0 0 0 0 0 0
er

## Casual Dining 6 0 0 14 0 3 12
## Club 0 0 0 0 0 0 0
op

## Confectionery 0 0 0 0 0 0 0
Pr

## Delivery 0 0 0 0 0 0 0
## Dessert Parlor 0 0 0 0 0 0 0
## Dhaba 0 0 0 0 0 0 0
## Fine Dining 0 0 0 6 0 0 0
## Food Court 0 0 0 0 0 0 0
## Food Truck 0 0 0 0 0 0 0
## Kiosk 0 0 0 0 0 0 0
## Lounge 0 0 0 0 0 0 0
## Mess 0 0 0 0 0 0 0
## Microbrewery 0 0 0 0 0 0 0
## Pub 0 0 0 0 0 0 0
## Quick Bites 12 12 16 0 20 0 0
## Sweet Shop 0 0 0 0 0 0 0
## Takeaway 0 0 0 0 0 0 0
## true
## Type Quick Bites Sweet Shop Takeaway
## Bakery 0 0 0
## Bar 0 0 0
## Beverage Shop 0 0 0

57
## Bhojanalya 0 0 0
## Cafe 0 0 0
## Casual Dining 59 0 1
## Club 0 0 0
## Confectionery 0 0 0
## Delivery 0 0 0
## Dessert Parlor 0 0 0
## Dhaba 0 0 0
## Fine Dining 0 0 0
## Food Court 0 0 0
## Food Truck 0 0 0
## Kiosk 0 0 0
## Lounge 0 0 0
## Mess 0 0 0
## Microbrewery 0 0 0
## Pub 0 0 0
## Quick Bites 1060 23 8
## Sweet Shop 0 0 0
## Takeaway 0 0 0

tie
at
Decision Tree 3

Be
n
train_tree3 <- rpart(type ~ ., data = train, method="class", control=rpart.control(cp=0, minsplit = 2, m
va
summary(train_tree3)
Jo

## Call:
of

## rpart(formula = type ~ ., data = train, method = "class", control = rpart.control(cp = 0,


## minsplit = 2, maxdepth = 4))
ty

## n= 3681
er

##
op

## CP nsplit rel error xerror xstd


## 1 0.35764 0 1.00 1.00 0.015
Pr

## 2 0.01190 1 0.64 0.64 0.014


## 3 0.00050 4 0.61 0.61 0.014
## 4 0.00037 5 0.61 0.62 0.014
## 5 0.00000 9 0.60 0.62 0.014
##
## Variable importance
## avg cost (two people) num of ratings rate (out of 5)
## 71 18 11
##
## Node number 1: 3681 observations, complexity param=0.36
## predicted class=Quick Bites expected loss=0.55 P(node) =1
## class counts: 89 44 60 1 242 971 4 1 211 130 4 52 61 7
## probabilities: 0.024 0.012 0.016 0.000 0.066 0.264 0.001 0.000 0.057 0.035 0.001 0.014 0.017 0.002
## left son=2 (1611 obs) right son=3 (2070 obs)
## Primary splits:
## avg cost (two people) < 420 to the right, improve=590, (0 missing)
## num of ratings < 100 to the right, improve=120, (0 missing)
## rate (out of 5) < 3.8 to the right, improve= 61, (0 missing)
## Surrogate splits:

58
## num of ratings < 68 to the right, agree=0.68, adj=0.28, (0 split)
## rate (out of 5) < 3.8 to the right, agree=0.64, adj=0.18, (0 split)
##
## Node number 2: 1611 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.44 P(node) =0.44
## class counts: 27 44 0 0 185 908 4 1 85 25 1 52 23 1
## probabilities: 0.017 0.027 0.000 0.000 0.115 0.564 0.002 0.001 0.053 0.016 0.001 0.032 0.014 0.001
## left son=4 (1145 obs) right son=5 (466 obs)
## Primary splits:
## avg cost (two people) < 520 to the right, improve=59, (0 missing)
## num of ratings < 100 to the right, improve=13, (0 missing)
## rate (out of 5) < 4 to the right, improve=10, (0 missing)
## Surrogate splits:
## num of ratings < 7.5 to the right, agree=0.71, adj=0.013, (0 split)
##
## Node number 3: 2070 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.29 P(node) =0.56
## class counts: 62 0 60 1 57 63 0 0 126 105 3 0 38 6
## probabilities: 0.030 0.000 0.029 0.000 0.028 0.030 0.000 0.000 0.061 0.051 0.001 0.000 0.018 0.003

tie
## left son=6 (479 obs) right son=7 (1591 obs)

at
## Primary splits:
## avg cost (two people) < 380 to the right, improve=14.0, (0 missing)

Be
## num of ratings < 76 to the left, improve= 3.8, (0 missing)
## rate (out of 5) < 3.6 to the right, improve= 1.8, (0 missing)
n
## Surrogate splits:
va
## rate (out of 5) < 2.7 to the left, agree=0.77, adj=0.004, (0 split)
##
Jo

## Node number 4: 1145 observations, complexity param=0.012


## predicted class=Casual Dining expected loss=0.35 P(node) =0.31
of

## class counts: 9 44 0 0 136 741 4 1 33 10 0 52 10 0


## probabilities: 0.008 0.038 0.000 0.000 0.119 0.647 0.003 0.001 0.029 0.009 0.000 0.045 0.009 0.000
ty

## left son=8 (1059 obs) right son=9 (86 obs)


er

## Primary splits:
## avg cost (two people) < 1800 to the left, improve=57.0, (0 missing)
op

## rate (out of 5) < 4 to the left, improve=11.0, (0 missing)


Pr

## num of ratings < 2300 to the left, improve= 5.5, (0 missing)


##
## Node number 5: 466 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.64 P(node) =0.13
## class counts: 18 0 0 0 49 167 0 0 52 15 1 0 13 1
## probabilities: 0.039 0.000 0.000 0.000 0.105 0.358 0.000 0.000 0.112 0.032 0.002 0.000 0.028 0.002
## left son=10 (165 obs) right son=11 (301 obs)
## Primary splits:
## num of ratings < 84 to the right, improve=9.0, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=4.0, (0 missing)
## avg cost (two people) < 480 to the right, improve=1.4, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.77, adj=0.34, (0 split)
##
## Node number 6: 479 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.39 P(node) =0.13
## class counts: 9 0 3 0 24 56 0 0 53 16 0 0 19 1
## probabilities: 0.019 0.000 0.006 0.000 0.050 0.117 0.000 0.000 0.111 0.033 0.000 0.000 0.040 0.002
## left son=12 (297 obs) right son=13 (182 obs)

59
## Primary splits:
## num of ratings < 48 to the left, improve=2.3, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=2.0, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.6 to the left, agree=0.75, adj=0.35, (0 split)
##
## Node number 7: 1591 observations
## predicted class=Quick Bites expected loss=0.25 P(node) =0.43
## class counts: 53 0 57 1 33 7 0 0 73 89 3 0 19 5
## probabilities: 0.033 0.000 0.036 0.001 0.021 0.004 0.000 0.000 0.046 0.056 0.002 0.000 0.012 0.003
##
## Node number 8: 1059 observations
## predicted class=Casual Dining expected loss=0.31 P(node) =0.29
## class counts: 9 37 0 0 135 730 2 1 33 10 0 0 10 0
## probabilities: 0.008 0.035 0.000 0.000 0.127 0.689 0.002 0.001 0.031 0.009 0.000 0.000 0.009 0.000
##
## Node number 9: 86 observations
## predicted class=Fine Dining expected loss=0.4 P(node) =0.023
## class counts: 0 7 0 0 1 11 2 0 0 0 0 52 0 0

tie
## probabilities: 0.000 0.081 0.000 0.000 0.012 0.128 0.023 0.000 0.000 0.000 0.000 0.605 0.000 0.000

at
##
## Node number 10: 165 observations, complexity param=5e-04

Be
## predicted class=Casual Dining expected loss=0.5 P(node) =0.045
## class counts: 3 0 0 0 18 n 83 0 0 18 5 0 0 3 1
## probabilities: 0.018 0.000 0.000 0.000 0.109 0.503 0.000 0.000 0.109 0.030 0.000 0.000 0.018 0.006
va
## left son=20 (115 obs) right son=21 (50 obs)
## Primary splits:
Jo

## avg cost (two people) < 480 to the right, improve=4.2, (0 missing)
## rate (out of 5) < 4 to the right, improve=3.2, (0 missing)
of

## num of ratings < 120 to the left, improve=1.1, (0 missing)


## Surrogate splits:
ty

## num of ratings < 1000 to the left, agree=0.7, adj=0.02, (0 split)


er

##
## Node number 11: 301 observations
op

## predicted class=Quick Bites expected loss=0.62 P(node) =0.082


Pr

## class counts: 15 0 0 0 31 84 0 0 34 10 1 0 10 0
## probabilities: 0.050 0.000 0.000 0.000 0.103 0.279 0.000 0.000 0.113 0.033 0.003 0.000 0.033 0.000
##
## Node number 12: 297 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.43 P(node) =0.081
## class counts: 9 0 3 0 17 27 0 0 40 10 0 0 14 1
## probabilities: 0.030 0.000 0.010 0.000 0.057 0.091 0.000 0.000 0.135 0.034 0.000 0.000 0.047 0.003
## left son=24 (6 obs) right son=25 (291 obs)
## Primary splits:
## num of ratings < 44 to the right, improve=2.0, (0 missing)
## rate (out of 5) < 3.8 to the right, improve=1.5, (0 missing)
##
## Node number 13: 182 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.33 P(node) =0.049
## class counts: 0 0 0 0 7 29 0 0 13 6 0 0 5 0
## probabilities: 0.000 0.000 0.000 0.000 0.038 0.159 0.000 0.000 0.071 0.033 0.000 0.000 0.027 0.000
## left son=26 (8 obs) right son=27 (174 obs)
## Primary splits:
## rate (out of 5) < 4.2 to the right, improve=2.60, (0 missing)

60
## num of ratings < 50 to the right, improve=0.88, (0 missing)
## Surrogate splits:
## num of ratings < 1100 to the right, agree=0.97, adj=0.25, (0 split)
##
## Node number 20: 115 observations
## predicted class=Casual Dining expected loss=0.44 P(node) =0.031
## class counts: 3 0 0 0 15 64 0 0 13 4 0 0 2 0
## probabilities: 0.026 0.000 0.000 0.000 0.130 0.557 0.000 0.000 0.113 0.035 0.000 0.000 0.017 0.000
##
## Node number 21: 50 observations
## predicted class=Quick Bites expected loss=0.6 P(node) =0.014
## class counts: 0 0 0 0 3 19 0 0 5 1 0 0 1 1
## probabilities: 0.000 0.000 0.000 0.000 0.060 0.380 0.000 0.000 0.100 0.020 0.000 0.000 0.020 0.020
##
## Node number 24: 6 observations
## predicted class=Delivery expected loss=0.5 P(node) =0.0016
## class counts: 0 0 0 0 1 1 0 0 3 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.167 0.167 0.000 0.000 0.500 0.000 0.000 0.000 0.000 0.000
##

tie
## Node number 25: 291 observations

at
## predicted class=Quick Bites expected loss=0.42 P(node) =0.079
## class counts: 9 0 3 0 16 26 0 0 37 10 0 0 14 1

Be
## probabilities: 0.031 0.000 0.010 0.000 0.055 0.089 0.000 0.000 0.127 0.034 0.000 0.000 0.048 0.003
## n
## Node number 26: 8 observations
va
## predicted class=Delivery expected loss=0.62 P(node) =0.0022
## class counts: 0 0 0 0 2 1 0 0 3 0 0 0 0 0
Jo

## probabilities: 0.000 0.000 0.000 0.000 0.250 0.125 0.000 0.000 0.375 0.000 0.000 0.000 0.000 0.000
##
of

## Node number 27: 174 observations


## predicted class=Quick Bites expected loss=0.31 P(node) =0.047
ty

## class counts: 0 0 0 0 5 28 0 0 10 6 0 0 5 0
er

## probabilities: 0.000 0.000 0.000 0.000 0.029 0.161 0.000 0.000 0.057 0.034 0.000 0.000 0.029 0.000
op
Pr

Prediction 3

predicted3= predict(train_tree3, test, type="class")


summary(train_tree3)

## Call:
## rpart(formula = type ~ ., data = train, method = "class", control = rpart.control(cp = 0,
## minsplit = 2, maxdepth = 4))
## n= 3681
##
## CP nsplit rel error xerror xstd
## 1 0.35764 0 1.00 1.00 0.015
## 2 0.01190 1 0.64 0.64 0.014
## 3 0.00050 4 0.61 0.61 0.014
## 4 0.00037 5 0.61 0.62 0.014
## 5 0.00000 9 0.60 0.62 0.014
##

61
## Variable importance
## avg cost (two people) num of ratings rate (out of 5)
## 71 18 11
##
## Node number 1: 3681 observations, complexity param=0.36
## predicted class=Quick Bites expected loss=0.55 P(node) =1
## class counts: 89 44 60 1 242 971 4 1 211 130 4 52 61 7
## probabilities: 0.024 0.012 0.016 0.000 0.066 0.264 0.001 0.000 0.057 0.035 0.001 0.014 0.017 0.002
## left son=2 (1611 obs) right son=3 (2070 obs)
## Primary splits:
## avg cost (two people) < 420 to the right, improve=590, (0 missing)
## num of ratings < 100 to the right, improve=120, (0 missing)
## rate (out of 5) < 3.8 to the right, improve= 61, (0 missing)
## Surrogate splits:
## num of ratings < 68 to the right, agree=0.68, adj=0.28, (0 split)
## rate (out of 5) < 3.8 to the right, agree=0.64, adj=0.18, (0 split)
##
## Node number 2: 1611 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.44 P(node) =0.44

tie
## class counts: 27 44 0 0 185 908 4 1 85 25 1 52 23 1

at
## probabilities: 0.017 0.027 0.000 0.000 0.115 0.564 0.002 0.001 0.053 0.016 0.001 0.032 0.014 0.001
## left son=4 (1145 obs) right son=5 (466 obs)

Be
## Primary splits:
## avg cost (two people) < 520 to the right, improve=59, (0 missing)
n
## num of ratings < 100 to the right, improve=13, (0 missing)
va
## rate (out of 5) < 4 to the right, improve=10, (0 missing)
## Surrogate splits:
Jo

## num of ratings < 7.5 to the right, agree=0.71, adj=0.013, (0 split)


##
of

## Node number 3: 2070 observations, complexity param=0.00037


## predicted class=Quick Bites expected loss=0.29 P(node) =0.56
ty

## class counts: 62 0 60 1 57 63 0 0 126 105 3 0 38 6


er

## probabilities: 0.030 0.000 0.029 0.000 0.028 0.030 0.000 0.000 0.061 0.051 0.001 0.000 0.018 0.003
## left son=6 (479 obs) right son=7 (1591 obs)
op

## Primary splits:
Pr

## avg cost (two people) < 380 to the right, improve=14.0, (0 missing)
## num of ratings < 76 to the left, improve= 3.8, (0 missing)
## rate (out of 5) < 3.6 to the right, improve= 1.8, (0 missing)
## Surrogate splits:
## rate (out of 5) < 2.7 to the left, agree=0.77, adj=0.004, (0 split)
##
## Node number 4: 1145 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.35 P(node) =0.31
## class counts: 9 44 0 0 136 741 4 1 33 10 0 52 10 0
## probabilities: 0.008 0.038 0.000 0.000 0.119 0.647 0.003 0.001 0.029 0.009 0.000 0.045 0.009 0.000
## left son=8 (1059 obs) right son=9 (86 obs)
## Primary splits:
## avg cost (two people) < 1800 to the left, improve=57.0, (0 missing)
## rate (out of 5) < 4 to the left, improve=11.0, (0 missing)
## num of ratings < 2300 to the left, improve= 5.5, (0 missing)
##
## Node number 5: 466 observations, complexity param=0.012
## predicted class=Casual Dining expected loss=0.64 P(node) =0.13
## class counts: 18 0 0 0 49 167 0 0 52 15 1 0 13 1

62
## probabilities: 0.039 0.000 0.000 0.000 0.105 0.358 0.000 0.000 0.112 0.032 0.002 0.000 0.028 0.002
## left son=10 (165 obs) right son=11 (301 obs)
## Primary splits:
## num of ratings < 84 to the right, improve=9.0, (0 missing)
## rate (out of 5) < 3.6 to the right, improve=4.0, (0 missing)
## avg cost (two people) < 480 to the right, improve=1.4, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.8 to the right, agree=0.77, adj=0.34, (0 split)
##
## Node number 6: 479 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.39 P(node) =0.13
## class counts: 9 0 3 0 24 56 0 0 53 16 0 0 19 1
## probabilities: 0.019 0.000 0.006 0.000 0.050 0.117 0.000 0.000 0.111 0.033 0.000 0.000 0.040 0.002
## left son=12 (297 obs) right son=13 (182 obs)
## Primary splits:
## num of ratings < 48 to the left, improve=2.3, (0 missing)
## rate (out of 5) < 4.2 to the right, improve=2.0, (0 missing)
## Surrogate splits:
## rate (out of 5) < 3.6 to the left, agree=0.75, adj=0.35, (0 split)

tie
##

at
## Node number 7: 1591 observations
## predicted class=Quick Bites expected loss=0.25 P(node) =0.43

Be
## class counts: 53 0 57 1 33 7 0 0 73 89 3 0 19 5
## probabilities: 0.033 0.000 0.036 0.001 0.021 0.004 0.000 0.000 0.046 0.056 0.002 0.000 0.012 0.003
n
##
va
## Node number 8: 1059 observations
## predicted class=Casual Dining expected loss=0.31 P(node) =0.29
Jo

## class counts: 9 37 0 0 135 730 2 1 33 10 0 0 10 0


## probabilities: 0.008 0.035 0.000 0.000 0.127 0.689 0.002 0.001 0.031 0.009 0.000 0.000 0.009 0.000
of

##
## Node number 9: 86 observations
ty

## predicted class=Fine Dining expected loss=0.4 P(node) =0.023


er

## class counts: 0 7 0 0 1 11 2 0 0 0 0 52 0 0
## probabilities: 0.000 0.081 0.000 0.000 0.012 0.128 0.023 0.000 0.000 0.000 0.000 0.605 0.000 0.000
op

##
Pr

## Node number 10: 165 observations, complexity param=5e-04


## predicted class=Casual Dining expected loss=0.5 P(node) =0.045
## class counts: 3 0 0 0 18 83 0 0 18 5 0 0 3 1
## probabilities: 0.018 0.000 0.000 0.000 0.109 0.503 0.000 0.000 0.109 0.030 0.000 0.000 0.018 0.006
## left son=20 (115 obs) right son=21 (50 obs)
## Primary splits:
## avg cost (two people) < 480 to the right, improve=4.2, (0 missing)
## rate (out of 5) < 4 to the right, improve=3.2, (0 missing)
## num of ratings < 120 to the left, improve=1.1, (0 missing)
## Surrogate splits:
## num of ratings < 1000 to the left, agree=0.7, adj=0.02, (0 split)
##
## Node number 11: 301 observations
## predicted class=Quick Bites expected loss=0.62 P(node) =0.082
## class counts: 15 0 0 0 31 84 0 0 34 10 1 0 10 0
## probabilities: 0.050 0.000 0.000 0.000 0.103 0.279 0.000 0.000 0.113 0.033 0.003 0.000 0.033 0.000
##
## Node number 12: 297 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.43 P(node) =0.081

63
## class counts: 9 0 3 0 17 27 0 0 40 10 0 0 14 1
## probabilities: 0.030 0.000 0.010 0.000 0.057 0.091 0.000 0.000 0.135 0.034 0.000 0.000 0.047 0.003
## left son=24 (6 obs) right son=25 (291 obs)
## Primary splits:
## num of ratings < 44 to the right, improve=2.0, (0 missing)
## rate (out of 5) < 3.8 to the right, improve=1.5, (0 missing)
##
## Node number 13: 182 observations, complexity param=0.00037
## predicted class=Quick Bites expected loss=0.33 P(node) =0.049
## class counts: 0 0 0 0 7 29 0 0 13 6 0 0 5 0
## probabilities: 0.000 0.000 0.000 0.000 0.038 0.159 0.000 0.000 0.071 0.033 0.000 0.000 0.027 0.000
## left son=26 (8 obs) right son=27 (174 obs)
## Primary splits:
## rate (out of 5) < 4.2 to the right, improve=2.60, (0 missing)
## num of ratings < 50 to the right, improve=0.88, (0 missing)
## Surrogate splits:
## num of ratings < 1100 to the right, agree=0.97, adj=0.25, (0 split)
##
## Node number 20: 115 observations

tie
## predicted class=Casual Dining expected loss=0.44 P(node) =0.031

at
## class counts: 3 0 0 0 15 64 0 0 13 4 0 0 2 0
## probabilities: 0.026 0.000 0.000 0.000 0.130 0.557 0.000 0.000 0.113 0.035 0.000 0.000 0.017 0.000

Be
##
## Node number 21: 50 observations n
## predicted class=Quick Bites expected loss=0.6 P(node) =0.014
va
## class counts: 0 0 0 0 3 19 0 0 5 1 0 0 1 1
## probabilities: 0.000 0.000 0.000 0.000 0.060 0.380 0.000 0.000 0.100 0.020 0.000 0.000 0.020 0.020
Jo

##
## Node number 24: 6 observations
of

## predicted class=Delivery expected loss=0.5 P(node) =0.0016


## class counts: 0 0 0 0 1 1 0 0 3 0 0 0 0 0
ty

## probabilities: 0.000 0.000 0.000 0.000 0.167 0.167 0.000 0.000 0.500 0.000 0.000 0.000 0.000 0.000
er

##
## Node number 25: 291 observations
op

## predicted class=Quick Bites expected loss=0.42 P(node) =0.079


Pr

## class counts: 9 0 3 0 16 26 0 0 37 10 0 0 14 1
## probabilities: 0.031 0.000 0.010 0.000 0.055 0.089 0.000 0.000 0.127 0.034 0.000 0.000 0.048 0.003
##
## Node number 26: 8 observations
## predicted class=Delivery expected loss=0.62 P(node) =0.0022
## class counts: 0 0 0 0 2 1 0 0 3 0 0 0 0 0
## probabilities: 0.000 0.000 0.000 0.000 0.250 0.125 0.000 0.000 0.375 0.000 0.000 0.000 0.000 0.000
##
## Node number 27: 174 observations
## predicted class=Quick Bites expected loss=0.31 P(node) =0.047
## class counts: 0 0 0 0 5 28 0 0 10 6 0 0 5 0
## probabilities: 0.000 0.000 0.000 0.000 0.029 0.161 0.000 0.000 0.057 0.034 0.000 0.000 0.029 0.000

# Plot prediction
fancyRpartPlot(train_tree3, split.cex = 0.8, tweak=1.1)

64
1
Quick Bites
.02 .01 .02 .00 .07 .26
.00 .00 .06 .04 .00 .01
.02 .00 .01 .01 .01 .00
.01 .45 .01 .00
100%
2
yes avg cost (two people) >= 425 no
3
Casual Dining Quick Bites
.02 .03 .00 .00 .11 .56 .03 .00 .03 .00 .03 .03
.00 .00 .05 .02 .00 .03 .00 .00 .06 .05 .00 .00
.01 .00 .00 .02 .00 .00 .02 .00 .01 .00 .01 .00
.01 .12 .00 .00 .00 .71 .01 .00
44% 56%
4 avg cost (two people) >= 525 5 6 avg cost (two people) >= 375

Casual Dining Casual Dining Quick Bites


.01 .04 .00 .00 .12 .65 .04 .00 .00 .00 .11 .36 .02 .00 .01 .00 .05 .12
.00 .00 .03 .01 .00 .05 .00 .00 .11 .03 .00 .00 .00 .00 .11 .03 .00 .00
.01 .00 .00 .03 .00 .00 .03 .00 .00 .00 .00 .00 .04 .00 .00 .00 .00 .00
.02 .03 .00 .00 .00 .32 .00 .00 .00 .61 .00 .00
31% 13% 13%
avg cost (two people) < 1850 10 num of ratings >= 84 12 num of ratings < 48 13
Casual Dining Quick Bites Quick Bites
.02 .00 .00 .00 .11 .50 .03 .00 .01 .00 .06 .09 .00 .00 .00 .00 .04 .16
.00 .00 .11 .03 .00 .00 .00 .00 .13 .03 .00 .00 .00 .00 .07 .03 .00 .00
.02 .01 .01 .00 .00 .00 .05 .00 .00 .00 .01 .00 .03 .00 .00 .00 .00 .00
.00 .20 .00 .00 .00 .57 .01 .00 .00 .67 .00 .00
4% 8% 5%
avg cost (two people) >= 475 num of ratings >= 45 rate (out of 5) >= 4.3

8 9 20 21 11 24 25 26 27 7

tie
Casual Dining Fine Dining Casual Dining Quick Bites Quick Bites Delivery Quick Bites Delivery Quick Bites Quick Bites
.01 .03 .00 .00 .13 .69
.00 .08 .00 .00 .01 .13
.03 .00 .00 .00 .13 .56
.00 .00 .00 .00 .06 .38
.05 .00 .00 .00 .10 .28
.00 .00 .00 .00 .17 .17
.03 .00 .01 .00 .05 .09
.00 .00 .00 .00 .25 .12
.00 .00 .00 .00 .03 .16
.03 .00 .04 .00 .02 .00
.00 .00 .03 .01 .00 .00
.02 .00 .00 .00 .00 .60
.00 .00 .11 .03 .00 .00
.00 .00 .10 .02 .00 .00
.00 .00 .11 .03 .00 .00
.00 .00 .50 .00 .00 .00
.00 .00 .13 .03 .00 .00
.00 .00 .38 .00 .00 .00
.00 .00 .06 .03 .00 .00
.00 .00 .05 .06 .00 .00
.01 .00 .00 .02 .00 .00
.00 .00 .00 .14 .00 .00
.02 .00 .01 .00 .00 .00
.02 .02 .00 .00 .00 .00
.03 .00 .00 .00 .00 .00
.00 .00 .00 .00 .00 .00
.05 .00 .00 .00 .01 .00
.00 .00 .00 .00 .00 .00
.03 .00 .00 .00 .00 .00
.01 .00 .01 .00 .01 .00
.02 .04 .00 .00 .01 .00 .00 .00 .00 .11 .00 .00 .00 .40 .00 .00 .00 .38 .00 .00 .00 .17 .00 .00 .00 .58 .01 .00 .00 .25 .00 .00 .00 .69 .00 .00 .00 .75 .01 .00

at
29% 2% 3% 1% 8% 0% 8% 0% 5% 43%

Be
n
va
Rattle 2024−Apr−20 18:23:14 jbeat
Jo
of

Data Prep for Naive Bayes


ty
er

# Remove unnecessary columns


op

zomato_NB <- subset(zomato,select=c(4,5,6,7))


Pr

# Rename
zomato_NB <- rename(zomato_NB, type = 'restaurant type')
zomato_NB <- rename(zomato_NB, rating = 'rate (out of 5)')
zomato_NB <- rename(zomato_NB, num = 'num of ratings')
zomato_NB <- rename(zomato_NB, cost = 'avg cost (two people)')

# Cull
zomato_NB <- zomato_NB[!grepl(",", zomato_NB$type),]

# Label factor
zomato_NB$type <-as.factor(zomato_NB$type)

# Convert to vector
zomato_NB$rating <- as.integer(zomato_NB$rating)
zomato_NB$num <- as.integer(zomato_NB$num)
zomato_NB$cost <- as.integer(zomato_NB$cost)

65
Naive Bayes Model

set.seed(123) # For reproducibility


total_rows <- nrow(zomato_NB)
train_indices <- sample(1:total_rows, size = 0.8 * total_rows)

nb_model <- naiveBayes(type ~ rating + num + cost,


data = zomato_NB[train_indices, ])

predictions <- predict(nb_model, newdata = zomato_NB[-train_indices, ])

table(predictions, zomato_NB$type[-train_indices])

##
## predictions Bakery Bar Beverage Shop Bhojanalya Cafe Casual Dining Club
## Bakery 0 0 0 0 0 0 0
## Bar 0 1 0 0 0 3 0

tie
## Beverage Shop 0 0 0 0 0 0 0

at
## Bhojanalya 0 0 0 0 0 0 0
## Cafe 0 0 0 0 1 2 0

Be
## Casual Dining 0 5 0 0 30 132 0
## Club 0 0 0 n0 0 0 0
## Confectionery 19 6 15 0 21 106 0
va
## Delivery 0 0 0 0 1 15 0
## Dessert Parlor 0 0 0 0 0 0 0
Jo

## Dhaba 0 0 0 0 0 0 0
## Fine Dining 0 1 0 0 0 9 0
of

## Food Court 0 0 0 0 0 0 0
## Food Truck 0 0 0 0 0 0 0
ty

## Kiosk 0 0 0 0 0 0 0
er

## Lounge 0 1 0 0 2 3 0
## Mess 0 0 0 0 0 0 0
op

## Microbrewery 0 1 0 0 0 11 0
Pr

## Pub 0 0 0 0 0 0 0
## Quick Bites 21 0 13 0 21 47 0
## Sweet Shop 0 0 0 0 0 0 0
## Takeaway 0 0 0 0 0 1 0
##
## predictions Confectionery Delivery Dessert Parlor Dhaba Fine Dining
## Bakery 0 0 0 0 0
## Bar 0 0 0 0 1
## Beverage Shop 0 0 0 0 1
## Bhojanalya 0 0 0 0 0
## Cafe 0 0 0 0 0
## Casual Dining 0 7 3 0 0
## Club 0 0 0 0 0
## Confectionery 0 33 16 0 1
## Delivery 0 3 0 0 0
## Dessert Parlor 0 0 0 0 0
## Dhaba 0 0 0 0 0
## Fine Dining 0 0 0 0 5
## Food Court 0 0 0 0 0

66
## Food Truck 0 0 0 0 0
## Kiosk 0 0 0 0 0
## Lounge 0 0 0 0 1
## Mess 0 0 0 0 0
## Microbrewery 0 0 0 0 0
## Pub 0 0 0 0 0
## Quick Bites 0 22 31 0 1
## Sweet Shop 0 0 0 0 1
## Takeaway 0 0 1 0 0
##
## predictions Food Court Food Truck Kiosk Lounge Mess Microbrewery Pub
## Bakery 0 0 0 0 0 0 0
## Bar 0 0 0 1 0 0 0
## Beverage Shop 0 0 0 0 0 0 0
## Bhojanalya 0 0 0 0 0 0 0
## Cafe 0 0 0 0 0 0 0
## Casual Dining 0 0 0 2 0 1 5
## Club 0 0 0 0 0 0 0
## Confectionery 6 2 0 4 3 0 0

tie
## Delivery 0 0 0 0 0 0 0

at
## Dessert Parlor 0 0 0 0 0 0 0
## Dhaba 0 0 0 0 0 0 0

Be
## Fine Dining 0 0 0 3 0 0 0
## Food Court 0 0 0 n 0 0 0 0
## Food Truck 0 0 0 0 0 0 0
va
## Kiosk 0 0 0 0 0 0 0
## Lounge 0 0 0 2 0 1 2
Jo

## Mess 0 0 0 0 0 0 0
## Microbrewery 0 0 0 0 0 2 2
of

## Pub 0 0 0 0 0 0 0
## Quick Bites 7 1 2 0 6 0 0
ty

## Sweet Shop 0 0 0 0 0 0 0
er

## Takeaway 0 0 0 0 0 0 0
##
op

## predictions Quick Bites Sweet Shop Takeaway


Pr

## Bakery 0 0 0
## Bar 0 0 0
## Beverage Shop 0 0 0
## Bhojanalya 0 0 0
## Cafe 0 0 0
## Casual Dining 8 0 0
## Club 0 0 0
## Confectionery 195 2 3
## Delivery 1 0 0
## Dessert Parlor 0 0 0
## Dhaba 0 0 0
## Fine Dining 0 0 0
## Food Court 0 0 0
## Food Truck 0 0 0
## Kiosk 0 0 0
## Lounge 0 0 0
## Mess 0 0 0
## Microbrewery 0 0 0
## Pub 0 0 0

67
## Quick Bites 345 4 3
## Sweet Shop 0 0 0
## Takeaway 0 0 0

# Plot Naive Bayes


plot(predictions,
las = 2,
main = "Restuarant Type Predictions",
ylab = "Frequency")

Restuarant Type Predictions

500

tie
400

at
Frequency

Be
300
n
va
200
Jo

100
of
ty

0
er
Bakery
Bar
Beverage Shop
Bhojanalya
Cafe
Casual Dining
Club
Confectionery
Delivery
Dessert Parlor
Dhaba
Fine Dining
Food Court
Food Truck
Kiosk
Lounge
Mess
Microbrewery
Pub
Quick Bites
Sweet Shop
Takeaway
op
Pr

# Data Prep for Text Mining

# Generate Corpus
corpus <- Corpus(VectorSource(zomato$`restaurant name`))
corpus <- tm_map(corpus, content_transformer(tolower))

## Warning in tm_map.SimpleCorpus(corpus, content_transformer(tolower)):


## transformation drops documents

corpus <- tm_map(corpus, removePunctuation)

## Warning in tm_map.SimpleCorpus(corpus, removePunctuation): transformation drops


## documents

68
corpus <- tm_map(corpus, removeWords, stopwords("english"))

## Warning in tm_map.SimpleCorpus(corpus, removeWords, stopwords("english")):


## transformation drops documents

# Create Document Term Matrix


dtm <- DocumentTermMatrix(corpus)

m <- as.matrix(dtm)
v <- sort(rowSums(m),decreasing=TRUE)
d <- data.frame(word = names(v),freq=v)
head(d, 10)

## word freq
## 3393 3393 7
## 3851 3851 7

tie
## 4377 4377 7
## 5340 5340 7

at
## 5382 5382 7

Be
## 5913 5913 7
## 6794 6794 7
## 74 74 6
n
## 224 224 6
va
## 250 250 6
Jo

# Wordcloud Generation
word_freq <- colSums(as.matrix(dtm))
of

words <- colnames(as.matrix(dtm))


ty
er

wordcloud_data <- data.frame(word = words, freq = word_freq)


op

wordcloud2(wordcloud_data, size = 1.7, minSize = 0.5, shape = "circle", backgroundColor = "white")


Pr

69

You might also like