diff --git a/samples/features/sql-big-data-cluster/app-deploy/mleap/README.md b/samples/features/sql-big-data-cluster/app-deploy/mleap/README.md index cd4f815d..1884e61c 100644 --- a/samples/features/sql-big-data-cluster/app-deploy/mleap/README.md +++ b/samples/features/sql-big-data-cluster/app-deploy/mleap/README.md @@ -43,23 +43,23 @@ To run this sample, you need the following prerequisites. ```bash mssqlctl login -e https://:30777 -u -p ``` -3. This example uses a Machine Learning Model that predicts the price per square foot of an Airbnb property based on various parameters such as the location and type of dwelling. [More details and information on the example are here](http://mleap-docs.combust.ml/mleap-serving/#load-model). The application you will be deploying as part of this sample is a Random Forest Model that was built in Spark and has been serialized as an MLeap bundle. +3. This example uses a TensorFlow Machine Learning Model that uses public US Census data predict income. [More details and information on the example are here](https://docs.microsoft.com/en-us/sql/big-data-cluster/train-and-create-machinelearning-models-with-spark?view=sqlallproducts-allversions). The application you will be deploying as part of this sample is a Random Forest Model that was built in Spark and has been [serialized as an MLeap bundle](https://docs.microsoft.com/en-us/sql/big-data-cluster/export-model-with-spark-mleap?view=sqlallproducts-allversions). Deploy the app using the `create` command and pass the location of the spec file. In the example below, the spec file is expected to be in the `mleap` folder: ```bash - mssqlctl app create --spec ./mleap + mssqlctl app create --spec ./mleap/ ``` -4. Check the deployment by running the following command: +1. Check the deployment by running the following command: ```bash - mssqlctl app list -n mleap -v [version] + mssqlctl app list -n mleap-census -v [version] ``` Once the app is listed as `Ready` you can continue to the next step. -5. Now that the app has been deployed you can test if the app works correctly by passing in a sample input that is available in the mleap folder. The deployed app is a RESTful webservice that is [Swagger](swagger.io) compliant. For this sample we will show you how you can test this using the CLI. +2. Now that the app has been deployed you can test if the app works correctly by passing in a sample input that is available in the `mleap` folder. The deployed app is a RESTful webservice that is [Swagger](swagger.io) compliant. For this sample we will show you how you can test this using the CLI. - To test the app, run the command below. The input parameter is a `LeapFrame`, a `json` file that describes the parameters and the values provided to the model for predicting the cost per square feet. Note that the input parameter has a special character '@' to indicate that a `json` file is being passed. This command needs to be run within the `mleap` folder. + To test the app, run the command below. The input parameter is a `MLeapFrame`, a `json` file that describes the parameters and the values provided to the model for predicting the cost per square feet. Note that the input parameter has a special character '@' to indicate that a `json` file is being passed. This command needs to be run within the `mleap` folder. ```bash - mssqlctl app run --name mleap --version [version] --input mleap-frame=@frame.json + mssqlctl app run --name mleap-census --version [version] --input schema=@census_frame.json ``` The result will be a json output that includes the prediction along with additional data, including the predicted price per square feet. @@ -69,7 +69,7 @@ To run this sample, you need the following prerequisites. 6. You can clean up the sample by running the following commands: ```bash # delete app - mssqlctl app delete --name mleap --version [version] + mssqlctl app delete --name mleap-census --version [version] ``` @@ -82,10 +82,10 @@ The spec file serves as the data required for deploying the app and it contains Here is the spec file for this application: ```yaml -name: mleap +name: mleap-census version: v1 runtime: Mleap -bundleFileName: model.lr.zip +bundleFileName: census_bundle.zip replicas: 2 poolsize: 2 ``` diff --git a/samples/features/sql-big-data-cluster/app-deploy/mleap/census_frame.json b/samples/features/sql-big-data-cluster/app-deploy/mleap/census_frame.json new file mode 100644 index 00000000..4f39529f --- /dev/null +++ b/samples/features/sql-big-data-cluster/app-deploy/mleap/census_frame.json @@ -0,0 +1,35 @@ +{ + "rows": [ + [ + 17, + 4, + "<=50K" + ], + [ + 17, + 5, + "<=50K" + ], + [ + 17, + 5, + "<=50K" + ] + ], + "schema": { + "fields": [ + { + "name": "age", + "type": "integer" + }, + { + "name": "hours_per_week", + "type": "integer" + }, + { + "name": "income", + "type": "string" + } + ] + } +} diff --git a/samples/features/sql-big-data-cluster/app-deploy/mleap/frame.json b/samples/features/sql-big-data-cluster/app-deploy/mleap/frame.json deleted file mode 100644 index 3accc051..00000000 --- a/samples/features/sql-big-data-cluster/app-deploy/mleap/frame.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "schema": { - "fields": [{ - "name": "state", - "type": "string" - }, { - "name": "bathrooms", - "type": "double" - }, { - "name": "square_feet", - "type": "double" - }, { - "name": "bedrooms", - "type": "double" - }, { - "name": "security_deposit", - "type": "double" - }, { - "name": "cleaning_fee", - "type": "double" - }, { - "name": "extra_people", - "type": "double" - }, { - "name": "number_of_reviews", - "type": "double" - }, { - "name": "review_scores_rating", - "type": "double" - }, { - "name": "room_type", - "type": "string" - }, { - "name": "host_is_superhost", - "type": "string" - }, { - "name": "cancellation_policy", - "type": "string" - }, { - "name": "instant_bookable", - "type": "string" - }] - }, - "rows": [["NY", 2.0, 1250.0, 3.0, 50.0, 30.0, 2.0, 56.0, 90.0, "Entire home/apt", "1.0", "strict", "1.0"]] -} diff --git a/samples/features/sql-big-data-cluster/app-deploy/mleap/model.lr.zip b/samples/features/sql-big-data-cluster/app-deploy/mleap/model.lr.zip deleted file mode 100644 index 2141e159..00000000 Binary files a/samples/features/sql-big-data-cluster/app-deploy/mleap/model.lr.zip and /dev/null differ diff --git a/samples/features/sql-big-data-cluster/app-deploy/mleap/run-spec.yaml b/samples/features/sql-big-data-cluster/app-deploy/mleap/run-spec.yaml index 0aefeec4..a5780250 100644 --- a/samples/features/sql-big-data-cluster/app-deploy/mleap/run-spec.yaml +++ b/samples/features/sql-big-data-cluster/app-deploy/mleap/run-spec.yaml @@ -1,3 +1,3 @@ -name: mleap +name: mleap-census version: v1 -inputs: ./frame.json \ No newline at end of file +inputs: ./census_frame.json \ No newline at end of file diff --git a/samples/features/sql-big-data-cluster/app-deploy/mleap/spec.yaml b/samples/features/sql-big-data-cluster/app-deploy/mleap/spec.yaml index f11bcf1c..1823fea1 100644 --- a/samples/features/sql-big-data-cluster/app-deploy/mleap/spec.yaml +++ b/samples/features/sql-big-data-cluster/app-deploy/mleap/spec.yaml @@ -1,6 +1,5 @@ -name: mleap +name: mleap-census version: v1 runtime: Mleap -bundleFileName: model.lr.zip -replicas: 2 -poolsize: 2 +bundleFileName: census_bundle.zip +replicas: 1