Book Image

Data Science with SQL Server Quick Start Guide

By : Dejan Sarka
Book Image

Data Science with SQL Server Quick Start Guide

By: Dejan Sarka

Overview of this book

SQL Server only started to fully support data science with its two most recent editions. If you are a professional from both worlds, SQL Server and data science, and interested in using SQL Server and Machine Learning (ML) Services for your projects, then this is the ideal book for you. This book is the ideal introduction to data science with Microsoft SQL Server and In-Database ML Services. It covers all stages of a data science project, from businessand data understanding,through data overview, data preparation, modeling and using algorithms, model evaluation, and deployment. You will learn to use the engines and languages that come with SQL Server, including ML Services with R and Python languages and Transact-SQL. You will also learn how to choose which algorithm to use for which task, and learn the working of each algorithm.
Table of Contents (15 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Performing market-basket analysis


Market-basket analysis means, in its simplest implementation, finding which products tend to get purchased together, in the same basket. The basket might be either physical, such as a basket in a retail store, or a virtual one, such as a single Web order with one or more items. In the AdventureWorksDW2017 demo database, there isa dbo.vAssocSeqLineItems view with the web purchase transactions with the content that I am examining with the following query:

SELECT TOP 3 *
FROM dbo.vAssocSeqLineItems;

The result is this:

OrderNumber LineNumber Model
----------- ---------- ------------
SO61313     1          Road-350-W
SO61313     2          Cycling Cap
SO61313     3          Sport-100

The OrderNumber column defines the basket, and the Model column identifies a single product in the basket. Note that I did not include the ORDER BY clause in the query; therefore, you might get a different three rows than I did.

The first analysis is the counts of individual items and...