Skip to content

Commit 0d13643

Browse files
committed
Refactored ML samples
1 parent d372d12 commit 0d13643

8 files changed

Lines changed: 54 additions & 16 deletions

File tree

samples/features/sql-big-data-cluster/machine-learning/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Machine learning in SQL Server 2019 big data cluster
1+
# Machine Learning in SQL Server 2019 big data cluster
22

33
## SQL Server Machine Learning Services
44

5+
SQL Server 2016 added capability to run R script from T-SQL. SQL Server 2017 added support for running Python scripts from T-SQL. SQL Server 2019 adds support for running Java code from T-SQL. You can now run R, Python or Java code from T-SQL in SQL Server 2019 on Windows or Linux or SQL Server 2019 big data cluster.
6+
57
[sql](sql)
68

79
SQL Server machine learning services samples showing R, Python & Java support.
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
# SQL Server Machine Learning Services on SQL Master instance
1+
# SQL Server Machine Learning Services
22

3-
[book-click-prediction-r.sql](book-click-prediction-r.sql/)
3+
SQL Server 2016 added capability to run R script from T-SQL. SQL Server 2017 added support for running Python scripts from T-SQL. SQL Server 2019 adds support for running Java code from T-SQL.
44

5-
In this example, we are building a machine learning model using R and a logistic regression algorithm for a recommendation engine on an online store. Based on existing users' click pattern online and their interest in other categories and demographics, we are training a machine learning model. This model will then be used to predict if the visitor is interested in a given item category using the T-SQL PREDICT function.
5+
**Applies to: SQL Server 2016+, SQL Server 2019, SQL Server 2019 big data cluster**
66

7-
[book-click-prediction-py.sql](book-click-prediction-py.sql/)
7+
[r](r)
88

9-
In this example, we are building a machine learning model using Python and a logistic regression algorithm for a recommendation engine on an online store. Based on existing users' click pattern online and their interest in other categories and demographics, we are training a machine learning model. This model will then be used to predict if the visitor is interested in a given item category using the T-SQL PREDICT function.
9+
This folder contains the R samples.
1010

11-
[book-click-prediction-partitioned-r.sql](book-click-prediction-partitioned-r.sql/)
11+
[python](python)
1212

13-
In this example, we are leveraging the new partitioning support (SQL Server 2019) in sp_execute_external_script to partition the input data and run the R script per partition. So we will modify the training script to train model per group of users based on credit rating. The R script will produce N models for the same input data set.
13+
This folder contains the R samples.
1414

15-
[book-click-prediction-partitioned-py.sql](book-click-prediction-partitioned-py.sql/)
15+
[java](java)
1616

17-
In this example, we are leveraging the new partitioning support (SQL Server 2019) in sp_execute_external_script to partition the input data and run the Python script per partition. So we will modify the training script to train model per group of users based on credit rating. The Python script will produce N models for the same input data set.
18-
19-
### Instructions
20-
21-
1. Connect to SQL Server Master instance.
22-
23-
1. Execute the SQL script.
17+
This folder contains the Java samples.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SQL Server Machine Learning Services
2+
3+
SQL Server 2016 added capability to run R script from T-SQL. SQL Server 2017 added support for running Python scripts from T-SQL. SQL Server 2019 adds support for running Java code from T-SQL.
4+
5+
[book-click-prediction-py.sql](book-click-prediction-py.sql/)
6+
7+
**Applies to: SQL Server 2017+, SQL Server 2019, SQL Server 2019 big data cluster**
8+
9+
In this example, we are building a machine learning model using Python and a logistic regression algorithm for a recommendation engine on an online store. Based on existing users' click pattern online and their interest in other categories and demographics, we are training a machine learning model. This model will then be used to predict if the visitor is interested in a given item category using the T-SQL PREDICT function.
10+
11+
[book-click-prediction-partitioned-py.sql](book-click-prediction-partitioned-py.sql/)
12+
13+
**Applies to: SQL Server 2019, SQL Server 2019 big data cluster**
14+
15+
In this example, we are leveraging the new partitioning support (SQL Server 2019) in sp_execute_external_script to partition the input data and run the Python script per partition. So we will modify the training script to train model per group of users based on credit rating. The Python script will produce N models for the same input data set.
16+
17+
## Instructions
18+
19+
1. Connect to SQL Server or SQL Server Master instance.
20+
21+
1. Execute the SQL script.

samples/features/sql-big-data-cluster/machine-learning/sql/book-click-prediction-partitioned-py.sql renamed to samples/features/sql-big-data-cluster/machine-learning/sql/python/book-click-prediction-partitioned-py.sql

File renamed without changes.

samples/features/sql-big-data-cluster/machine-learning/sql/book-click-prediction-py.sql renamed to samples/features/sql-big-data-cluster/machine-learning/sql/python/book-click-prediction-py.sql

File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SQL Server Machine Learning Services
2+
3+
SQL Server 2016 added capability to run R script from T-SQL. SQL Server 2017 added support for running Python scripts from T-SQL. SQL Server 2019 adds support for running Java code from T-SQL.
4+
5+
[book-click-prediction-r.sql](book-click-prediction-r.sql/)
6+
7+
**Applies to: SQL Server 2016+, SQL Server 2019, SQL Server 2019 big data cluster**
8+
9+
In this example, we are building a machine learning model using R and a logistic regression algorithm for a recommendation engine on an online store. Based on existing users' click pattern online and their interest in other categories and demographics, we are training a machine learning model. This model will then be used to predict if the visitor is interested in a given item category using the T-SQL PREDICT function.
10+
11+
[book-click-prediction-partitioned-r.sql](book-click-prediction-partitioned-r.sql/)
12+
13+
**Applies to: SQL Server 2019, SQL Server 2019 big data cluster**
14+
15+
In this example, we are leveraging the new partitioning support (SQL Server 2019) in sp_execute_external_script to partition the input data and run the R script per partition. So we will modify the training script to train model per group of users based on credit rating. The R script will produce N models for the same input data set.
16+
17+
## Instructions
18+
19+
1. Connect to SQL Server or SQL Server Master instance.
20+
21+
1. Execute the SQL script.

samples/features/sql-big-data-cluster/machine-learning/sql/book-click-prediction-partitioned-r.sql renamed to samples/features/sql-big-data-cluster/machine-learning/sql/r/book-click-prediction-partitioned-r.sql

File renamed without changes.

samples/features/sql-big-data-cluster/machine-learning/sql/book-click-prediction-r.sql renamed to samples/features/sql-big-data-cluster/machine-learning/sql/r/book-click-prediction-r.sql

File renamed without changes.

0 commit comments

Comments
 (0)