Skip to content

Commit

Permalink
fabric doc edit
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaXYWang committed Apr 9, 2024
1 parent 2204a56 commit d17fef5
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 101 deletions.
22 changes: 11 additions & 11 deletions docs/Explore Algorithms/AI Services/Overview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Azure AI services](https://azure.microsoft.com/services/ai-services/) is a suite of APIs, SDKs, and services that developers can use to add intelligent features to their applications. AI services empower developers even when they don't have direct AI or data science skills or knowledge. Azure AI services help developers create applications that can see, hear, speak, understand, and even begin to reason. The catalog of services within Azure AI services can be categorized into five main pillars: Vision, Speech, Language, Web search, and Decision.\n",
"[Azure AI services](https://azure.microsoft.com/products/ai-services/) is a suite of APIs, SDKs, and services that developers can use to add intelligent features to their applications. AI services empower developers even when they don't have direct AI or data science skills or knowledge. Azure AI services help developers create applications that can see, hear, speak, understand, and even begin to reason. The catalog of services within Azure AI services can be categorized into five main pillars: Vision, Speech, Language, Web search, and Decision.\n",
"\n",
"## Usage\n",
"\n",
Expand Down Expand Up @@ -79,8 +79,8 @@
"- Dictionary Examples: Provides examples that show how terms in the dictionary are used in context. ([Scala](https://mmlspark.blob.core.windows.net/docs/1.0.3/scala/com/microsoft/azure/synapse/ml/services/translate/DictionaryExamples.html), [Python](https://mmlspark.blob.core.windows.net/docs/1.0.3/pyspark/synapse.ml.services.translate.html#module-synapse.ml.services.translate.DictionaryExamples))\n",
"- Document Translation: Translates documents across all supported languages and dialects while preserving document structure and data format. ([Scala](https://mmlspark.blob.core.windows.net/docs/1.0.3/scala/com/microsoft/azure/synapse/ml/services/translate/DocumentTranslator.html), [Python](https://mmlspark.blob.core.windows.net/docs/1.0.3/pyspark/synapse.ml.services.translate.html#module-synapse.ml.services.translate.DocumentTranslator))\n",
"\n",
"### Form Recognizer\n",
"[**Form Recognizer**](https://azure.microsoft.com/services/form-recognizer/)\n",
"### Document Intelligence\n",
"[**Document Intelligence**](https://azure.microsoft.com/products/ai-services/ai-document-intelligence/)\n",
"- Analyze Layout: Extract text and layout information from a given document. ([Scala](https://mmlspark.blob.core.windows.net/docs/1.0.3/scala/com/microsoft/azure/synapse/ml/services/form/AnalyzeLayout.html), [Python](https://mmlspark.blob.core.windows.net/docs/1.0.3/pyspark/synapse.ml.services.form.html#module-synapse.ml.services.form.AnalyzeLayout))\n",
"- Analyze Receipts: Detects and extracts data from receipts using optical character recognition (OCR) and our receipt model, enabling you to easily extract structured data from receipts such as merchant name, merchant phone number, transaction date, transaction total, and more. ([Scala](https://mmlspark.blob.core.windows.net/docs/1.0.3/scala/com/microsoft/azure/synapse/ml/services/form/AnalyzeReceipts.html), [Python](https://mmlspark.blob.core.windows.net/docs/1.0.3/pyspark/synapse.ml.services.form.html#module-synapse.ml.services.form.AnalyzeReceipts))\n",
"- Analyze Business Cards: Detects and extracts data from business cards using optical character recognition (OCR) and our business card model, enabling you to easily extract structured data from business cards such as contact names, company names, phone numbers, emails, and more. ([Scala](https://mmlspark.blob.core.windows.net/docs/1.0.3/scala/com/microsoft/azure/synapse/ml/services/form/AnalyzeBusinessCards.html), [Python](https://mmlspark.blob.core.windows.net/docs/1.0.3/pyspark/synapse.ml.services.form.html#module-synapse.ml.services.form.AnalyzeBusinessCards))\n",
Expand Down Expand Up @@ -146,7 +146,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Import Azure AI services libraries and replace the keys in the following code snippet with your Azure AI services key."
"Import Azure AI services libraries and replace the keys and locations in the following code snippet with your Azure AI services key and location."
]
},
{
Expand All @@ -158,7 +158,7 @@
"from synapse.ml.services import *\n",
"from synapse.ml.core.platform import *\n",
"\n",
"# A general AI services key for Text Analytics, Computer Vision and Form Recognizer (or use separate keys that belong to each service)\n",
"# A general AI services key for AI Language, Computer Vision and Document Intelligence (or use separate keys that belong to each service)\n",
"service_key = find_secret(\n",
" secret_name=\"ai-services-api-key\", keyvault=\"mmlspark-build-keys\"\n",
") # Replace the call to find_secret with your key as a python string. e.g. service_key=\"27snaiw...\"\n",
Expand Down Expand Up @@ -323,7 +323,7 @@
"metadata": {},
"source": [
"## Extract information from a document into structured data\n",
"[Form Recognizer](https://azure.microsoft.com/services/form-recognizer/) is a part of Azure Applied AI Services that lets you build automated data processing software using machine learning technology. With Form Recognizer, you can identify and extract text, key/value pairs, selection marks, tables, and structure from your documents. The service outputs structured data that includes the relationships in the original file, bounding boxes, confidence and more.\n",
"[Azure AI Document Intelligence](https://azure.microsoft.com/products/ai-services/ai-document-intelligence/) is a part of Azure Applied AI Services that lets you build automated data processing software using machine learning technology. With Azure AI Document Intelligence, you can identify and extract text, key/value pairs, selection marks, tables, and structure from your documents. The service outputs structured data that includes the relationships in the original file, bounding boxes, confidence and more.\n",
"\n",
"The following code sample analyzes a business card image and extracts its information into structured data."
]
Expand Down Expand Up @@ -376,7 +376,7 @@
"\n",
"[Azure AI Vision](https://azure.microsoft.com/products/ai-services/ai-vision/) analyzes images to identify structure such as faces, objects, and natural-language descriptions.\n",
"\n",
"The following code sample analyzes images and labels them with tags. Tags are one-word descriptions of things in the image, such as recognizable objects, people, scenery, and actions."
"The following code sample analyzes images and labels them with *tags*. Tags are one-word descriptions of things in the image, such as recognizable objects, people, scenery, and actions."
]
},
{
Expand Down Expand Up @@ -420,9 +420,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bing Image Search sample\n",
"## Search for images that are related to a natural language query\n",
"\n",
"[Bing Image Search](https://www.microsoft.com/bing/apis/bing-image-search-api) searches the web to retrieve images related to a user's natural language query.\n",
"[Bing Image Search](https://www.microsoft.com/bing/apis/bing-image-search-api) searches the web to retrieve images related to a user's natural language query. \n",
"\n",
"The following code sample uses a text query that looks for images with quotes. The output of the code is a list of image URLs that contain photos related to the query."
]
Expand Down Expand Up @@ -503,8 +503,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Text-to-Speech sample\n",
"[Text to speech](https://azure.microsoft.com/products/ai-services/text-to-speech/) is a service that allows you to build applications that speak naturally. You can choose from more than 270 neural voices across 119 languages.\n",
"## Transform text to speech\n",
"[Text to speech](https://azure.microsoft.com/products/ai-services/text-to-speech/) is a service that allows you to build apps and services that speak naturally, choosing from more than 270 neural voices across 119 languages and variants.\n",
"\n",
"The following code sample transforms text into an audio file that contains the content of the text."
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
"source": [
"## Classify using SynapseML\n",
"\n",
"The pipeline can be simplified by using SynapseML:\n",
"The steps needed with `synapseml` are simpler:\n",
"\n",
"1. The **`TrainClassifier`** Estimator featurizes the data internally,\n",
" as long as the columns selected in the `train`, `test`, `validation`\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"# ONNX Inference on Spark\n",
"\n",
Expand All @@ -11,36 +14,36 @@
"\n",
"- `onnxmltools==1.7.0`\n",
"- `lightgbm==3.2.1`\n"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"## Load the example data\n",
"\n",
"To load the example data, add the following code examples to cells in your notebook and then run the cells:"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%pip install lightgbm onnxmltools==1.7.0"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"df = (\n",
Expand All @@ -53,13 +56,13 @@
")\n",
"\n",
"display(df)"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"The output should look similar to the following table, though the values and number of rows may differ:\n",
"\n",
Expand All @@ -68,23 +71,23 @@
"| 0.5641 | 1.0 | 0.0165 |\n",
"| 0.5702 | 1.0 | 0.0208 |\n",
"| 0.5673 | 1.0 | 0.0165 |"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"source": [
"## Use LightGBM to train a model"
],
"metadata": {
"collapsed": false
}
},
"source": [
"## Use LightGBM to train a model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from pyspark.ml.feature import VectorAssembler\n",
Expand Down Expand Up @@ -114,35 +117,32 @@
")\n",
"\n",
"model = model.fit(train_data)"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"## Convert the model to ONNX format\n",
"\n",
"The following code exports the trained model to a LightGBM booster and then converts it to ONNX format:"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from synapse.ml.core.platform import running_on_binder\n",
"\n",
"if running_on_binder():\n",
" from IPython import get_ipython"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -221,7 +221,7 @@
"source": [
"## Use the model for inference\n",
"\n",
"To perform inference with the model, the following code creates testing data and transforms the data through the ONNX model."
"To perform inference with the model, the following code creates test data and transforms the data through the ONNX model."
]
},
{
Expand Down
Loading

0 comments on commit d17fef5

Please sign in to comment.