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

Showing associations graphically


This time, I will show you the code in Python only. I will discuss different measures of associations for discrete and continuous variables, and graphical presentation of these associations, in Chapter 6, Intermediate Statistics and Graphs, of this book. The next two graphs are here just for a tease.

A scatterplot is quite common representation of a distribution of two continuous variables. Each point in the plane has coordinates defined by the values of these two variables. From the positions of the points, you can get the impression of the distribution of both variables, and also about possible association between them. Here is the Python code that will create a scatterplot for the Age and YearlyIncome variables:

TM1 = TM.head(200)
plt.scatter(TM1['Age'], TM1['YearlyIncome'])
plt.xlabel("Age", fontsize = 16)
plt.ylabel("YearlyIncome", fontsize = 16)
plt.title("YearlyIncome over Age", fontsize = 16)
plt.show()

Note that in order to have a less cluttered scatterplot...