Food Inspection in Chicago_Robin Ye

Rongbin_Ye

1/21/2020

Why Inspection Prediction? Public, Private, Commercial Good

As a gourmet, one of the largest concerns is the food security. From a macro perspective, both different facility owners and inspectors would love to know the result of their inspection so they can prepare appropriate resources for additional work or improvement.

  1. Demand:
  1. Function:

Data in Use

The data has been scrapped directly from the records of Chicago City Hall website. The original training data contains 199943 records in total. After the data manipulation, I restricted the conditions to four major elements: 1. Facility Type: School, Bakery, Restaurant, and school. 2. Risk TYpe: Risk 1(High), Risk 2(Medium), Risk 3(Low) 3. Location(Longtitude & Latitude) The summary is as follow:

  summary(main_data)
##  Results                  Risk         Latitude       Longitude     
##  fail:1178   risk 1 (high)  :4713   Min.   :41.65   Min.   :-87.91  
##  pass:4412   risk 2 (medium): 838   1st Qu.:41.85   1st Qu.:-87.71  
##              risk 3 (low)   :  39   Median :41.89   Median :-87.67  
##                                     Mean   :41.89   Mean   :-87.68  
##                                     3rd Qu.:41.94   3rd Qu.:-87.63  
##                                     Max.   :42.02   Max.   :-87.53  
##         Ftype     
##  bakery    :  96  
##  catering  :  40  
##  restaurant:4691  
##  school    : 763  
##                   
## 
“Chicago”

“Chicago”

Empower Prediction by Logistic Regression

The basic model used here is the logstic model, regarding the existing independent variables, categorical and numeric. The model summary is as follow:

## 
## Call:
## glm(formula = Results ~ Ftype + Risk + Latitude + Longitude, 
##     family = binomial, data = main_data)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8951   0.6164   0.6942   0.7014   0.8613  
## 
## Coefficients:
##                      Estimate Std. Error z value Pr(>|z|)   
## (Intercept)         -20.85360   46.09521  -0.452  0.65098   
## Ftypecatering         0.36929    0.46524   0.794  0.42734   
## Ftyperestaurant       0.27524    0.24528   1.122  0.26180   
## Ftypeschool           0.24201    0.26022   0.930  0.35236   
## Riskrisk 2 (medium)   0.26347    0.09881   2.667  0.00766 **
## Riskrisk 3 (low)     -0.20933    0.37100  -0.564  0.57260   
## Latitude             -0.24903    0.47078  -0.529  0.59682   
## Longitude            -0.36843    0.57176  -0.644  0.51933   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 5756.9  on 5589  degrees of freedom
## Residual deviance: 5747.6  on 5582  degrees of freedom
## AIC: 5763.6
## 
## Number of Fisher Scoring iterations: 4

The model performs effectively but requires time to run on the server at this stage.

Why this App?

Before showing the real app, hereby I provide a summary of the UI elements. The sidepanel includes 4 major inputs groups.

This app provides a convinent, powerful, reiliable predictor for any one interested in the subject.

Thank You & Lets try it.

Thank You and lets try it out.

“Chicago Food”

“Chicago Food”