richard pugh, commercial director [email protected] building applications in r 16 th july...

34
Richard Pugh, Commercial Director [email protected] Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, [email protected] Andy Nicholls, Head of Consulting, [email protected] Chris Campbell, Senior Consultant, [email protected]

Upload: gary-taylor

Post on 22-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Building Applications in R16th July 2013, LondonR

Richard Pugh, Commercial Director, [email protected] Nicholls, Head of Consulting, [email protected]

Chris Campbell, Senior Consultant, [email protected]

Page 2: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Agenda

• Introduction

• Why Build Analytic Applications (with R)?

• Challenges, Learnings etc

• Some Case Studies

• Summary

Page 3: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Introduction

Page 4: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Mango a Nutshell

• Premier R training and services company• Private company founded in 2002• Headquartered in UK• Global Team of ~70 and expanding• Services: Training, Consulting,

Application Development, Support and Validation

Page 5: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

This Presentation …

• Was a training course: How to build analytic applications using R

• Then was a 4 hour presentation: Themes for building analytic application using R with lots of examples

• Now a 20 minute (+/- 1.96*SE) presentation: Things we’ve learnt when building analytic applications using R

• Ask me later if you are interested in the earlier versions!

Page 6: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Caveats

• I’m a statistician who knows R, but am more of a “user” than a “developer”

• For some of this, you could swap “in R” with “in any analytic technology”

Page 7: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Why Build Analytic Applications?

Page 8: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Why Analytics?

• Analytics can help people answer all sorts of questions

• I believe there is no company in the world today who cannot benefit from analytics in some way

• More and more people are realising it

Page 9: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Why Build Analytic Applications?

• 3 key reasons we see:• To deploy analytical tools to decision makers

• To make an analysts life more efficient

• To add rigour to an analysts workflow

Page 10: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Deploying Analytics

• Complex analytics shouldn’t be attempted by non-analysts

• BUT, adding analytics into a business process can mean more informed decisions can be made

Page 11: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Deploying Analytics

• If we build an application which …

• is easy for the decision maker to use

• contains the correct analysis to apply

• communicates analytical results in suitable manner

• … this leads to some major benefits!

Page 12: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Benefits for the Analyst

Benefits for the Decision Maker

No need to wait for information

Can perform “what if” analysis

Decision not dependent on analyst availability

Less need to perform often-repetitive tasks

Comfortable that the “right” analysis is being run

Can get on with more strategic things?

Page 13: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Why build Analytic Apps with R?

• R is license free (^infrastructure)

• R’s open nature means it can be readily integrated

• R can be extended by the developer as needed

• R is rapidly developed

• R users are more “development-aware” (?)

Page 14: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Challenges, Learnings etc …

Page 15: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Challenges, Learnings etc …

• This section contains some distilled messages for building analytic apps using R

Page 16: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Engage with the End User

Page 20: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Project Mgment Requirements

Behaviour Driven

Code Review

Review board

StatET

testthatroxygen2

Continuous Integration

Issue TrackingQuality Manual

Dev Procedures

Coding Standards

mangoUtils

Knowledge Mgment

Page 21: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

How will you test it?

Page 22: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Levels of Test

R Java/Other

System Test Via Target Interface

Unit Test Function level Class Level

Module Test Package Level Integration Test

Continuous Integration

Page 26: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Some Case Studies

Page 27: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Mondelēz Coffee Optimiser

• Requirement: Coffee Optimisation Desktop Tool based on previous S+ application

• Technology: R, GTK+, RODBC• What went well: GTK+ helped us to easily

recreate the previous UI, MSI Installer helped• What was tricky: Balancing conversion and

extensions, Integration with third party optimiser

Page 28: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Page 29: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Modelling Evaluation

• Requirement: Web app to evaluate “PKPD” models

• Technology: R, Java, JSF, JavaScript, Oracle, …• What went well: Clear API to R, R session

balancing• What was tricky: Performance of R based on

constraints

Page 30: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Backtesting Application

• Requirement: Backtesting app for hedge fund• Technology: R, MySql, C, VBA• What went well: Users loved R, UI dropped, PDF

reporting• What was tricky: Devil was in the detail, storing

data in .RData files

Page 31: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Non-Compartmental Analysis

• Requirement: “NCA” workflow tool• Technology: R, R.Net, XAML, Infragistics, .NET• What went well: Clear API between R and app, • What was tricky: R.Net session management,

amount of unit tests to write

Page 32: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Summary

Page 33: Richard Pugh, Commercial Director rpugh@mango-solutions.com Building Applications in R 16 th July 2013, LondonR Richard Pugh, Commercial Director, rpugh@mango-solutions.com

Richard Pugh, Commercial [email protected]

Summary

• Building analytic applications can be highly valuable• Some challenges in working in a multi-tech (read “multi-

style-of-tech” and “multi-type-of-developer”) environment• Requires lots of up front thinking (design, dev

environment, training etc)• If you’re planning to build an analytic app using R, we’d be

happy to lend our experience …