Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bluemix NL Classifier Tutorial

13,402 views

Published on

Configuring the IBM Bluemix Natural Language Classifier on Question Types

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Bluemix NL Classifier Tutorial

  1. 1. Configuring the Classifier on IBM Bluemix craigtrim@gmail.com
  2. 2. QUESTION TYPE CLASSIFICATION DATA PREPARATION ... Part 1
  3. 3. 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
  4. 4. 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
  5. 5. Python script to take CSV formatted data from Excel Spreadsheet Creates a CSV file that the NL Classifier can understand Classification
  6. 6. DEPLOYING TO BLUEMIX IN 5 SIMPLE STEPS ... Part 2
  7. 7. Step 1: Access the Service (Slide 1) IBM Bluemix Homepage
  8. 8. Step 1: Access the Service (Slide 2) IBM Bluemix Homepage
  9. 9. Step 1: Access the Service (Slide 3)
  10. 10. Step 1: Access the Service (Slide 4)
  11. 11. Step 1: Access the Service (Slide 5)
  12. 12. Step 1: Access the Service (Slide 6)
  13. 13. Step 2: Add the Service (Slide 1)
  14. 14. Step 3: Access the Toolkit (Slide 1)
  15. 15. Step 3: Access the Toolkit (Slide 2)
  16. 16. Step 4: Deploy to Bluemix (Slide 1)
  17. 17. Step 4: Deploy to Bluemix (Slide 2)
  18. 18. Step 4: Deploy to Bluemix (Slide 3)
  19. 19. Step 5: View the App (Slide 1)
  20. 20. Step 5: View the App (Slide 2)
  21. 21. Step 5: View the App (Slide 3)
  22. 22. Step 5: View the App (Slide 3)
  23. 23. Step 5: View the App (Slide 4)
  24. 24. Step 5: View the App (Slide 5)
  25. 25. TRAINING A CLASSIFIER IN 5 SIMPLE STEPS ... Part 3
  26. 26. Step 1: Train a Classifier (Slide 1)
  27. 27. Step 1: Train a Classifier (Slide 2)
  28. 28. Step 2: Prepare the Data (Slide 1)
  29. 29. 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 Example what 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)
  30. 30. Step 3: Import the Data (Slide 1)
  31. 31. Step 4: Train the Classifier (Slide 1)
  32. 32. Step 4: Train the Classifier (Slide 2)
  33. 33. Step 4: Train the Classifier (Slide 3)
  34. 34. Step 5: Use the Classifier (Slide 1)
  35. 35. Step 5: Use the Classifier (Slide 3)
  36. 36. Step 5: Use the Classifier (Slide 4)
  37. 37. Step 5: Use the Classifier (Slide 4)
  38. 38. Step 5: Use the Classifier (Slide 4)
  39. 39. ACCESSIBILITY ACCESS AND GET/POST Part 4
  40. 40. Optional: Rename the Service (Slide 1)
  41. 41. Optional: Add another Route (Slide 1)
  42. 42. Optional: Add another Route (Slide 2)
  43. 43. @RequestMapping( value="/classify", params="text", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) @ResponseBody public 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>

×