Skip to content

Commit 1fae77c

Browse files
committed
Python quickstart rewrite, TOC change, and file move
1 parent b229dd0 commit 1fae77c

14 files changed

Lines changed: 105 additions & 70 deletions

.openpublishing.redirection.json

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
},
6363
{
6464
"source_path": "docs/advanced-analytics/tutorials/rtsql-predict-and-plot-from-model.md",
65-
"redirect_url": "/sql/advanced-analytics/tutorials/rtsql-predict-from-model",
66-
"redirect_document_id": false
65+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-predict-from-model",
66+
"redirect_document_id": true
6767
},
6868
{
6969
"source_path": "docs/advanced-analytics/tutorials/sqldev-py2-import-data-to-sql-server-using-powershell.md",
@@ -72,9 +72,44 @@
7272
},
7373
{
7474
"source_path": "docs/advanced-analytics/tutorials/run-python-using-t-sql.md",
75-
"redirect_url": "/sql/advanced-analytics/tutorials/pythontsql-run-python-using-t-sql",
76-
"redirect_document_id": false
75+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-python-run-using-t-sql",
76+
"redirect_document_id": true
77+
},
78+
{
79+
"source_path": "docs/advanced-analytics/tutorials/rtsql-create-a-predictive-model-r.md",
80+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-create-predictive-model",
81+
"redirect_document_id": true
7782
},
83+
{
84+
"source_path": "docs/advanced-analytics/tutorials/rtsql-predict-from-model.md",
85+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-predict-from-model",
86+
"redirect_document_id": true
87+
},
88+
{
89+
"source_path": "docs/advanced-analytics/tutorials/rtsql-r-and-sql-data-types-and-data-objects.md",
90+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-data-types-and-objects",
91+
"redirect_document_id": true
92+
},
93+
{
94+
"source_path": "docs/advanced-analytics/tutorials/rtsql-using-r-code-in-transact-sql-quickstart.md",
95+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-run-using-tsql",
96+
"redirect_document_id": true
97+
},
98+
{
99+
"source_path": "docs/advanced-analytics/tutorials/rtsql-using-r-functions-with-sql-server-data.md",
100+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-functions",
101+
"redirect_document_id": true
102+
},
103+
{
104+
"source_path": "docs/advanced-analytics/tutorials/rtsql-verify-r-exists.md",
105+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-verify",
106+
"redirect_document_id": true
107+
},
108+
{
109+
"source_path": "docs/advanced-analytics/tutorials/rtsql-working-with-inputs-and-outputs.md",
110+
"redirect_url": "/sql/advanced-analytics/tutorials/quickstart-r-inputs-and-outputs",
111+
"redirect_document_id": true
112+
},
78113
{
79114
"source_path": "docs/advanced-analytics/r/configuration-sql-server-r-services.md",
80115
"redirect_url": "/sql/advanced-analytics/r/managing-and-monitoring-r-solutions",

docs/advanced-analytics/toc.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,31 @@
5252
- name: R
5353
items:
5454
- name: Verify R exists in SQL Server
55-
href: tutorials/rtsql-verify-r-exists.md
55+
href: tutorials/quickstart-r-verify.md
5656
- name: Hello World in R and SQL
57-
href: tutorials/rtsql-using-r-code-in-transact-sql-quickstart.md
57+
href: tutorials/quickstart-r-run-using-tsql.md
5858
- name: Handle inputs and outputs
59-
href: tutorials/rtsql-working-with-inputs-and-outputs.md
59+
href: tutorials/quickstart-r-inputs-and-outputs.md
6060
- name: Handle data types and objects
61-
href: tutorials/rtsql-r-and-sql-data-types-and-data-objects.md
61+
href: tutorials/quickstart-r-data-types-and-objects.md
6262
- name: Using R functions
63-
href: tutorials/rtsql-using-r-functions-with-sql-server-data.md
63+
href: tutorials/quickstart-r-functions.md
6464
- name: Create a predictive model
65-
href: tutorials/rtsql-create-a-predictive-model-r.md
65+
href: tutorials/quickstart-r-create-predictive-model.md
6666
- name: Predict from model
67-
href: tutorials/rtsql-predict-from-model.md
67+
href: tutorials/quickstart-r-predict-from-model.md
6868
- name: Python
6969
items:
7070
- name: Verify Python exists in SQL Server
71-
href: tutorials/pythontsql-verify-python-exists.md
72-
- name: Hello world Python script in SQL Server
73-
href: tutorials/pythontsql-run-python-using-t-sql.md
71+
href: tutorials/quickstart-python-verify.md
72+
- name: Hello World in Python and SQL
73+
href: tutorials/quickstart-python-run-using-t-sql.md
7474
- name: Handle inputs and outputs
75-
href: tutorials/pythontsql-working-with-inputs-and-outputs.md
76-
- name: Python data structures in SQL Server
77-
href: tutorials/pythontsql-python-data-structures-in-sql-server.md
75+
href: tutorials/quickstart-python-inputs-and-outputs.md
76+
- name: Python data structures and SQL
77+
href: tutorials/quickstart-python-data-structures.md
7878
- name: Train and use your first model
79-
href: tutorials/train-score-using-python-in-tsql.md
79+
href: tutorials/quickstart-python-train-score-in-tsql.md
8080
- name: Tutorials
8181
href: tutorials/machine-learning-services-tutorials.md
8282
items:
@@ -88,22 +88,6 @@
8888
href: tutorials/demo-data-iris-in-sql.md
8989
- name: NYC Taxi data set
9090
href: tutorials/demo-data-nyctaxi-in-sql.md
91-
- name: Python
92-
href: tutorials/sql-server-python-tutorials.md
93-
items:
94-
- name: Create a Python model using revoscalepy
95-
href: tutorials/use-python-revoscalepy-to-create-model.md
96-
- name: Learn in-database analytics
97-
href: tutorials/sqldev-in-database-python-for-sql-developers.md
98-
items:
99-
- name: 1 - Data exploration
100-
href: tutorials/sqldev-py3-explore-and-visualize-the-data.md
101-
- name: 2 - Feature engineering
102-
href: tutorials/sqldev-py4-create-data-features-using-t-sql.md
103-
- name: 3 - Train and deploy
104-
href: tutorials/sqldev-py5-train-and-save-a-model-using-t-sql.md
105-
- name: 4 - Predictions
106-
href: tutorials/sqldev-py6-operationalize-the-model.md
10791
- name: R
10892
href: tutorials/sql-server-r-tutorials.md
10993
items:
@@ -164,6 +148,22 @@
164148
href: tutorials/deepdive-move-data-between-sql-server-and-xdf-file.md
165149
- name: Send custom R using rxExec
166150
href: tutorials/r-tutorial-custom-r-functions.md
151+
- name: Python
152+
href: tutorials/sql-server-python-tutorials.md
153+
items:
154+
- name: Create a Python model using revoscalepy
155+
href: tutorials/use-python-revoscalepy-to-create-model.md
156+
- name: Learn in-database analytics
157+
href: tutorials/sqldev-in-database-python-for-sql-developers.md
158+
items:
159+
- name: 1 - Data exploration
160+
href: tutorials/sqldev-py3-explore-and-visualize-the-data.md
161+
- name: 2 - Feature engineering
162+
href: tutorials/sqldev-py4-create-data-features-using-t-sql.md
163+
- name: 3 - Train and deploy
164+
href: tutorials/sqldev-py5-train-and-save-a-model-using-t-sql.md
165+
- name: 4 - Predictions
166+
href: tutorials/sqldev-py6-operationalize-the-model.md
167167
- name: Samples
168168
href: https://github.com/Microsoft/sql-server-samples
169169
- name: Solutions
@@ -187,8 +187,6 @@
187187
href: r/installing-and-managing-r-packages.md
188188
- name: Get package information
189189
href: r/determine-which-packages-are-installed-on-sql-server.md
190-
- name: Install new Python packages
191-
href: python/install-additional-python-packages-on-sql-server.md
192190
- name: Install new R packages
193191
href: r/install-additional-r-packages-on-sql-server.md
194192
items:
@@ -207,6 +205,8 @@
207205
href: r/create-a-local-package-repository-using-minicran.md
208206
- name: Tips for using R packages
209207
href: r/packages-installed-in-user-libraries.md
208+
- name: Install new Python packages
209+
href: python/install-additional-python-packages-on-sql-server.md
210210
- name: Data exploration and modeling
211211
items:
212212
- name: R-to-SQL data type conversions

docs/advanced-analytics/tutorials/pythontsql-python-data-structures-in-sql-server.md renamed to docs/advanced-analytics/tutorials/quickstart-python-data-structures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: In this quickstart for Python script in SQL Server, learn how use d
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 12/31/2018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
99
author: dphansen
1010
ms.author: davidph

docs/advanced-analytics/tutorials/pythontsql-working-with-inputs-and-outputs.md renamed to docs/advanced-analytics/tutorials/quickstart-python-inputs-and-outputs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ description: In this quickstart for Python script in SQL Server, learn how to st
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 12/31/2018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
99
author: dphansen
1010
ms.author: davidph
1111
manager: cgronlun
1212
---
13-
# Quickstart: Python data structures in SQL Server
13+
# Quickstart: Handle inputs and outputs using Python in SQL Server
1414
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)]
1515

1616
This quickstart shows how to handle inputs and outputs when using Python in SQL Server Machine Learning Services.

docs/advanced-analytics/tutorials/pythontsql-run-python-using-t-sql.md renamed to docs/advanced-analytics/tutorials/quickstart-python-run-using-t-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Quickstart for Python script in SQL Server. Learn the basics of cal
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 12/2782018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
99
author: dphansen
1010
ms.author: davidph

docs/advanced-analytics/tutorials/train-score-using-python-in-tsql.md renamed to docs/advanced-analytics/tutorials/quickstart-python-train-score-in-tsql.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
---
2-
title: Python models for training and predictions using stored procedures - SQL Server Machine Learning
2+
title: Quickstart for Python models for training and predictions using stored procedures - SQL Server Machine Learning
33
description: Embed Python code in SQL Server stored procedures to create, train, and use a Python model with the classic Iris data set. Save a trained model to SQL Server, and then use it to generate predicted outcomes.
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 10/23/2018
7+
ms.date: 01/04/2019
88
ms.topic: tutorial
9-
author: HeidiSteen
10-
ms.author: heidist
9+
author: dphansen
10+
ms.author: davidph
1111
manager: cgronlun
1212
---
13-
# Create, train, and use a Python model with stored procedures in SQL Server
13+
# Quickstart: Create, train, and use a Python model with stored procedures in SQL Server
1414
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)]
1515

16-
This exercise demonstrates Python integration with SQL Server when you add the [Machine Learning Services](../install/sql-machine-learning-services-windows-install.md) feature to a database engine instance. On such an instance, you can wrap Python code inside a [stored procedure](../../relational-databases/stored-procedures/stored-procedures-database-engine.md) to operationalize your script for production workloads. The ability to embed code in a stored procedure has tangible benefits in how you design, test, and manage data science and machine learning tasks. It makes your script and models accessible to any application that can connect to SQL Server.
17-
18-
In this Python exercise, you will create and execute two stored procedures. The first one uses the classic Iris flower data set and generates a Naïve Bayes model to predict an Iris species based on flower characteristics. The second procedure is for scoring. It calls the model generated in the first procedure to output a set of predictions. By placing code in a stored procedure, operations are contained, reusable, and callable by other stored procedures and client applications.
16+
In this quickstart using Python, you will create and execute two stored procedures. The first one uses the classic Iris flower data set and generates a Naïve Bayes model to predict an Iris species based on flower characteristics. The second procedure is for scoring. It calls the model generated in the first procedure to output a set of predictions. By placing code in a stored procedure, operations are contained, reusable, and callable by other stored procedures and client applications.
1917

2018
By completing this tutorial, you will learn:
2119

@@ -26,9 +24,9 @@ By completing this tutorial, you will learn:
2624
2725
## Prerequisites
2826

29-
Sample data used in this exercise is the [**irissql**](demo-data-iris-in-sql.md) database.
27+
A previous quickstart, [Verify Python exists in SQL Server](pythontsql-verify-python-exists.md), provides information and links for setting up the Python environment required for this quickstart.
3028

31-
You also need a T-SQL editor, such as [SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017).
29+
The sample data used in this exercise is the [**irissql**](demo-data-iris-in-sql.md) database.
3230

3331
## Create a stored procedure that generates models
3432

@@ -60,7 +58,7 @@ A common pattern in SQL Server development is to organize programmable operation
6058
import pickle
6159
from sklearn.naive_bayes import GaussianNB
6260
GNB = GaussianNB()
63-
trained_model = pickle.dumps(GNB.fit(iris_data[[0,1,2,3]], iris_data[[4]]))
61+
trained_model = pickle.dumps(GNB.fit(iris_data[[0,1,2,3]], iris_data[[4]].values.ravel()))
6462
'
6563
, @input_data_1 = N'select "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "SpeciesId" from iris_data'
6664
, @input_data_1_name = N'iris_data'
@@ -85,22 +83,24 @@ In this step, execute the procedure to run the embedded code, creating a trained
8583
```sql
8684
DECLARE @model varbinary(max);
8785
DECLARE @new_model_name varchar(50)
88-
SET @new_model_name = 'Naive Bayes '
89-
SELECT @new_model_name
86+
SET @new_model_name = 'Naive Bayes'
9087
EXEC generate_iris_model @model OUTPUT;
9188
DELETE iris_models WHERE model_name = @new_model_name;
9289
INSERT INTO iris_models (model_name, model) values(@new_model_name, @model);
9390
GO
9491
```
9592
96-
2. View the results in the output area. The script includes a SELECT statement showing that the model exists. Another way to return a list of models is `SELECT * FROM iris_models` in **irissql**.
93+
2. Verify that the model was inserted Another way to return a list of models is
94+
95+
```sql
96+
SELECT * FROM dbo.iris_models
97+
```
9798
9899
**Results**
99100
100-
| | (no column name |
101+
| model_name | model |
101102
|---|-----------------|
102-
| 1 | Naive Bayes |
103-
103+
| Naive Bayes | 0x800363736B6C6561726E2E6E616976655F62617965730A... |
104104
105105
## Create and execute a stored procedure for generating predictions
106106

docs/advanced-analytics/tutorials/pythontsql-verify-python-exists.md renamed to docs/advanced-analytics/tutorials/quickstart-python-verify.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Quickstart for verifying that Python and Machine Learning Services
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 12/27/2018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
99
author: dphansen
1010
ms.author: davidph

docs/advanced-analytics/tutorials/rtsql-create-a-predictive-model-r.md renamed to docs/advanced-analytics/tutorials/quickstart-r-create-predictive-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: In this quickstart, learn how to build a model in R using SQL Serve
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 12/20/2018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
99
author: dphansen
1010
ms.author: davidph

docs/advanced-analytics/tutorials/rtsql-r-and-sql-data-types-and-data-objects.md renamed to docs/advanced-analytics/tutorials/quickstart-r-data-types-and-objects.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ description: In this quickstart, learn how to work with data types and data obje
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 07/15/2018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
9-
author: HeidiSteen
10-
ms.author: heidist
9+
author: dphansen
10+
ms.author: davidph
1111
manager: cgronlun
1212
---
1313
# Quickstart: Handle data types and objects using R in SQL Server

docs/advanced-analytics/tutorials/rtsql-using-r-functions-with-sql-server-data.md renamed to docs/advanced-analytics/tutorials/quickstart-r-functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Quickstart showing R functions with SQL Server data - SQL Server Machine Learning
3-
description: In this quickstart, learn how to write an R function that uses SQL Server data.
2+
title: Quickstart showing R functions- SQL Server Machine Learning
3+
description: In this quickstart, learn how to write an R function for advanced statistical computation.
44
ms.prod: sql
55
ms.technology: machine-learning
66

7-
ms.date: 12/14/2018
7+
ms.date: 01/04/2019
88
ms.topic: quickstart
99
author: dphansen
1010
ms.author: davidph
1111
manager: cgronlun
1212
---
13-
# Quickstart: Using R functions with SQL Server data
13+
# Quickstart: Using R functions
1414
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)]
1515

1616
If you completed the previous quickstarts, you're familiar with basic operations and ready for something more complex, such as statistical functions. Advanced statistical functions that are complicated to implement in T-SQL can be done in R with only a single line of code.

0 commit comments

Comments
 (0)