new york city restaurant inspection analysis

49
Should You Eat There? An Analysis of NYC Restaurant Inspection Data Business Intelligence & Data Analytics

Upload: jingshu-sun

Post on 15-Apr-2017

69 views

Category:

Data & Analytics


1 download

TRANSCRIPT

Page 1: New York City Restaurant Inspection Analysis

Should You Eat There?An Analysis of NYC Restaurant Inspection Data

Busi

ness

In

telli

genc

e &

Dat

a An

alyt

ics

Page 2: New York City Restaurant Inspection Analysis

Samantha Grant Jingshu Sun

Akash Dhruv

Candice Brown

Leeyat Slyper

Meet Our TeamGroup 2

Page 3: New York City Restaurant Inspection Analysis

AgendaThe Data

Data Exploration

Unsupervised Learning

Supervised Learning

Recommendations

1

2

3

4

5

Page 4: New York City Restaurant Inspection Analysis

Business Objectives

IDENTIFYING

VIOLATIONTRENDS

1

PREDICTING VIOLATIONS

2

REDUCING VIOLATION

S

3

Help NYC restaurant, and restaurant-goers by...

Page 5: New York City Restaurant Inspection Analysis

So there won’t be any more of this...

Page 6: New York City Restaurant Inspection Analysis

Part 01

The Data

Page 7: New York City Restaurant Inspection Analysis

Data Attributes

● Inspection Date● Inspection Type● Violation Code● Critical Flag● Grade (A,B,C)● Scores

● ID● Restaurant Name● Cuisine Description● New York Boro● Zip Code

RESTAURANT DETAILS VIOLATION DETAILS

477,000 rows

Page 8: New York City Restaurant Inspection Analysis

Data Cleaning

1

2

3

4

Removed rows with inspection dates in the future.

REMOVED BAD DATA

Reduced number of rows

SHRANK DATA SET

FIXED SPELLING & INCONSISTENCIES

REPLACEMENT

& FLAG CREATION

Fixed spelling errors.Replaced ‘Not Yet Graded’ with ‘N’.Broke ‘Inspection Type’ into 2 columns.

Violation CategoriesInspection CategoriesSeasonal FlagsLandmark Flags

Page 9: New York City Restaurant Inspection Analysis

● Allergies/Safety

● Animals

● Certification

● Documentation

Replacement 110 Violation Codes → 13 Violation Categories

● Facility Amenities

● Tobacco

● Facility Cleanliness

● Hazardous Chemicals

● Food Temperature

● Food Contamination

● Tobacco

● Worker Cleanliness

● Other

Page 10: New York City Restaurant Inspection Analysis

Part 02

Data Exploration

Page 11: New York City Restaurant Inspection Analysis

TOP 3 Violation

Categories

#1Facility

Amenities

#2Animals

#3Facility

Cleanliness

? Violation Trends:What are the most common violation types?

Page 12: New York City Restaurant Inspection Analysis

?Violation Density:Which borough has the most violations?

Staten Island

Queens

Brooklyn

Bronx

Manhattan

Page 13: New York City Restaurant Inspection Analysis

1,438,159 population13,221 persons/sq. km9.48%

2,321,580 population8,237 persons/sq. km24.07%

39%ViolationsManhattan

3%Violations

Staten Island

24%Violatio

nsBrooklyn

9%Violatio

nsBronx

24%Violatio

nsQueens

Restaurant Density vs. Percent Violations

Page 14: New York City Restaurant Inspection Analysis

These articles confirm our findings...

Page 15: New York City Restaurant Inspection Analysis

Insight:

There are not major differences in average restaurant scores despite differing borough wealth and popularity.

Do inspection scores differ across borough??

Page 16: New York City Restaurant Inspection Analysis

Recommendation:

Re-opening average scores are lowest scores. A separate process could be in place for re-openings to ensure good scores.

Inspection Type:How Do Scores Differ for Inspection Types?

Page 17: New York City Restaurant Inspection Analysis

Restaurant Grade Distribution:

Takeaways:● Hamburgers,

Cafes and American food have the highest % of A grades.

● Indian food has the largest share of C grades

Grade A

Grade B

Grade C

Source: What’s the safest food in New York City? - Data Diversions - tumblr.com [NYC Open Data]

Page 18: New York City Restaurant Inspection Analysis

Part 3

Unsupervised Learning

Page 19: New York City Restaurant Inspection Analysis

Association RulesAnimals

Facility Amenities

Worker Cleanliness

Facility Cleanliness

Food Temperature

Food Contamination

1.06 Lift

1.01 Lift

Page 20: New York City Restaurant Inspection Analysis

Violations per SeasonWinter

~2kSpring

>2KSummer

<1.5kFall

~1.5k

Seasonal Trends:Which season has the most

violations? Spring has the most violations & American, Chinese and Italian Food had the most violations.

?

Winter Spring Summer Fall

Page 21: New York City Restaurant Inspection Analysis

Clustering Results:

Page 22: New York City Restaurant Inspection Analysis

Clustering Results:Segment Size

Page 23: New York City Restaurant Inspection Analysis

Clustering Results:

Page 24: New York City Restaurant Inspection Analysis

Takeaway: Seasonal Dummy Variable was the most influential

across the board Variable Worth

Page 25: New York City Restaurant Inspection Analysis

Cluster Findings:What are the prevalence of violations by

season?

Takeaways:

Cluster 1: SpringCluster 2: Summer Cluster 3: Winter. highest Manhattan incidenceCluster 4: Spring

All Clusters: American & Chinese food violations, Manhattan & Brooklyn, Score impactful on all clusters, especially 1 & 4

Other Findings:Staten Island is not impactful on any cluster

Page 26: New York City Restaurant Inspection Analysis

Cluster Findings:What are the prevalence of violations by

grade?

Takeaways:

Cluster 1: C Grade, Food Temp, Flies/Food Refuse Violation, MiceCluster 2: A Grade Cluster 3: A Grade, highest Manhattan incidenceCluster 4: B Grade

All Clusters: Manhattan impactful on all clusters

Page 27: New York City Restaurant Inspection Analysis

Part 4

Supervised Learning

Page 28: New York City Restaurant Inspection Analysis

Should you eat at Chipotle?

?

Page 29: New York City Restaurant Inspection Analysis

Focus Point: Chipotle

Answer:

Yes...in STATEN ISLAND - No violations were detected in any Chipotle outlets there

Top Borough for violations at Chipotle outlets:MANHATTAN

Page 30: New York City Restaurant Inspection Analysis

Focus Point: ChipotleTakeaways:

Most common violations category:

1. Animals: 04N

2. Food Temperature: 02B, 02G

3. Worker Cleanliness: 06A, 06B

Page 31: New York City Restaurant Inspection Analysis

Do landmark NY restaurants perform

better??

Page 32: New York City Restaurant Inspection Analysis

Focus Point: Landmark Restaurants

Landmark Restaurants:

- Famous- Oldest- Movie

Scenes- Favorites

Page 33: New York City Restaurant Inspection Analysis

Focus Point: Landmark Restaurants

Hypothesis Confirmed:

Not Critical violations are more common for Landmark restaurants than others.

Page 34: New York City Restaurant Inspection Analysis

Focus Point: Landmark Restaurants

Hypothesis Confirmed:

Landmark restaurants have higher percentage of A’s.

Page 35: New York City Restaurant Inspection Analysis

Focus Point: Landmark Restaurants

Finding:Second most common violation for landmark restaurants due to not cleaning surfaces after each use

Recommendation:Hire employee who cleans while chefs cook

Page 36: New York City Restaurant Inspection Analysis

Focus Point: Landmark Restaurants

Hypothesis Not Supported:

Violations, or lack thereof are not indicators of Landmark restaurants.

Page 37: New York City Restaurant Inspection Analysis

What factors lead to a judgement of

critical violation??

Page 38: New York City Restaurant Inspection Analysis

Part One: Decision Tree Model VIOLATION PREDICTION --- Interpreting the Inspection Result

What kind of restaurants are more likely to be judged critical violation?

Key: Create a CRITICAL_DUMMY according to CRITICAL_FLAG; Assign Role “Target” and Level “Binary”

Not Critical CriticalCritical_Dummy = 0

VSCritical_Dummy = 1

Page 39: New York City Restaurant Inspection Analysis

Unsupervised Learning

SCORE

CRITICAL_FLAGCheatin

gSplittin

g

?

Variable Selection

Page 40: New York City Restaurant Inspection Analysis

Unsupervised Learning

Two-Way

&Three -

Way

?

Running Model:Data Partition--70% Training Data & 30% Validation Data

Page 41: New York City Restaurant Inspection Analysis
Page 42: New York City Restaurant Inspection Analysis

Findings (Two-Way):

Grade1.0000

Inspection_Type0.4314

BORO0.1675

Restaurants who get a

score under B are 68.17%

likely to be judged critical

violation, compared to

48% likely to be critical

violation with Grade A.

Restaurants with an initial

low grade are more likely

to be judged a critical

violation during re-

inspection, with a

possibility to nearly 70%.

“BORO” does not appear

to affect much on Critical

Violation. The probability for

critical judging is around

52% for re-inspection with

initial high grades in all

regions.

Page 43: New York City Restaurant Inspection Analysis

Part Two: Logistic RegressionOutcome: Critical_Dummy

Variable Selection: Stepwise

Page 44: New York City Restaurant Inspection Analysis
Page 45: New York City Restaurant Inspection Analysis

Findings (Similar to Decision Tree):

Score GRADE BInspection Type

GRADE C

0.0983 0.0948 0.06100.1596

Page 46: New York City Restaurant Inspection Analysis

Part 4

Recommendations

Page 47: New York City Restaurant Inspection Analysis

● Dine after Spring, since restaurants have been issued the most violations

by that time.

● Be wary of Indian and Chinese restaurants in New York City.

● Don’t pay Manhattan prices; it does not have cleaner restaurants.

● If you want to eat at Chipotle, go to Staten Island.

FOR THE HUNGRY CONSUMER

Page 48: New York City Restaurant Inspection Analysis

● Hire a dedicated cleaner in high-volume landmark restaurants.

● Since Facility Amenities violations are the most common, construction

is a critical stage -- do extensive research before contracting.

● Focus on cleanliness for the Spring season.

● Be sure to do well for re-inspection, you’ll either pass with flying colors

or be severely penalized.

● Set a benchmark to be met before allowing re-opening.

FOR RESTAURANTS

Page 49: New York City Restaurant Inspection Analysis

Questions?Thanks for listening!