Apps in R

advertisement
Building Applications in R
16th July 2013, LondonR
Richard Pugh, Commercial Director, rpugh@mango-solutions.com
Andy Nicholls, Head of Consulting, anicholls@mango-solutions.com
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Chris Campbell, Senior Consultant, ccampbell@mango-solutions.com
Agenda
• Introduction
• Why Build Analytic Applications (with R)?
• Challenges, Learnings etc
• Some Case Studies
• Summary
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Introduction
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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!
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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”
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Why Build Analytic Applications?
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Deploying Analytics
• Complex analytics shouldn’t be attempted by nonanalysts
• BUT, adding analytics into a business process
can mean more informed decisions can be made
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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!
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Benefits for the
Decision Maker
Benefits for
the Analyst
No need to wait for
information
Less need to perform oftenrepetitive tasks
Can perform “what if”
analysis
Comfortable that the “right”
analysis is being run
Decision not dependent on
analyst availability
Can get on with more
strategic things?
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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” (?)
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Challenges, Learnings etc …
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Challenges, Learnings etc …
• This section contains some distilled messages
for building analytic apps using R
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Engage with the
End User
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Balance the
“funk” with the
“funktional”
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Don’t let the tail
wag the dog
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Set up an
environment
that supports
multi-tech
development
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Quality Manual
Project Mgment
Requirements
Issue Tracking
Behaviour Driven
Dev Procedures
Coding Standards
StatET
testthat
roxygen2
mangoUtils
Continuous Integration
Code Review
Review board
Knowledge Mgment
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
How will you
test it?
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Levels of Test
R
System Test
Java/Other
Via Target Interface
Module Test
Package Level
Integration Test
Unit Test
Function level
Class Level
Continuous Integration
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Build a good
“crossover”
team
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Design the
Connections
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Make the
analytics
“extensible”
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Some Case Studies
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
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
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Summary
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Summary
• Building analytic applications can be highly valuable
• Some challenges in working in a multi-tech (read “multistyle-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 …
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Richard Pugh, Commercial Director
rpugh@mango-solutions.com
Download