Intermediate Machine Learning in R on SQL Server and Microsoft ML Server - with Rafal Lukawiecki

This live classroom course is new for 2018! It focuses on the newest technologies of Microsoft Machine Learning Server and SQL Server 2017, and teaches you R and how to use it for machine learning on the Microsoft platform.


The target Group for this course is Data scientists and attendees at the course Introduction to Machine Learning, AI & Data Science with Azure ML

If you have attended a prior course on Machine Learning, like Rafals week-long class Practical Data Science that was offered in 2015–2017, and if you are versed in model validity, accuracy, and reliability - you shold consider attending the 3-day Intermediate course only. 

Ask yourself these questions:

  • Can I explain the difference between cross-validation and hold-out testing?
  • Do I know which business metrics correspond to precision and which to recall?
  • Is model accuracy more important than reliability, and how does a boosted decision tree work?

If in doubt, please attend both the Introduction course and the Intermediate course. 


To attend this course you should have prerequisites equal to the course Introduction to Machine Learning, AI & Data Science with Azure ML


The course format is 50% lectures, 30% demos and 20% tutorials. 
You are encouraged to follow the demos on your machine, and you will be challenged to find answers to 3 larger problems during the tutorials. While they are a hands-on part of the course, if you prefer not to practice, you are welcome to use that time for additional Q&A, or to analyse your own data. We will provide you with all the necessary data sets, and we will explain what free or evaluation edition software needs to be installed to follow the course on your own laptop. In some training centres we are able to provide pre-built machines which you can use instead of your own—please enquire. You will need an Azure account (even a free one) during the course. You can copy course experiments and data into your workspace for learning and for future reference after the course. 

What did our students say about the last course?

"Rafal er en utrolig dyktig formidler, og kurspresentasjonene var gjennomgående noe av det beste jeg har vært på av kursing." 
"Rafal er utrolig dyktig , godt forberedt og hyggelig/ hjelpsom." 
"Fantastisk kursholder! Venter med spenning på flere av hans kurs."

Course content:

To deliver the best possible training we follow the industry. The agenda and course content are subject to continuous improvement and revision without further notice. 

Working with R 
There is a large number of tools that you can use with R, and we begin the day focusing on the essential ones. You will also learn how to organise your workflow. Topics include:

  • RStudio vs. R Tools for Visual Studio
  • Rattle
  • Microsoft Machine Learning Server vs SQL Server Machine Learning Services
  • Projects, files, scripts, history, version control
  • Notebooks and RMarkdown

Data Preparation in R 
R uses data frames, data tables, and tibbles, amongst others, while ML Server adds XDFs and the ability to work with data stored natively in Hadoop, Spark, and SQL Server. While most data preparation should be done as close to source, preferably using SQL, you will need to learn how to perform some transformations in R. Topics include:

  • Data frames, tables, tibbles
  • Reading files and ODBC data
  • XDFs and connecting to data in ML Server
  • Tidyverse
  • dplyr

Plots and Visualisations in R 
One of the strengths of R is the ease of creating accurate (and good looking!) plots. As a bare minimum you need to understand how to use the most popular visualisation package, ggplot2, and some of the built-in base functions. Topics include:

  • Summarising data
  • Base boxplots, histograms, scatter plots
  • ggplot2: grammar of graphics
  • Combining visualisations into layers
  • Density plots
  • Surfacing R graphics in Power BI and SQL Server

Clustering, Segmentation, Anomaly Detection 
Segmentation is the main application of unsupervised learning using clustering algorithms. You will also learn how to apply this technique for anomaly (outlier) detection and data preprocessing. Topics include:

  • Introduction to segmentation
  • Clustering algorithms (k-means, EM, hierarchical, and others)
  • Interpreting clusters
  • Anomaly detection with clustering, PCA and SVMs

Without doubt, classifiers are the most important, and the most often used category of machine learning algorithms, and the foundation of algorithmic data science, and of most of todays Artificial Intelligence. We will focus on several variants of the most important classification algorithm—decision tree—while progressively interpreting the results, and improving its performance. After introducing neural networks and logistic regression we will also compare the performance of all of these classifiers on our test dataset. Topics include:

  • Introduction to classifiers
  • Two-class (binary) vs multi-class
  • Decision trees, forests, and boosting
  • Neural networks and logistic regression
  • Overfitting (overtraining) concerns

Classifier Validation 
Validation of classifiers will be your key concern, because classifiers are used so often, and because their accuracy is not easy to balance with business requirements, such as restricted resources, or a required level of business performance. Building on your understanding of model validity (introduced in Part A of this course), you will learn how to balance an acceptable number of false positives with false negatives by using classification (confusion) matrices, metrics of precision and recall, by plotting ROC (Receiver Operating Characteristic) curves, and by measuring their business impact using profit and cost charts. Attendees have commented in the past that this is the most important module of the entire course. Topics include:

  • Testing classifiers
  • Charting precision-recall and sensitivity-specificity
  • ROC curves and lift charts in detail
  • Other measures of accuracy, including AUC, and F1 scores
  • What exactly does cross-validation tell us?
  • Measuring quality of cross-validation
  • Optimising binary classifier prediction probability thresholds for a given business target
  • Refining models to improve accuracy and reliability
  • Hyperparameter tuning
  • Class imbalance problem (fraud analytics and rare event prediction)

Considered by some as the numerical equivalent of classifiers, regression is a large subject of its own. We will introduce its simple but a very popular form, linear regression, and the more precise, but also prone-to-overfitting, decision tree variants. Topics include:

  • Introduction to simple regressions in R
  • Linear regression (classic)
  • Regression decision trees and other ensemble regression algorithms
  • Regression as a building block of other algorithms

Regression Validation 
Unlike classifiers, regressions are easier to asses. You will learn about basic tests of classical linear regressions that are easy to perform in R, and about measuring quality of machine learning, non-linear regressions. Topics include:

  • Measuring linear regression quality
  • Homoscedasticity, multicollinearity and other concerns
  • Measuring machine learning regression quality
  • R-squared (Coefficient of Determination), RMSE, MAE, RAE, RSE

Deployment to Production 
If you plan on using your models for prediction, rather than just for the exploration of data, or if you want to embed them as Artificial Intelligence in your applications, you need to deploy your models to production and maintain them on an on-going basis. Since we focus on the Microsoft ML Server and SQL Server ML Services, you will learn about the PREDICT T-SQL statement, and other supported mechanisms for deploying your models. We will also discuss how to deploy models as a web service, using these, and other Microsoft and non-Microsoft techniques. Topics include:

  • What needs to be deployed, and when?
  • PREDICT T-SQL statement
  • Using sp_execute_external_script
  • Web service deployment with and without Azure ML
  • On-going maintenance and model updates

Please note: we reserve the right to amend the order of the modules to best suit the dynamic character of the class and to answer questions as they arise. Some subjects will only be covered if time allows, but your satisfaction is guaranteed. 

About Rafal Lukawiecki

As Data Scientist at Project Botticelli Ltd, Rafal focuses on making advanced analytics and artificial intelligence easy and useful for his clients.

He can help you find valuable, meaningful patterns and statistically valid correlations using data mining and machine learning in data sets both big and small. Rafal is also known for his work in business intelligence, data protection, enterprise architecture, and solution delivery. While majority of his clients come from consumer and corporate finance, entertainment, healthcare, IT, retail, and the public sectors, Rafal has worked in almost all industries.

He has been a popular speaker at major IT conferences since 1998.

Other relevant courses