You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/machine-learning/tutorials/demo-data-nyctaxi-in-sql.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,7 @@ title: NYC Taxi demo data for tutorials
3
3
description: Create a database containing the New York City taxi sample data. This dataset is used in R and Python tutorials for SQL Server Machine Learning Services.
This article explains how to set up a sample database consisting of public data from the [New York City Taxi and Limousine Commission](http://www.nyc.gov/html/tlc/html/about/trip_record_data.shtml). This data is used in several R and Python tutorials for in-database analytics on SQL Server. To make the sample code run quicker, we created a representative 1% sampling of the data. On your system, the database backup file is slightly over 90 MB, providing 1.7 million rows in the primary data table.
18
17
19
-
To complete this exercise, you should have [SQL Server Management Studio](../../ssms/download-sql-server-management-studio-ssms.md?view=sql-server-2017&preserve-view=true) or another tool that can restore a database backup file and run T-SQL queries.
18
+
To complete this exercise, you should have [SQL Server Management Studio (SSMS)](../../ssms/download-sql-server-management-studio-ssms.md?view=sql-server-2017&preserve-view=true) or another tool that can restore a database backup file and run T-SQL queries.
20
19
21
20
Tutorials and quickstarts using this data set include the following:
22
21
@@ -25,34 +24,34 @@ Tutorials and quickstarts using this data set include the following:
25
24
26
25
## Download files
27
26
28
-
The sample database is a SQL Server 2016 BAK file hosted by Microsoft. You can restore it on SQL Server 2016 and later. File download begins immediately when you click the link.
27
+
The sample database is a SQL Server 2016 BAK file hosted by Microsoft. You can restore it on SQL Server 2016 and later. File download begins immediately when you open the link.
>To restore the sample database on [SQL Server Big Data Clusters](../../big-data-cluster/big-data-cluster-overview.md), download [NYCTaxi_Sample.bak](https://sqlmldoccontent.blob.core.windows.net/sqlml/NYCTaxi_Sample.bak) and follow the directions in [Restore a database into the SQL Server big data cluster master instance](../../big-data-cluster/data-ingestion-restore-database.md).
33
+
>To restore the sample database on [SQL Server Big Data Clusters](../../big-data-cluster/big-data-cluster-overview.md), download [NYCTaxi_Sample.bak](https://aka.ms/sqlmldocument/NYCTaxi_Sample.bak) and follow the directions in [Restore a database into the SQL Server big data cluster master instance](../../big-data-cluster/data-ingestion-restore-database.md).
35
34
::: moniker-end
36
35
37
36
::: moniker range=">=azuresqldb-mi-current"
38
37
>[!NOTE]
39
-
>To restore the sample database on [Machine Learning Services in Azure SQL Managed Instance](/azure/azure-sql/managed-instance/machine-learning-services-overview), follow the instructions in [Quickstart: Restore a database to Azure SQL Managed Instance](/azure/azure-sql/managed-instance/restore-sample-database-quickstart) using the NYC Taxi demo database .bak file: [https://sqlmldoccontent.blob.core.windows.net/sqlml/NYCTaxi_Sample.bak](https://sqlmldoccontent.blob.core.windows.net/sqlml/NYCTaxi_Sample.bak).
38
+
>To restore the sample database on [Machine Learning Services in Azure SQL Managed Instance](/azure/azure-sql/managed-instance/machine-learning-services-overview), follow the instructions in [Quickstart: Restore a database to Azure SQL Managed Instance](/azure/azure-sql/managed-instance/restore-sample-database-quickstart) using the NYC Taxi demo database .bak file: [https://aka.ms/sqlmldocument/NYCTaxi_Sample.bak](https://aka.ms/sqlmldocument/NYCTaxi_Sample.bak).
40
39
::: moniker-end
41
40
42
-
1.Click [NYCTaxi_Sample.bak](https://sqlmldoccontent.blob.core.windows.net/sqlml/NYCTaxi_Sample.bak) to download the database backup file.
41
+
1.Download the [NYCTaxi_Sample.bak](https://aka.ms/sqlmldocument/NYCTaxi_Sample.bak) database backup file.
43
42
44
-
2. Copy the file to C:\Program files\Microsoft SQL Server\MSSQL-instance-name\MSSQL\Backup folder.
43
+
2. Copy the file to `C:\Program files\Microsoft SQL Server\MSSQL-instance-name\MSSQL\Backup` or similar path, for your instance's default `Backup` folder.
45
44
46
-
3. In Management Studio, right-click **Databases** and select **Restore Files and File Groups**.
45
+
3. In SSMS, right-click **Databases** and select **Restore Files and File Groups**.
47
46
48
-
4. Enter *NYCTaxi_Sample* as the database name.
47
+
4. Enter `NYCTaxi_Sample` as the database name.
49
48
50
-
5.Click**From device** and then open the file selection page to select the backup file. Click**Add** to select NYCTaxi_Sample.bak.
49
+
5.Select**From device** and then open the file selection page to select the `NYCTaxi_Sample.bak`backup file. Select**Add** to select `NYCTaxi_Sample.bak`.
51
50
52
-
6. Select the **Restore** checkbox and click**OK** to restore the database.
51
+
6. Select the **Restore** checkbox and select**OK** to restore the database.
53
52
54
53
## Review database objects
55
-
54
+
56
55
Confirm the database objects exist on the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] instance using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)]. You should see the database, tables, functions, and stored procedures.
|**NYCTaxi_Sample**| database | Creates a database and two tables:<br /><br />dbo.nyctaxi_sample table: Contains the main NYC Taxi dataset. A clustered columnstore index is added to the table to improve storage and query performance. The 1% sample of the NYC Taxi dataset is inserted into this table.<br /><br />dbo.nyc_taxi_models table: Used to persist the trained advanced analytics model.|
65
+
|**NYCTaxi_Sample**| database | Creates a database and two tables:<br /><br />`dbo.nyctaxi_sample` table: Contains the main NYC Taxi dataset. A clustered columnstore index is added to the table to improve storage and query performance. The 1% sample of the NYC Taxi dataset is inserted into this table.<br /><br />`dbo.nyc_taxi_models` table: Used to persist the trained advanced analytics model.|
67
66
|**fnCalculateDistance**|scalar-valued function | Calculates the direct distance between pickup and dropoff locations. This function is used in [Create data features](r-taxi-classification-create-features.md), [Train and save a model](r-taxi-classification-train-model.md) and [Operationalize the R model](r-taxi-classification-deploy-model.md).|
68
67
|**fnEngineerFeatures**|table-valued function | Creates new data features for model training. This function is used in [Create data features](r-taxi-classification-create-features.md) and [Operationalize the R model](r-taxi-classification-deploy-model.md).|
69
68
@@ -72,27 +71,28 @@ Stored procedures are created using R and Python script found in various tutoria
|**RxPlotHistogram**|R | Calls the RevoScaleR rxHistogram function to plot the histogram of a variable and then returns the plot as a binary object. This stored procedure is used in [Explore and visualize data](r-taxi-classification-explore-data.md).|
76
-
|**RPlotRHist**|R| Creates a graphic using the Hist function and saves the output as a local PDF file. This stored procedure is used in [Explore and visualize data](r-taxi-classification-explore-data.md).|
77
-
|**RxTrainLogitModel**|R| Trains a logistic regression model by calling an R package. The model predicts the value of the tipped column, and is trained using a randomly selected 70% of the data. The output of the stored procedure is the trained model, which is saved in the table nyc_taxi_models. This stored procedure is used in [Train and save a model](r-taxi-classification-train-model.md).|
74
+
|**RxPlotHistogram**|R | Calls the RevoScaleR `rxHistogram` function to plot the histogram of a variable and then returns the plot as a binary object. This stored procedure is used in [Explore and visualize data](r-taxi-classification-explore-data.md).|
75
+
|**RPlotRHist**|R| Creates a graphic using the `Hist` function and saves the output as a local PDF file. This stored procedure is used in [Explore and visualize data](r-taxi-classification-explore-data.md).|
76
+
|**RxTrainLogitModel**|R| Trains a logistic regression model by calling an R package. The model predicts the value of the `tipped` column, and is trained using a randomly selected 70% of the data. The output of the stored procedure is the trained model, which is saved in the table `dbo.nyc_taxi_models`. This stored procedure is used in [Train and save a model](r-taxi-classification-train-model.md).|
78
77
|**RxPredictBatchOutput**|R | Calls the trained model to create predictions using the model. The stored procedure accepts a query as its input parameter and returns a column of numeric values containing the scores for the input rows. This stored procedure is used in [Predict potential outcomes](r-taxi-classification-deploy-model.md).|
79
78
|**RxPredictSingleRow**|R| Calls the trained model to create predictions using the model. This stored procedure accepts a new observation as input, with individual feature values passed as in-line parameters, and returns a value that predicts the outcome for the new observation. This stored procedure is used in [Predict potential outcomes](r-taxi-classification-deploy-model.md).|
80
79
81
80
## Query the data
82
81
83
82
As a validation step, run a query to confirm the data was uploaded.
84
83
85
-
1. In Object Explorer, under Databases, right-click the **NYCTaxi_Sample** database, and start a new query.
84
+
1. In Object Explorer, under **Databases**, right-click the **NYCTaxi_Sample** database, and start a new query.
86
85
87
86
2. Run some simple queries:
88
87
89
88
```sql
90
89
SELECT TOP(10) *FROMdbo.nyctaxi_sample;
91
90
SELECTCOUNT(*) FROMdbo.nyctaxi_sample;
92
91
```
92
+
93
93
The database contains 1.7 million rows.
94
94
95
-
3. Within the database is a **nyctaxi_sample** table that contains the data set. The table has been optimized for set-based calculations with the addition of a [columnstore index](../../relational-databases/indexes/columnstore-indexes-overview.md). Run this statement to generate a quick summary on the table.
95
+
3. Within the database is a `dbo.nyctaxi_sample` table that contains the data set. The table has been optimized for set-based calculations with the addition of a [columnstore index](../../relational-databases/indexes/columnstore-indexes-overview.md). Run this statement to generate a quick summary on the table.
96
96
97
97
```sql
98
98
SELECT DISTINCT [passenger_count]
@@ -102,6 +102,7 @@ The database contains 1.7 million rows.
102
102
GROUP BY [passenger_count]
103
103
ORDER BY AvgFares DESC
104
104
````
105
+
105
106
Results should be similar to those showing in the following screenshot.
0 commit comments