PyData London 2016
Can we use Bayesian inference to determine unusual car emissions test for Volkswagen? In this worked example, I’ll demonstrate hierarchical linear regression using both PyMC3 and PySTAN, and compare the flexibility and modelling strengths of each framework.
Overview
Bayesian inference bridges the gap between white-box model introspection and black-box predictive performance. We gain the ability to fully specify a model and fit it to observed data according to our prior knowledge. Small datasets are handled well and the overall method and results are very intuitive: lending to both statistical insight and future prediction.
This talk will demonstrate the use of Bayesian inference in a real-world scenario: using a set of hierarchical models to compare exhaust emissions data from a set of vehicle manufacturers.
This will be interesting to people who work in the Type A side of data science, and will demonstrate usage of the tools as well as some theory.
The Frameworks
PyMC3 and PySTAN are two of the leading frameworks for Bayesian inference in Python: offering concise model specification, MCMC sampling, and a growing amount of built-in conveniences for model validation, verification and prediction.
PyMC3 is an iteration upon the prior PyMC2, and comprises a comprehensive package of symbolic statistical modelling syntax and very efficient gradient-based samplers using the Theano library of deep-learning fame for gradient computation. Of particular interest is that it includes the Non U-Turn Sampler NUTS developed recently by Hoffman & Gelman in 2014, which is only otherwise available in STAN.
PySTAN is a wrapper around STAN, a major3 open-source framework for Bayesian inference developed by Gelman, Carpenter, Hoffman and many others. STAN also has HMC and NUTS samplers, and recently, Variational Inference – which is a very efficient way to approximate the joint probability distribution. Models are specified in a custom syntax and compiled to C++.
The Real-World Problem & Dataset
I’m currently quite interested in road traffic and vehicle insurance, so I’ve dug into the UK VCA Vehicle Type Approval to find their Car Fuel and Emissions Information for August 2015. The raw dataset is available for direct download and is small but varied enough for our use here: roughly 2500 cars and 10 features inc hierarchies of car parent-manufacturer – manufacturer – model.
I will investigate the car emissions data from the point-of-view of the Volkswagen Emissions Scandal which seems to have meaningfully damaged their sales. Perhaps we can find unusual results in the emissions data for Volkswagen.
GitHub repo: https://github.com/jonsedar/pymc3_vs_pystan
Heavy duty aluminum bar clamping system that enables owners of vehicles, heavy equipment and boats to mount lights or other equipment to square or round tubes, bars or rails. The adjustable clamping system cinches to size around rails of different diameters and can handle payloads to 40 pounds under extreme vibration.
The bar clamp mount is made from aluminum and is available in 3 finishes, including black anodize, clear anodize and white. The bar clamp mount adjusts to fit bars, rails, racks, etc. with square or tubular dimensions ranging from 7/8 inch to 1.75 inches in diameter. There are 2 sets of interlocking brackets which are cinched around the square or round tube, using the imbedded 1/4-20 stainless steel, socket head bolts.
A mounting plate attaches to the clamps, creating a mounting surface for just about anything. Existing mounting holes include the mounting pattern for the Golight Stryker spotlights, Golight Radioray spotlights, all High Intensity Discharge (HID) equipment lights, HID boat lights and LED spotlight bars and LED spreader floodlight bars.
3/8 inch hole in the center accommodates post mount lights (like the Acro HID off road lights, 24 volt equipment lights, 12 volt flood lights, Vision-X HID lights and Duralux HID equipment lights and the Magnalight permanent mount lights). The platform also accommodates the 5-inch diameter, 200 pound grip magnets popular with our 12/24 volt DC spotlights, including the HML-6M, HML-5M, HML-7M, HML-8M, etc. with the addition of the magnetic mounting plate (or magnetic stainless steel mounting plate).
A one inch hole enables access for wire harnesses and power cords.
The design of the bar clamp enables the operator to position horizontally or vertically. 2 sets of mounting holes offer the operator the ability to mount the aluminum bracket system on the top or the side of the brackets. Thus this bracket system can be mounted on horizontal rails, bars or tubes. This was in response to customer’s demand for mounting solutions for vertical rails on pumping trucks, etc
This clamping system is effective on heavy equipment, boats, ATVs, trucks, toy haulers, etc.
BC-1 Bar Clamp Mount – clear anodize – HID-1870-F HID Flood Light Mounted.
This rail mount solution is effective for magnetic mount lights as well. We have a magnetic stainless steel plate (yes, some stainless steel has magnetic properties) that can be attached to the existing mounting patterns on this light. MMP-2 is the part number for this magnetic mounting plate. With this plate in place, you can remove a light like the GL-3067-M when not in use, but it will stay firmly affixed during use.
#larsonlights