Creating a custom language model to optimize NLP results
Tuesday, November 5 | 10:45 - 12:15 | Holly & Butternut
[Do this section in IBM Watson Knowledge Studio]
Open the Knowledge Studio web GUI, then create an entities and relations workspace:
- Click create an entities and relations workspace
- Assign the workspace a name and finish
Define the types of word we care about (entities) and supply some examples of those words (dictionaries).
On the Entity Types page, add the following entity types:
- action
- docs
- obj
- persona
- tech
Do not edit the Roles or Subtypes.
On the Dictionaries page:
- Download each of these dictionaries to your local computer, then upload them to Watson Knowledge Studio:
- For each dictionary, select the dictionary and associate the dictionary with the entity type of the same name
Note: You have to upload the dictionaries one at a time by selecting Upload Dictionary from the menu.
On the Documents page:
Download this document set to your local computer: customer-messages-documents.zip
Note: Uncompress the .zip file into individual .txt files on your local computer
- In Watson Knowledge Studio, click Import Document Set and then upload the 18 .txt files you downloaded in the prerequisites
- Rename the document set "Document set 1"
Note: Do not upload the .zip file itself. Upload the 18 .txt files in one upload action as a set.
On the Pre-annotation page (under the Machine Learning Model menu item):
- Click Apply This Pre-annotator
- When prompted, select "Document set 1" and then click Run
On the Performance page:
- Select all documents, and then click Train and evaluate
On the Versions page:
- Click Create version
- Deploy the snapshot version you just created to your IBM Watson Natural Language Understanding service instance
Note: If you cannot find your NLU service instance in Spaces try looking in Resource groups.
[Do this section in IBM Watson Studio]
Create a project in Watson Studio from the sample project.
-
Download this sample project to your local computer:
CASCON-2019-NLP-Workshop-2-Tuesday.zip -
In Watson Studio, create a new project "from a sample or file":
- Upload the sample project .zip file
- Give the project a name
- If you don't already have Cloud Object Storage set up, follow the prompts to create an instance of Cloud Object Storage for the project
- Click Create
Demo video
Create project from sample
Analyze customer questions and comments a notebook.
-
On the Assets page of your project, open the notebook named "3-Custom-language-model" in edit mode by clicking the pencil ( ) beside the notebook
-
Add the NLU service apikey:
- From the Services menu in Watson Studio, right-click "Watson Services" and then open the link in a new browser tab
- In the new Watson services tab, from the Action menu beside the Natural Language Understanding instance, select "Manage in IBM Cloud"
- In the service details page that opens, click Service credentials, then expand credentials to view them, and then copy the apikey
-
Specify the custom model ID:
- On the Versions page in your Knowledge Studio workspace, expand the Deployed Models list
- Copy the Model ID
-
Run the
code
cells in the notebook in order, starting at the top.- Import sample customer messages
- Analyze sample customer messages: default model & custom model
Normalize results.
-
On the Assets page of your project, open the notebook named "4-Normalize-custom-model-results" in edit mode by clicking the pencil ( ) beside the notebook
-
Run the
code
cells in the notebook in order, starting at the top.
Visualize normalized results.
-
On the Assets page of your project, open the notebook named "5-Visualize-custom-model-results" in edit mode by clicking the pencil ( ) beside the notebook
-
Run the
code
cells in the notebook in order, starting at the top.
Cluster messages using extracted entities.
-
On the Assets page of your project, open the notebook named "5-Visualize-custom-model-results" in edit mode by clicking the pencil ( ) beside the notebook
-
Run the
code
cells in the notebook in order, starting at the top.