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

Evaluating predictive models


To evaluate predictive models, you start by splitting your dataset into two disjunctive subsets: a training set and a test set. There is no strict rule about how to perform this division. You can start by using 70% of the data for training and 30% for testing. You train the model on the training set. After the model is trained, you use it on the test set to predict the values of the target variable. However, because the test set also consists of the data where the target variable value is known, you can measure how well a model predicts, and compare different models.

 

 

There are quite a few possible measures, which I will explain in the next few paragraphs. Note that you can also use the same data for training and for testing. Although typically you get predictions that are too good, better than with a separate test set, you can still compare different models.

Let me start with T-SQL code that selects 30% of the data from the dbo.vTargetMail view for the test set...