This quickstart shows you how to use AutoML Natural Language Entity Extraction to
create a custom machine learning model for identifying entities in text content.
It trains a custom model using a corpus of biomedical research abstracts that mention hundreds
of diseases and concepts. The resulting model identifies these medical entities
in further texts. The sample training data is hosted in a public Google Cloud Storage
This dataset is in the public domain as a "United States Government Work" under the terms of the United States Copyright Act.
Set up your project
Before you can use AutoML Natural Language Entity Extraction, you must create a Google Cloud project and enable AutoML Natural Language Entity Extraction for that project.
Sign in to your Google Account.
If you don't already have one, sign up for a new account.
In the GCP Console, go to the Manage resources page and select or create a project.
Make sure that billing is enabled for your Google Cloud Platform project.
- Enable the Cloud AutoML and Storage APIs.
Create a dataset
Open the AutoML Natural Language Entity Extraction UI and select your project from the drop-down list in the title bar.
Click the New Dataset button in the title bar.
On the Create dataset page, enter a name for the dataset then click Create dataset.
Enter the location of the training data to import.
In the Select a CSV file on Cloud Storage text box, enter the path for the sample CSV file:
gs://prefix is added automatically.) Alternatively, you can click Browse and navigate to the CSV file.
This quickstart uses sample data staged in a public Google Cloud Storage bucket. The training data is JSONL files that contain sample text documents annotated with the location of the entities you want the model to learn to extract. To import the training data into the dataset, you use a CSV file that points to the JSONL files; see Preparing your training data for information about the format.
You're returned to the Datasets page; your dataset will show a Status of
Running:importing datawhile your documents are being imported. This process should take just a few minutes.
When your training data has been successfully imported, the Status column
Success:importing data and the UI shows the generated ID for the
dataset (used when making AutoML API calls) as well as the number of items imported.
Train your model
From the Datasets listing page, click the dataset name.
Click Start Training.
Enter a name for your custom model or accept the default name.
Click the 'Deploy model after training finishes' check box to deploy your model automatically when training is complete.
Click Start Training.
Training a model can take several hours to complete. Typical training time using the example dataset is about three hours. After the model is successfully trained, you will receive a message at the email address you used to sign up for the program.
Evaluate the custom model
After training a model, AutoML Natural Language Entity Extraction evaluates the quality and accuracy of the new model. To see the evaluation metrics for your model:
Open the AutoML Natural Language Entity Extraction UI and click the Models tab (with lightbulb icon) in the left navigation bar.
Click the name of the model you want to evaluate.
If necessary, click the Evaluate tab just below the title bar.
If training has been completed for the model, AutoML Natural Language Entity Extraction shows its evaluation metrics. It provides precision and recall scores for the model as a whole and for each extracted entity (referred to as a label in the UI). To see the metrics for a particular entity, choose the entity from the filter list of labels.
Precision and recall measure how well the model is capturing information, and how much it's leaving out. Precision indicates, from all the items identified as a particular entity, how many actually were correctly identified. Recall indicates, from all the items that should have been identified as a particular entity, how many were actually identified.
Use this data to evaluate your model's readiness. Low precision or recall scores can indicate that your model needs additional training data. Perfect precision and recall can indicate that the data is too easy and may not generalize well.
Use the custom model
After your model has been successfully trained, you can use it to extract entities using your custom model. Click the Test and Use tab, enter text into the text box, and click Predict. AutoML Natural Language Entity Extraction analyzes the text using your model and displays the annotations.
To avoid unnecessary Google Cloud Platform charges, use the GCP Console to delete your project if you do not need it.