SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
R PACKAGE
DEVELOPMENT
• Dominant in statistics research.
• Interpreted language:
No need to compile before run.
• At its core an Imperative Language.
Also supports Functional Programming.
And Object Oriented Programming.
WHAT IS THE R LANGUAGE?
R
HELLO WORLD
Imperative: explore data
FP: data analysis
OOP: building tools
SO…
WHICH PARADIGM
TO USE IN R?
ALSO, R IS REAL GOOD WITH VECTORS
(and matrices)
10 to 100 times faster
CLASS SYSTEMS
• S3: minimal
• S4: very verbose
• R5: (reference classes) slow
• C++: fast, not platform independent,
needs boilerplate.
• New: R6 (default at Microsoft)
• New kid on the block
• Light weight and fast
• Public and private methods
• Active bindings
• Mature inheritance
MY PREFERENCE: R6
ALSO, R6 JUST MAKES ME FEEL
RIGHT AT HOME…
• SEMANTIC DEV SKILLS
• SYNTACTIC DEV SKILLS
• DOMAIN KNOWLEDGE
R DEVELOPMENT IN 3D
Semantic: What is a Multi-Armed Bandit?
• Origin: Gambler in casino want to maximize winnings by playing slot
machines
• Balance exploration vs exploitation (also: “learning” vs “learning”)
• Objective: Given a set of K distinct arms, each with unknown reward
distribution, find the maximum sum of rewards.
• Example: 3 slot machines (arms)
Each 2 pulls explore, what now?
Translation to health related problem
• 1. A patient arrives with symptoms, medical history at physician.
• 2. Physician prescribes treatment A or treatment B.
• 3. Patient’s health responds (e.g., improves, worsens).
• 4. Depending on results, physician changes opinion
on best treatment option for this kind of patient.
• Goal: prescribe treatments that yield good health outcomes.
What’s the challenge for the physician here?
• Fundamental dilemma
• Exploit what has been learned
• Explore to find which behaviors lead to high rewards
• Need to use context and arm history effectively
• Different actions are preferred under different contexts
• Might not see the same context twice
Solution: use a smart rule: a policy
• Policy: rule mapping context to action
• Allows choice of different good actions in different contexts
• E.g.:
• If (sex = male) choose action 1
• Else if (age > 45) choose action 2
• Else choose action 3
• Policy 𝜋 ∶ context 𝑥 ↦ (action 𝑎) + HISTORY … adapt
Let’s formalize, to easier compare, apply ..
• Use adaptive policy Π with distribution parameters θ to make a choice.
• For t=1,2,…,T:
• 1. Observe context 𝒙 𝒕
• 2. Choose action 𝒂 𝒕 ∈ {𝟏, 𝟐, … , 𝑲} using current θ of Π
• 3. Collect reward 𝑟𝑡(𝑎 𝑡)
• 4. Using reward 𝑟𝑡(𝑎 𝑡) adapt θ as suggested by good Π
Goal: finding for choosing actions with high reward
෍
𝑡=1
𝑇
𝑟𝑡 𝑎 𝑡
get_something
do_procedure
get_value
For example …
• 1.
• 2.
• 3.
• 4.
FIRST SKETCH, THEN CODE
CONTEXTUAL:
UML DIAGRAMS
CONTEXTUAL:
UML DIAGRAMS
CLEAN CODE
Keep It Simple Stupid
You Aren’t Gonna Need It
Don’t Repeat Yourself !
ADDING LI BANDIT: EASY!
PSEUDO CODE:
YAY!
ADDING LI BANDIT: EASY!
FULLY RANDOMLY OFFERED CHOICES
IN REAL LIFE SETTING
PEOPLE HAVE MAKE CHOICE WITH
KNOWN CONTEXT
THE DATA IS USED BY THE BANDIT
CHECKS IF POLICY MAKES SAME CHOICE AS
PERSON ORIGINALLY MADE
IF SO, CAN USE THIS ROW OF INCLUSIVE
CONTEXT TO TEST THE POLICY
RSTUDIO: REAL USEFUL
RSTUDIO: REAL USEFUL
RSTUDIO: REAL USEFUL
RSTUDIO: REAL USEFUL
RSTUDIO: REAL USEFUL
RSTUDIO: REAL USEFUL
RSTUDIO: REAL USEFUL
PROFVIS PROFILING
PRE-ALLOCATE DATA STRUCTURES
VERSION CONTROL / GITHUB
your safety net
(and makes collaboration easy)
ALSO HELPS AUTOMATE
DEVELOPMENT
RELATED PROCESSES
ZENODO
Research Data Repository
on releases: auto doi generation
Commit
CONTINUOUS INTEGRATION:
DOES YOUR CODEBASE STILL WORK?
CODECOV.IO INTEGRATION:
DO TESTS COVER ALL OF YOUR CODE?
CODECOVERAGE
PARALLEL PROCESSING ON AWS
THE ART OF PARALLEL PROCESSING
58 cores 120 cores
faster
Balancing overhead and network
with more processing power
k3 * d3 * 5 policies * 300 * 10000
58 cores: 132 seconds
120 cores: 390 seconds
k3 * d3 * 5 policies * 3000 * 10000
58 cores: 930 seconds
120 cores: 691 seconds
• More documentation, clean result printouts
• More paper writing (!)
• Implement famous papers, show same results?
• Refactor again: to focus less on optimization,
more on readability, particularly SyntheticBandit (although…)
WHAT IS NEXT?
R BEGINNERS
R in Action- Robert Kabacoff - R in Action
MORE ADVANCED
R packages - Hadley Wickham
Advanced R - Hadley Wickham
CLEAN CODE
Code Complete - Steve McConnell
Clean Code - Robert C. Martin
ALSO INTERESTING
R Inferno - Patrick Burns
LITERATURE

Más contenido relacionado

Similar a R Package Development: A Guide to Creating R Packages

From SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the SwitchFrom SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the SwitchRachel Berryman
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at ScaleDavid Simons
 
(Big) Data (Science) Skills
(Big) Data (Science) Skills(Big) Data (Science) Skills
(Big) Data (Science) SkillsOscar Corcho
 
Which institute is best for data science?
Which institute is best for data science?Which institute is best for data science?
Which institute is best for data science?DIGITALSAI1
 
Best Selenium certification course
Best Selenium certification courseBest Selenium certification course
Best Selenium certification courseKumarNaik21
 
Data science training in hyd ppt (1)
Data science training in hyd ppt (1)Data science training in hyd ppt (1)
Data science training in hyd ppt (1)SayyedYusufali
 
Data science training institute in hyderabad
Data science training institute in hyderabadData science training institute in hyderabad
Data science training institute in hyderabadVamsiNihal
 
Data science training in Hyderabad
Data science  training in HyderabadData science  training in Hyderabad
Data science training in Hyderabadsaitejavella
 
Data science training Hyderabad
Data science training HyderabadData science training Hyderabad
Data science training HyderabadNithinsunil1
 
Data science online training in hyderabad
Data science online training in hyderabadData science online training in hyderabad
Data science online training in hyderabadVamsiNihal
 
Data science training in hyd ppt (1)
Data science training in hyd ppt (1)Data science training in hyd ppt (1)
Data science training in hyd ppt (1)SayyedYusufali
 
data science training and placement
data science training and placementdata science training and placement
data science training and placementSaiprasadVella
 
online data science training
online data science trainingonline data science training
online data science trainingDIGITALSAI1
 
Data science online training in hyderabad
Data science online training in hyderabadData science online training in hyderabad
Data science online training in hyderabadVamsiNihal
 
data science online training in hyderabad
data science online training in hyderabaddata science online training in hyderabad
data science online training in hyderabadVamsiNihal
 
Best data science training in Hyderabad
Best data science training in HyderabadBest data science training in Hyderabad
Best data science training in HyderabadKumarNaik21
 
Data science training Hyderabad
Data science training HyderabadData science training Hyderabad
Data science training HyderabadNithinsunil1
 
NYC Open Data Meetup-- Thoughtworks chief data scientist talk
NYC Open Data Meetup-- Thoughtworks chief data scientist talkNYC Open Data Meetup-- Thoughtworks chief data scientist talk
NYC Open Data Meetup-- Thoughtworks chief data scientist talkVivian S. Zhang
 
Data Science Training and Placement
Data Science Training and PlacementData Science Training and Placement
Data Science Training and PlacementAkhilGGM
 

Similar a R Package Development: A Guide to Creating R Packages (20)

From SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the SwitchFrom SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the Switch
 
Cshl minseqe 2013_ouellette
Cshl minseqe 2013_ouelletteCshl minseqe 2013_ouellette
Cshl minseqe 2013_ouellette
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at Scale
 
(Big) Data (Science) Skills
(Big) Data (Science) Skills(Big) Data (Science) Skills
(Big) Data (Science) Skills
 
Which institute is best for data science?
Which institute is best for data science?Which institute is best for data science?
Which institute is best for data science?
 
Best Selenium certification course
Best Selenium certification courseBest Selenium certification course
Best Selenium certification course
 
Data science training in hyd ppt (1)
Data science training in hyd ppt (1)Data science training in hyd ppt (1)
Data science training in hyd ppt (1)
 
Data science training institute in hyderabad
Data science training institute in hyderabadData science training institute in hyderabad
Data science training institute in hyderabad
 
Data science training in Hyderabad
Data science  training in HyderabadData science  training in Hyderabad
Data science training in Hyderabad
 
Data science training Hyderabad
Data science training HyderabadData science training Hyderabad
Data science training Hyderabad
 
Data science online training in hyderabad
Data science online training in hyderabadData science online training in hyderabad
Data science online training in hyderabad
 
Data science training in hyd ppt (1)
Data science training in hyd ppt (1)Data science training in hyd ppt (1)
Data science training in hyd ppt (1)
 
data science training and placement
data science training and placementdata science training and placement
data science training and placement
 
online data science training
online data science trainingonline data science training
online data science training
 
Data science online training in hyderabad
Data science online training in hyderabadData science online training in hyderabad
Data science online training in hyderabad
 
data science online training in hyderabad
data science online training in hyderabaddata science online training in hyderabad
data science online training in hyderabad
 
Best data science training in Hyderabad
Best data science training in HyderabadBest data science training in Hyderabad
Best data science training in Hyderabad
 
Data science training Hyderabad
Data science training HyderabadData science training Hyderabad
Data science training Hyderabad
 
NYC Open Data Meetup-- Thoughtworks chief data scientist talk
NYC Open Data Meetup-- Thoughtworks chief data scientist talkNYC Open Data Meetup-- Thoughtworks chief data scientist talk
NYC Open Data Meetup-- Thoughtworks chief data scientist talk
 
Data Science Training and Placement
Data Science Training and PlacementData Science Training and Placement
Data Science Training and Placement
 

Último

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Último (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

R Package Development: A Guide to Creating R Packages

  • 2. • Dominant in statistics research. • Interpreted language: No need to compile before run. • At its core an Imperative Language. Also supports Functional Programming. And Object Oriented Programming. WHAT IS THE R LANGUAGE?
  • 4. Imperative: explore data FP: data analysis OOP: building tools SO… WHICH PARADIGM TO USE IN R?
  • 5. ALSO, R IS REAL GOOD WITH VECTORS (and matrices) 10 to 100 times faster
  • 6. CLASS SYSTEMS • S3: minimal • S4: very verbose • R5: (reference classes) slow • C++: fast, not platform independent, needs boilerplate. • New: R6 (default at Microsoft)
  • 7. • New kid on the block • Light weight and fast • Public and private methods • Active bindings • Mature inheritance MY PREFERENCE: R6
  • 8. ALSO, R6 JUST MAKES ME FEEL RIGHT AT HOME…
  • 9.
  • 10. • SEMANTIC DEV SKILLS • SYNTACTIC DEV SKILLS • DOMAIN KNOWLEDGE R DEVELOPMENT IN 3D
  • 11.
  • 12. Semantic: What is a Multi-Armed Bandit? • Origin: Gambler in casino want to maximize winnings by playing slot machines • Balance exploration vs exploitation (also: “learning” vs “learning”) • Objective: Given a set of K distinct arms, each with unknown reward distribution, find the maximum sum of rewards. • Example: 3 slot machines (arms) Each 2 pulls explore, what now?
  • 13. Translation to health related problem • 1. A patient arrives with symptoms, medical history at physician. • 2. Physician prescribes treatment A or treatment B. • 3. Patient’s health responds (e.g., improves, worsens). • 4. Depending on results, physician changes opinion on best treatment option for this kind of patient. • Goal: prescribe treatments that yield good health outcomes.
  • 14. What’s the challenge for the physician here? • Fundamental dilemma • Exploit what has been learned • Explore to find which behaviors lead to high rewards • Need to use context and arm history effectively • Different actions are preferred under different contexts • Might not see the same context twice
  • 15. Solution: use a smart rule: a policy • Policy: rule mapping context to action • Allows choice of different good actions in different contexts • E.g.: • If (sex = male) choose action 1 • Else if (age > 45) choose action 2 • Else choose action 3 • Policy 𝜋 ∶ context 𝑥 ↦ (action 𝑎) + HISTORY … adapt
  • 16. Let’s formalize, to easier compare, apply .. • Use adaptive policy Π with distribution parameters θ to make a choice. • For t=1,2,…,T: • 1. Observe context 𝒙 𝒕 • 2. Choose action 𝒂 𝒕 ∈ {𝟏, 𝟐, … , 𝑲} using current θ of Π • 3. Collect reward 𝑟𝑡(𝑎 𝑡) • 4. Using reward 𝑟𝑡(𝑎 𝑡) adapt θ as suggested by good Π Goal: finding for choosing actions with high reward ෍ 𝑡=1 𝑇 𝑟𝑡 𝑎 𝑡
  • 18. For example … • 1. • 2. • 3. • 4.
  • 20.
  • 21.
  • 22.
  • 25.
  • 26. CLEAN CODE Keep It Simple Stupid You Aren’t Gonna Need It Don’t Repeat Yourself !
  • 27. ADDING LI BANDIT: EASY! PSEUDO CODE: YAY!
  • 28. ADDING LI BANDIT: EASY! FULLY RANDOMLY OFFERED CHOICES IN REAL LIFE SETTING PEOPLE HAVE MAKE CHOICE WITH KNOWN CONTEXT THE DATA IS USED BY THE BANDIT CHECKS IF POLICY MAKES SAME CHOICE AS PERSON ORIGINALLY MADE IF SO, CAN USE THIS ROW OF INCLUSIVE CONTEXT TO TEST THE POLICY
  • 29.
  • 39.
  • 40. VERSION CONTROL / GITHUB your safety net (and makes collaboration easy)
  • 42. ZENODO Research Data Repository on releases: auto doi generation
  • 44. CODECOV.IO INTEGRATION: DO TESTS COVER ALL OF YOUR CODE? CODECOVERAGE
  • 45.
  • 47. THE ART OF PARALLEL PROCESSING 58 cores 120 cores faster Balancing overhead and network with more processing power k3 * d3 * 5 policies * 300 * 10000 58 cores: 132 seconds 120 cores: 390 seconds k3 * d3 * 5 policies * 3000 * 10000 58 cores: 930 seconds 120 cores: 691 seconds
  • 48.
  • 49. • More documentation, clean result printouts • More paper writing (!) • Implement famous papers, show same results? • Refactor again: to focus less on optimization, more on readability, particularly SyntheticBandit (although…) WHAT IS NEXT?
  • 50. R BEGINNERS R in Action- Robert Kabacoff - R in Action MORE ADVANCED R packages - Hadley Wickham Advanced R - Hadley Wickham CLEAN CODE Code Complete - Steve McConnell Clean Code - Robert C. Martin ALSO INTERESTING R Inferno - Patrick Burns LITERATURE