+ All Categories
Home > Engineering > Bluemix NL Classifier Tutorial

Bluemix NL Classifier Tutorial

Date post: 08-Jan-2017
Category:
Upload: craig-trim
View: 12,823 times
Download: 4 times
Share this document with a friend
43
Configuring the Classifier on IBM Bluemix [email protected]
Transcript
Page 1: Bluemix NL Classifier Tutorial

Configuring the Classifieron IBM Bluemix

[email protected]

Page 2: Bluemix NL Classifier Tutorial

QUESTION TYPE CLASSIFICATIONDATA PREPARATION ...

Part 1

Page 3: Bluemix NL Classifier Tutorial

1. Verification: invites a yes or no answer.

2. Disjunctive: Is X, Y, or Z the case?

3. Concept completion: Who? What? When? Where?

4. Example: What is an example of X?

5. Feature specification: What are the properties of X?

6. Quantification: How much? How many?

7. Definition: What does X mean?8. Comparison: How is X similar to Y?

9. Interpretation: What is the significance of X?

10. Causal antecedent: Why/how did X occur?

11. Causal consequence: What next? What if?

12. Goal orientation: Why did an agent do X?

13. Instrumental/procedural: How did an agent do X?

14. Enablement: What enabled X to occur?

15. Expectation: Why didn't X occur?

16. Judgmental: What do you think of X?

Questions are often generated by a person's knowledge deficits and cognitive disequilibrium, which occurs when there are obstacles to goals, contradictions, impasses during problem solving, anomalous information, and uncertainty.

Question Types

Page 4: Bluemix NL Classifier Tutorial

A total of 5 points are distributed for each question

Questions are gathered from public domain sources off the internet

Point distribution is manual

Classification

Page 5: Bluemix NL Classifier Tutorial

Python script to take CSV formatted data from Excel Spreadsheet

Creates a CSV file that the NL Classifier can understand

Classification

Page 6: Bluemix NL Classifier Tutorial

DEPLOYING TO BLUEMIXIN 5 SIMPLE STEPS ...

Part 2

Page 7: Bluemix NL Classifier Tutorial

Step 1: Access the Service (Slide 1)

IBM Bluemix Homepage

Page 8: Bluemix NL Classifier Tutorial

Step 1: Access the Service (Slide 2)

IBM Bluemix Homepage

Page 9: Bluemix NL Classifier Tutorial

Step 1: Access the Service (Slide 3)

Page 10: Bluemix NL Classifier Tutorial

Step 1: Access the Service (Slide 4)

Page 11: Bluemix NL Classifier Tutorial

Step 1: Access the Service (Slide 5)

Page 12: Bluemix NL Classifier Tutorial

Step 1: Access the Service (Slide 6)

Page 13: Bluemix NL Classifier Tutorial

Step 2: Add the Service (Slide 1)

Page 14: Bluemix NL Classifier Tutorial

Step 3: Access the Toolkit (Slide 1)

Page 15: Bluemix NL Classifier Tutorial

Step 3: Access the Toolkit (Slide 2)

Page 16: Bluemix NL Classifier Tutorial

Step 4: Deploy to Bluemix (Slide 1)

Page 17: Bluemix NL Classifier Tutorial

Step 4: Deploy to Bluemix (Slide 2)

Page 18: Bluemix NL Classifier Tutorial

Step 4: Deploy to Bluemix (Slide 3)

Page 19: Bluemix NL Classifier Tutorial

Step 5: View the App (Slide 1)

Page 20: Bluemix NL Classifier Tutorial

Step 5: View the App (Slide 2)

Page 21: Bluemix NL Classifier Tutorial

Step 5: View the App (Slide 3)

Page 22: Bluemix NL Classifier Tutorial

Step 5: View the App (Slide 3)

Page 23: Bluemix NL Classifier Tutorial

Step 5: View the App (Slide 4)

Page 24: Bluemix NL Classifier Tutorial

Step 5: View the App (Slide 5)

Page 25: Bluemix NL Classifier Tutorial

TRAINING A CLASSIFIERIN 5 SIMPLE STEPS ...

Part 3

Page 26: Bluemix NL Classifier Tutorial

Step 1: Train a Classifier (Slide 1)

Page 27: Bluemix NL Classifier Tutorial

Step 1: Train a Classifier (Slide 2)

Page 28: Bluemix NL Classifier Tutorial

Step 2: Prepare the Data (Slide 1)

Page 29: Bluemix NL Classifier Tutorial

Format• The data format is:

text,class

• The text is the actual question or user statement; some real world example

• The class is the classification of this real world example– Only [A-Za-z0-9] are permitted– Use “myClassName” rather than

“my_class_name”• The text and the class are comma

separated, with the text occurring first

Examplewhat is the difference between being alive and truly living?,comparison"when is it time to stop calculating risk and rewards and just go ahead and do what you know is right?”,conceptCompletion"when is it time to stop calculating risk and rewards and just go ahead and do what you know is right?”,interpretation"if we learn from our mistakes why are we always so afraid to make a mistake?”,enablement

Step 2: Prepare the Data (Slide 2)

Page 30: Bluemix NL Classifier Tutorial

Step 3: Import the Data (Slide 1)

Page 31: Bluemix NL Classifier Tutorial

Step 4: Train the Classifier (Slide 1)

Page 32: Bluemix NL Classifier Tutorial

Step 4: Train the Classifier (Slide 2)

Page 33: Bluemix NL Classifier Tutorial

Step 4: Train the Classifier (Slide 3)

Page 34: Bluemix NL Classifier Tutorial

Step 5: Use the Classifier (Slide 1)

Page 35: Bluemix NL Classifier Tutorial

Step 5: Use the Classifier (Slide 3)

Page 36: Bluemix NL Classifier Tutorial

Step 5: Use the Classifier (Slide 4)

Page 37: Bluemix NL Classifier Tutorial

Step 5: Use the Classifier (Slide 4)

Page 38: Bluemix NL Classifier Tutorial

Step 5: Use the Classifier (Slide 4)

Page 39: Bluemix NL Classifier Tutorial

ACCESSIBILITYACCESS AND GET/POST

Part 4

Page 40: Bluemix NL Classifier Tutorial

Optional: Rename the Service (Slide 1)

Page 41: Bluemix NL Classifier Tutorial

Optional: Add another Route (Slide 1)

Page 42: Bluemix NL Classifier Tutorial

Optional: Add another Route (Slide 2)

Page 43: Bluemix NL Classifier Tutorial

@RequestMapping(value="/classify",params="text", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)

@ResponseBodypublic String classify(

@RequestParam("text") String text) {

NaturalLanguageClassifier classifierService = new NaturalLanguageClassifier();classifierService.setUsernameAndPassword(username, password);

Classification classification = classifierService.classify(route, text);ObjectMapper mapper = new ObjectMapper();

try{return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(classification);} catch(JsonProcessingException e){logger.error(e);}

}

Optional: Java Code(Slide 1)

<dependency> <groupId>com.ibm.watson.developer_cloud</groupId> <artifactId>java-wrapper</artifactId> <version>1.1.0</version></dependency>


Recommended