【问题标题】:How to use Azure ML-created labels to train custom models in Cognitive Services for Language?How to use Azure ML-created labels to train custom models in Cognitive Services for Language?
【发布时间】:2022-12-27 21:08:29
【问题描述】:

For a project I would like to use the labeling environment from Azure Machine Learning to label named entities and classifications. I want to use these labels to train a custom NER and custom text classification model using Azure Cognitive Service for Language. The reason why I want to use the labeling environment in Azure ML, rather than the labeling tool of Azure Cognitive Services for Language itself is because especially the text classification labeling is a lot more convenient in Azure ML.

From what I read in the documentation Azure ML exports these labels to an "Azure Machine Learning dataset (v1) with labels", CSV file (in the case of text classification labels) or a CoNLL file (in the case of NER labels). However, to train a custom NER or text classification model in Azure Cognitive Services for Language I can only import labeled data as a json file in this format for text classification and this format for NER. Is there any way to export the labels from Azure Machine Learning as a json file? If not, does anyone know how to convert the Azure Machine Learning dataset to a json file?

Thank you!

【问题讨论】:

    标签: azure nlp azure-cognitive-services azure-machine-learning-studio


    【解决方案1】:

    Using the Execute Python Script or Execute R Script modules, we may import data from JSON. The Execute R Script module will be used in. Execute R Script Module will be used. In Azure ML Studio, this module is used to run R script codes. There are three input parameters for the Execute R Script module. These are Script Bundle, Dataset1, and Dataset2. You can import data into the Execute R Script module with the aid of the Dataset1 and Dataset2 inputs. A zip file that contains many file kinds can be used with the Script Bundle port. To load JSON, we'll make advantage of this Script Bundle port.

    We'll walk through importing a compressed JSON file into Azure ML. Consider the scenario where we want to use a JSON data file as a dataset for Azure ML. You must compact this JSON file after downloading the sample JSON data from JSONPlaceholder.

    Select Dataset tab in Azure ML Studio and click (+) New at Bottom side.

    Select FROM LOCAL FILE Choose the SELECT A TYPE FOR THE NEW DATASET as a Zip File option and the path to the zipped JSON file.

    You will receive news that the dataset upload for "SampeJSONData.zip" has been completed and the SampleJSONData file will appear on the MY DATASETS page.

    Select Experiments tab and click (+) NEW.

    Select any Blank Experiment option and then create a new experiment. Locate SampleJSONData.zip and then drag it to the design panel.

    Drag and drop Execute R Script Module. Connect the Execute R Script Module Script Bundle port to the SampeJSONData.zip output.

    Paste this query in Rscript box.

    library(jsonlite)
    myjsondata <-   fromJSON("src/posts.txt")
    maml.mapOutputPort ("myjsondata");
    

    Run the experiment then right click Result Dataset port of Execute R Script module and select Visualize

    We extracted the JSON data from the zip file and transformed it into a format that could be used in Azure ML experiments. Any website can now provide JSON data to us.

    Actually, The prior demonstration and this choice are quite similar. Only the source of the JSON data file is altered with this option. Previously, we had a zip file, but for this example, we'll use JSON data on a website. Modify the R script module code:

    library(jsonlite)
    myjsondata  <-  fromJSON("https://jsonplaceholder.typicode.com/posts ")
    maml.mapOutputPort("myjsondata");
    

    Run

    When you visualize the Result Dataset of R script module you can see it getting the JSONPlaceholder posts JSON data. In the below image we can see the compare of JSON form and visualization form.

    【讨论】:

      猜你喜欢
      • 2022-12-01
      • 2022-12-27
      • 2022-12-01
      • 2022-12-19
      • 2022-12-27
      • 2022-12-02
      • 1970-01-01
      • 2022-12-27
      • 2022-12-28
      相关资源
      最近更新 更多