Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exploring R Services and Advanced Analytics

Similar presentations


Presentation on theme: "Exploring R Services and Advanced Analytics"— Presentation transcript:

1 Exploring R Services and Advanced Analytics
SQL Saturday #473 – Cleveland Exploring R Services and Advanced Analytics in SQL Server 2016 David Eldersveld Solution Consultant, BlueGranite @dr_eldersveld

2 Pop Quiz Besides R Services, name another improvement
to analytics capabilities in SQL Server 2016 Real-time operational analytics Significant columnstore index improvements Does not replace need for EDW or SSAS in most cases Feature summary DavidEldersveld

3 How to deploy and use R in SQL Server
Expectations Today’s Key Takeaway How to deploy and use R in SQL Server Session targeted to SQL users who have never used R Black box approach to R itself Main focus is not on R development or learning language DavidEldersveld

4 Agenda Setting the stage Microsoft R investment R Services
Advanced analytics, data science What is R? Microsoft R investment R Services Dev & Ops workflows Operationalized R R in Reporting Services and Power BI Demo: Overtime Prediction Images courtesy of R Project and Microsoft

5 Advanced Analytics Moving beyond traditional business intelligence
Modeling future results based on existing data “Not Advanced” “Advanced” Descriptive Predictive Prescriptive Analysis What happened What may happen Recommendation due to prediction Use cases Not that → Forecasting, classification, sentiment, anomaly detection, pattern recognition, text analysis, image classification & more Execution Batch Batch, streaming or combo (lambda architecture) Setting the stage DavidEldersveld

6 Data Science Strong foundation in basic statistics
Incorporates statistical or machine learning models Large data stores, ecosystems like Hadoop Language such as R for reproducible analysis Summarizes, visualizes, and presents to different audiences Setting the stage DavidEldersveld

7 What is R? Open source language & environment
Built for statistics and data science workloads Popular in academia, with influence expanding Traditional performance and scalability issues Setting the stage Image courtesy of R Project

8 Traditional R Issues Built by statisticians, for statisticians
Lack of governance Memory limitations No built-in parallel execution Setting the stage Image courtesy of R Project

9 R Seemingly Everywhere
On-premises/Hybrid SQL Server 2016 R Services Microsoft R Open Microsoft R Server Power BI R Tools for Visual Studio Cloud / Cortana Analytics Azure Machine Learning HDInsight Microsoft R investment Images courtesy of Microsoft

10 Why R, Why Now? In General Appropriate timing due to increased corporate R adoption Many businesses now require advanced analysis SQL Server R Services (SSRS*) Specifically Investment in popular open source language Existing skills, redeploy existing models On-premises answer to R capabilities in Azure *Unfortunately, SSRS acronym already taken Microsoft R investment

11 Revolution Analytics Acquired by Microsoft in 2015
“Enterprise-ready” R Overcomes many traditional R issues R capabilities extended Microsoft R investment Images courtesy of Microsoft

12 Re-Branded Revolution Products
Microsoft R Open (MRO) Formerly Revolution R Open (RRO) Enhanced version of open source R Microsoft R Server (MRS) Formerly Revolution R Enterprise (RRE) Performance enhancements Operationalized analytics at scale Portability Microsoft R investment Image courtesy of Microsoft

13 Re-Branded Revolution Products
Microsoft R investment Image courtesy of Microsoft

14 R Server Components ConnectR ScaleR DistributeR
Data source integration Storage: SQL Server, Hadoop, HBase & more ScaleR Numerous functions for increased performance over base R “rx” function prefixes (i.e. rxLinMod, rxLogit) PEMAs (parallel external memory algorithms) Transformation, statistics, modeling, machine learning & more DistributeR Compute context integration Compute: SQL Server in-database, Hadoop, local workstation & more Microsoft R investment DavidEldersveld

15 SQL Server R Services Microsoft R Server + SQL Server = R Services
Arguably two very distinct audiences Development <- data scientists / analysts Operationalization <- DBAs / analysts / business DEV OPS R Services NOTE: Any resemblance, either real or imagined, to a practice called DevOps is strictly unintentional

16 R Services – Development Scenario
Typically advanced analytics practitioner Use existing R IDE on local workstation Connect to SQL Server Change compute context Offload computation to SQL Server Bring results back to local environment Deploy in SQL Server or handoff R Services DavidEldersveld

17 R Services – Operational Scenario
Typically SQL professional Use existing SQL tools Deployment Embed R code or model in stored proc Store artifacts in database tables Consumption SQL Server Reporting Services Power BI R Services DavidEldersveld

18 For the DBA New software that competes for server resources
Setup and configuration now includes: Advanced Analytics Extensions Trusted Launchpad service Microsoft R Open Microsoft R Server (node version) Several post-installation tasks Admin Session isolation for R Resource governor for R Securable by user, role and database R Services configuration file R Services

19 For the DBA R Services config file in depth Adjustable options
<SQL instance folder>\binn\rlauncher.config Adjustable options MEMORY_LIMIT_PERCENT – 20% default TRACE_LEVEL – Error (1) default USER_POOL_SIZE – 10 user default Defaults recommended JOB_CLEANUP_ON_EXIT LOG_DIRECTORY MPI HOME RHOME WORKING_DIRECTORY R Services

20 For Everyone Else New software and capabilities… yeah!
Push analysis to SQL Server Embed R in stored procedures Store models and visual output R Services

21 Operationalized R New stored procedure
sp_execute_external_script SQL input --> R black box --> SQL output SQL Server Comfort Zone R Services Twilight Zone SQL Server Comfort Zone SQL recordset Transform and/or Model Plot Magic R data frame output SELECT FROM WHERE SQL query R data frame input Plots / Models varbinary(max) R Services DavidEldersveld

22 Operationalized R EXEC = = N’[R code goes = N’[SQL input]’ [ = N‘InputDataSet’ ] [ = N’OutputDataSet’ ] [ = N’parameter’ ] WITH RESULT SETS (([SQL output])); input_data_1_name and output_data_1_name are optional and default to InputDataSet and OutputDataSet respectively R Services DavidEldersveld

23 If output is a model or plot, specify varbinary(max) in
Operationalized R EXEC = = N’[R code goes = N’[SQL input]’ [ = N‘InputDataSet’ ] [ = N’OutputDataSet’ ] [ = N’parameter’ ] WITH RESULT SETS (([SQL output])); If output is a model or plot, specify varbinary(max) in WITH RESULT SETS R Services DavidEldersveld

24 Three Main Types of Output
Dataset Standard resultset of rows and columns Data types will vary Plot Static images Binary Model Trained models such as linear regression, naïve bayes, etc. R Services DavidEldersveld

25 Output a Dataset R Services DavidEldersveld

26 Output a Plot R Services DavidEldersveld

27 Output a Model R Services DavidEldersveld

28 Consumption - Reporting Services
If R output is dataset Retrieve stored results from table Execute stored proc directly If R output is image Retrieve stored image from table R in Reporting Services and Power BI

29 Consumption - Power BI Native R support Additional R support
R script as data source in PBI Desktop R visual executes R code and displays plot R coming in some form to PBI Service Additional R support “Pin” Reporting Services R charts to PBI Service R in Reporting Services and Power BI Image courtesy of Microsoft

30 Demo: Overtime Prediction
Public dataset with city payroll from 2011 to 2014 Can we predict future overtime expenses? Explore basic R Build plots & view in SSRS Build simple regression model Deploy the model Demo DavidEldersveld

31 Evaluations Session Event
@dr_eldersveld


Download ppt "Exploring R Services and Advanced Analytics"

Similar presentations


Ads by Google