Congratulations!

[Valid RSS] This is a valid RSS feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://sodoherty.com/feed/

  1. <?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
  2. xmlns:content="http://purl.org/rss/1.0/modules/content/"
  3. xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  4. xmlns:dc="http://purl.org/dc/elements/1.1/"
  5. xmlns:atom="http://www.w3.org/2005/Atom"
  6. xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  7. xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  8. xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
  9. >
  10.  
  11. <channel>
  12. <title>Talk to me</title>
  13. <atom:link href="https://sodoherty.ai/feed/" rel="self" type="application/rss+xml" />
  14. <link>https://sodoherty.ai</link>
  15. <description>A blog about Chat bots (mainly Watson), and life in general.</description>
  16. <lastBuildDate>Sat, 15 Jul 2017 09:30:22 +0000</lastBuildDate>
  17. <language>en</language>
  18. <sy:updatePeriod>hourly</sy:updatePeriod>
  19. <sy:updateFrequency>1</sy:updateFrequency>
  20. <generator>http://wordpress.com/</generator>
  21. <cloud domain='sodoherty.ai' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
  22. <image>
  23. <url>https://s2.wp.com/i/buttonw-com.png</url>
  24. <title>Talk to me</title>
  25. <link>https://sodoherty.ai</link>
  26. </image>
  27. <atom:link rel="search" type="application/opensearchdescription+xml" href="https://sodoherty.ai/osd.xml" title="Talk to me" />
  28. <atom:link rel='hub' href='https://sodoherty.ai/?pushpress=hub'/>
  29. <item>
  30. <title>Anaphora? I hardly knew her.</title>
  31. <link>https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/</link>
  32. <comments>https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/#respond</comments>
  33. <pubDate>Sat, 15 Jul 2017 06:21:45 +0000</pubDate>
  34. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  35. <category><![CDATA[tips]]></category>
  36. <category><![CDATA[watson-conversation]]></category>
  37.  
  38. <guid isPermaLink="false">http://sodoherty.ai/?p=1929</guid>
  39. <description><![CDATA[One of common requests for conversation is being able to understand the running topic of a conversation. For example: USER: Can I feed my goldfish peas? WATSON: Goldfish love peas, but make sure to remove the shells! USER: Should I boil them first? The second response &#8220;them&#8221; is called an &#8220;anaphora&#8221;. The &#8220;them&#8221; refers to the [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1929&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  40. <content:encoded><![CDATA[<p><span id="selectionBoundary_1498076682606_46799825361031044" class="rangySelectionBoundary" style="line-height:0;display:none;"></span>One of common requests for conversation is being able to understand the running topic of a conversation.</p>
  41. <p>For example:</p>
  42. <blockquote>
  43. <p style="text-align:left;"><strong>USER</strong>: Can I feed my goldfish peas?</p>
  44. <p style="text-align:left;"><strong>WATSON: </strong>Goldfish love peas, but make sure to remove the shells!</p>
  45. <p style="text-align:left;"><strong>USER</strong>: Should I boil them first?</p>
  46. </blockquote>
  47. <p>The second response &#8220;them&#8221; is called an &#8220;anaphora&#8221;. The &#8220;them&#8221; refers to the peas. So you can&#8217;t answer the question without first knowing the previous question.</p>
  48. <p>On the face of it, it looks easy. But you have &#8220;goldfish&#8221;, &#8216;peas&#8221;, &#8216;shells&#8221; which could potentially be the reference, and no one wants to boil their goldfish!</p>
  49. <p>So the tricky part is determining the topic. There are a number of ways to approach this.</p>
  50. <h2>Entities</h2>
  51. <p>The most obvious way is to determine what entity the person mentioned, and store that for use later. This works well if the user actually mentions an entity to work with. However in a general conversation, the subject of the conversation may not always be by the person who asks the question.</p>
  52. <h2>Intents</h2>
  53. <p>When asking a question and determining the intent, it may not always be that an entity can be involved. So this has limited help in this regards.</p>
  54. <p>That said, there are certain cases where intents have been used with a context in mind. So it can be easily done by creating a suffix to the intent. For example:</p>
  55. <pre>    #FEEDING_FISH_e_Peas</pre>
  56. <p>In this case we believe that peas is a common entity that has a relationship to the intent of Feeding Fish. For coding convention we use &#8220;_e_&#8221; to denote that the following piece of the intent name is an entity identifier.</p>
  57. <p>At the application layer, you can do a regex on the intent name &#8220;<strong>_e_(.*?)$</strong>&#8221; for the group 1 result. If it is not blank, store it in a context variable.</p>
  58. <p>&nbsp;</p>
  59. <h2>Regular Expressions</h2>
  60. <p>Like before, you can use regular expressions to capture an earlier pattern to store it at a later point.</p>
  61. <p>One way to approach this is have a gateway node that activates before working through the intent tree. Something like this:</p>
  62. <p><img data-attachment-id="2409" data-permalink="https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/example1507/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/example15071.png?w=756" data-orig-size="238,234" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="example1507" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/example15071.png?w=756?w=238" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/example15071.png?w=756?w=238" class="alignnone size-full wp-image-2409 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/example15071.png?w=756" alt="example1507" srcset="https://sodohertydotcom.files.wordpress.com/2017/06/example15071.png 238w, https://sodohertydotcom.files.wordpress.com/2017/06/example15071.png?w=150 150w" sizes="(max-width: 238px) 100vw, 238px"   /></p>
  63. <p>The downside to this is that there is a level of complexity to maintain in a complex regular expression.</p>
  64. <p>You can make at least maintaining a little easier by setting the primary condition check as &#8220;true&#8221; and then individual checks in the node itself.</p>
  65. <p><img data-attachment-id="2416" data-permalink="https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/example1507a/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507a.png?w=403&#038;h=378" data-orig-size="640,623" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="example1507a" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507a.png?w=403&#038;h=378?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507a.png?w=403&#038;h=378?w=640" class="  wp-image-2416 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/example1507a.png?w=403&#038;h=378" alt="example1507a" width="403" height="378" /></p>
  66. <h2>Answer Units</h2>
  67. <p>An answer unit is the text response you give back to the end user. Once you have responded with an answer, you have created a lot of context within that answer that the user may follow up on. For example:</p>
  68. <p><img data-attachment-id="2421" data-permalink="https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/example1507b/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png?w=756" data-orig-size="569,205" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="example1507b" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png?w=756?w=569" class="alignnone size-full wp-image-2421 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png?w=756" alt="example1507b" srcset="https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png 569w, https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png?w=300 300w" sizes="(max-width: 569px) 100vw, 569px"   /></p>
  69. <p>Even with the context markers of the answer, the end user may never pick up on them. So it is very important to craft your answer that will drive the user to the context you have selected.</p>
  70. <h2>NLU</h2>
  71. <p>The last option is to pass the questions through <a href="https://www.ibm.com/watson/developercloud/natural-language-understanding.html" target="_blank" rel="noopener">NLU</a>. This should be able to give you the key terms and phrases to store as context. As well as create knowledge graph information.</p>
  72. <h1>I have the context. Now what?</h1>
  73. <p>When the user gives a question that does not have context, you will normally get back low confidence intents, or irrelevant response.</p>
  74. <p>If you are using Intent based context, you can check the returning intents for a similar context to what you have stored. This also allows you to discard unrelated intents. The results from this are not always stellar, but offer a cheaper one time call.</p>
  75. <p>The other option you can take is to preload the question that was asked and send it back. For example:</p>
  76. <pre>  PEAS !! Can I boil them first?</pre>
  77. <p>You can use the !! as a marker that your question is trying to determine context. Handy if you need to review the logs later.</p>
  78. <h1>As time passes&#8230;</h1>
  79. <p>So as the conversation presses on, what the person is talking about can move away from the original context, but it may still remain the dominant. One solution is to build a weighted context list.</p>
  80. <p>For example:</p>
  81. <pre>"entity_list" : "peas, food, fish"</pre>
  82. <p>In this case we maintain the last three context found. As a new context is found, it uses LIFO to maintain the list. Of course this means more API calls, which can cost money.</p>
  83. <h3>Lowering calls on the tree.</h3>
  84. <p>Another option in this to create a poor mans knowledge graph. Let&#8217;s say the last two context were &#8220;bowl&#8221; and &#8220;peas&#8221;. Rather then creating multiple context nodes, you can build a tree which can be passed back to the application layer.</p>
  85. <pre>"entity" : "peas-&gt;food-&gt;care-&gt;fish"
  86. ...
  87. "entity" : "bowl-&gt;care-&gt;fish"</pre>
  88. <p>You can use something like <a href="http://tinkerpop.apache.org" target="_blank" rel="noopener">Tinkerpop</a> to create a knowledge graph (IBM Graph in Bluemix is based on this).<br />
  89. <img data-attachment-id="2433" data-permalink="https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/example1507c/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png?w=756" data-orig-size="303,209" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="example1507c" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png?w=756?w=303" class="alignnone size-full wp-image-2433 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png?w=756" alt="example1507c" srcset="https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png 303w, https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png?w=300 300w" sizes="(max-width: 303px) 100vw, 303px"   /></p>
  90. <p>Now when a low confidence question is found, you can use &#8220;bowl&#8221;, &#8220;peas&#8221; to disambiguate, or use &#8220;care&#8221; as the common entity to find the answer.</p>
  91. <h2>Talk&#8230; like.. a&#8230; millennial&#8230;</h2>
  92. <p>One more common form of anaphora that you have to deal with, is how people talk on instant messaging systems. The question is often split across multiple lines.</p>
  93. <p><img data-attachment-id="2457" data-permalink="https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/example1507d/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507d.png?w=756" data-orig-size="145,136" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="example1507d" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507d.png?w=756?w=145" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/example1507d.png?w=756?w=145" class="alignnone size-full wp-image-2457 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/example1507d.png?w=756" alt="example1507d"   /></p>
  94. <p>Normal conversation systems take one entry, and give one response. So this just wreaks their AI head. Because not only do you need to know where the real question stops, but where the next one starts.</p>
  95. <p>One way to approach this is capture the average timing mechanism between each entry of the user. You can do this by passing the timestamps from the client to the backend. The backend can then build an average of how the user talks. This needs to be done at the application layer.</p>
  96. <p>Sadly no samples this time, but it should give you some insights into how context is worked with a conversation system.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/1929/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/1929/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1929&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  97. <wfw:commentRss>https://sodoherty.ai/2017/07/15/anaphora-i-hardly-knew-her/feed/</wfw:commentRss>
  98. <slash:comments>0</slash:comments>
  99. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  100. <media:title type="html">simonodoherty</media:title>
  101. </media:content>
  102.  
  103. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/example15071.png" medium="image">
  104. <media:title type="html">example1507</media:title>
  105. </media:content>
  106.  
  107. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/example1507a.png" medium="image">
  108. <media:title type="html">example1507a</media:title>
  109. </media:content>
  110.  
  111. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/example1507b.png" medium="image">
  112. <media:title type="html">example1507b</media:title>
  113. </media:content>
  114.  
  115. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/example1507c.png" medium="image">
  116. <media:title type="html">example1507c</media:title>
  117. </media:content>
  118.  
  119. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/example1507d.png" medium="image">
  120. <media:title type="html">example1507d</media:title>
  121. </media:content>
  122. </item>
  123. <item>
  124. <title>Removing the confusion in intents.</title>
  125. <link>https://sodoherty.ai/2017/07/07/removing-the-confusion-in-intents/</link>
  126. <comments>https://sodoherty.ai/2017/07/07/removing-the-confusion-in-intents/#respond</comments>
  127. <pubDate>Fri, 07 Jul 2017 14:59:01 +0000</pubDate>
  128. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  129. <category><![CDATA[Python]]></category>
  130. <category><![CDATA[watson]]></category>
  131. <category><![CDATA[watson-conversation]]></category>
  132.  
  133. <guid isPermaLink="false">http://sodoherty.ai/?p=2347</guid>
  134. <description><![CDATA[While the complexity of building Conversation has reduced for non-developers, one of the areas that people can sometimes struggle is training intents. When trying to determine how the system performs, it is important to use tried and true methods of validation. If you go by someone just interacting with the system you can end up [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2347&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  135. <content:encoded><![CDATA[<p>While the complexity of building Conversation has reduced for non-developers, one of the areas that people can sometimes struggle is training intents.</p>
  136. <p>When trying to determine how the system performs, it is important to use tried and true methods of validation. If you go by someone just interacting with the system you can end up with what is called &#8220;perceived accuracy&#8221;. A person may ask three to four questions, and three may fail. Their perception becomes that the system is broken.</p>
  137. <p>Using cross validation allows you to give a better feel of how the system is working. As will a blind / test set. But knowing how the system performs and trying to trying to interpret the results is where it takes practise.</p>
  138. <p>Take this example test report. Each line is where a question is asked, and it determines what the answer should be, versus what answer came back. The X denotes where an answer failed.</p>
  139. <p><img data-attachment-id="2358" data-permalink="https://sodoherty.ai/2017/07/07/removing-the-confusion-in-intents/report_0707/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png?w=756" data-orig-size="454,244" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="report_0707" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png?w=756?w=454" class="alignnone size-full wp-image-2358 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png?w=756" alt="report_0707" srcset="https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png 454w, https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png?w=300 300w" sizes="(max-width: 454px) 100vw, 454px"   /></p>
  140. <p>Unless you are used to doing this analysis full time, it is very hard to see the bigger picture. For example, is DOG_HEALTH the issue, or is it LITTER_HEALTH + BREEDER_GUARANTEE?</p>
  141. <p>You have to manually analyse each of these clusters and determine what changes are required to be made.</p>
  142. <p>Thankfully <a href="http://scikit-learn.org" target="_blank" rel="noopener">Sci-Kit</a> makes your life easier with being able to create a confusion matrix. With this you can see how each intent performs against each other. So you end up with something like this:</p>
  143. <p><img data-attachment-id="2368" data-permalink="https://sodoherty.ai/2017/07/07/removing-the-confusion-in-intents/confusion_matrix/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=756" data-orig-size="1350,1415" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="confusion_matrix" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=756?w=286" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=756?w=756" class="alignnone size-full wp-image-2368 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=756" alt="confusion_matrix" srcset="https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=756 756w, https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=143 143w, https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=286 286w, https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=768 768w, https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png?w=977 977w, https://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png 1350w" sizes="(max-width: 756px) 100vw, 756px"   /></p>
  144. <p>So now you can quickly see what Intents are getting confused with others. So you focus on those to improve your accuracy better. In the example above, DOG_HEALTH and BREEDER_INFORMATION offer the best areas to investigate.</p>
  145. <p>I&#8217;ve created a <a title="ConversationConfusionMatrix" href="https://sodohertydotcom.files.wordpress.com/2017/07/conversationconfusionmatrix.zip">Sample Notebook</a> which demonstrates the above, so you can modify to test your own conversations training.</p>
  146. <p>&nbsp;</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/2347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/2347/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2347&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  147. <wfw:commentRss>https://sodoherty.ai/2017/07/07/removing-the-confusion-in-intents/feed/</wfw:commentRss>
  148. <slash:comments>0</slash:comments>
  149. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  150. <media:title type="html">simonodoherty</media:title>
  151. </media:content>
  152.  
  153. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/07/report_0707.png" medium="image">
  154. <media:title type="html">report_0707</media:title>
  155. </media:content>
  156.  
  157. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/07/confusion_matrix.png" medium="image">
  158. <media:title type="html">confusion_matrix</media:title>
  159. </media:content>
  160. </item>
  161. <item>
  162. <title>To see the world in a grain of sand&#8230;</title>
  163. <link>https://sodoherty.ai/2017/07/07/to-see-the-world-in-a-grain-of-sand/</link>
  164. <comments>https://sodoherty.ai/2017/07/07/to-see-the-world-in-a-grain-of-sand/#respond</comments>
  165. <pubDate>Fri, 07 Jul 2017 14:04:21 +0000</pubDate>
  166. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  167. <category><![CDATA[Uncategorized]]></category>
  168.  
  169. <guid isPermaLink="false">http://sodoherty.ai/?p=2317</guid>
  170. <description><![CDATA[Just a short blog update to inform everyone that I have moved over to a new role in IBM. I now work in IBM Dubai as a Technical Solutions Manager, assisting with the somewhat recently announced ai Lab. For me in a sense it means more (relative) free time, as a lot of my time [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2317&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  171. <content:encoded><![CDATA[<p>Just a short blog update to inform everyone that I have moved over to a new role in IBM. I now work in IBM Dubai as a Technical Solutions Manager, assisting with the somewhat recently announced <a href="http://www.smartdubai.ae/story0328.php" target="_blank" rel="noopener">ai Lab</a>.</p>
  172. <p>For me in a sense it means more (relative) free time, as a lot of my time was devoted to travelling previously. But I am just getting ramped up, so apologies again if I still maintain my one post a month. <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
  173. <p>On the plus side, I will be playing with a more wider spectrum of Watson + AI related technologies, and will discuss here when I get the chance.</p>
  174. <p>In the meantime here are some blogs I recommend.</p>
  175. <ul>
  176. <li><a href="http://marcnehme.com/marcnehme/blog/" target="_blank" rel="noopener">Marc Neheme</a></li>
  177. <li><a href="https:[email protected]" target="_blank" rel="noopener">Simon Burns</a></li>
  178. <li><a href="http://heidloff.net" target="_blank" rel="noopener">Niklas Heidioff</a></li>
  179. <li><a href="https:[email protected]" target="_blank" rel="noopener">Alex Martinelli</a></li>
  180. <li>Dave&#8217;s blogs (always fun!)  <a href="http://liveatthewitchtrials.blogspot.com" target="_blank" rel="noopener">Blog1</a>, <a href="http://www.meversusanpost.com" target="_blank" rel="noopener">Blog2</a>.</li>
  181. </ul>
  182. <p>I would also recommend to check out the <a href="https://chatbotsmagazine.com/100-bot-people-to-watch-botwatch-aa3fac1ef06" target="_blank" rel="noopener">Top 100 people to watch</a> list.</p>
  183. <p>&nbsp;</p>
  184. <p>&nbsp;</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/2317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/2317/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2317&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  185. <wfw:commentRss>https://sodoherty.ai/2017/07/07/to-see-the-world-in-a-grain-of-sand/feed/</wfw:commentRss>
  186. <slash:comments>0</slash:comments>
  187. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  188. <media:title type="html">simonodoherty</media:title>
  189. </media:content>
  190. </item>
  191. <item>
  192. <title>Watson Conversation just got turned up to 11.</title>
  193. <link>https://sodoherty.ai/2017/06/23/watson-conversation-just-got-turned-up-to-11/</link>
  194. <comments>https://sodoherty.ai/2017/06/23/watson-conversation-just-got-turned-up-to-11/#comments</comments>
  195. <pubDate>Fri, 23 Jun 2017 06:38:20 +0000</pubDate>
  196. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  197. <category><![CDATA[watson]]></category>
  198. <category><![CDATA[watson-conversation]]></category>
  199.  
  200. <guid isPermaLink="false">http://sodoherty.ai/?p=2253</guid>
  201. <description><![CDATA[I just wanted to start with why my blog doesn&#8217;t get updated that often. Life is hectic. With continual travel, and a number of other things going on, the chance to be able to sit down for peace and quiet is rare. That may change one way or another soon. I try to avoid other [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2253&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  202. <content:encoded><![CDATA[<p>I just wanted to start with why my blog doesn&#8217;t get updated that often.</p>
  203. <ol>
  204. <li>Life is hectic. With continual travel, and a number of other things going on, the chance to be able to sit down for peace and quiet is rare. That may change one way or another soon.</li>
  205. <li>I try to avoid other peoples thunder on a range of issues. For example I recommend keeping an eye on <a href="https:[email protected]/gathering-information-with-ibm-watson-conversation-e23887ccbe3d" target="_blank" rel="noopener">Simon Burns blog</a> in relation to the new features.</li>
  206. <li>My role continues to evolve, at the moment that is one of &#8220;Expert Services&#8221;, where people like myself go around the world to help our customers run the show themselves. This probably warrants it&#8217;s own page, but it is a balance between what is added value to that service, and what everyone should know. (I&#8217;m in the latter camp, but I got to eat too).</li>
  207. </ol>
  208. <p>The biggest reason for lack of updates? <strong>Development keep changing things!</strong> I&#8217;m not the only one that suffers from this. I read a fantastic design patterns document earlier this year by someone in GBS, which went mostly out of date a week or two after I got it.</p>
  209. <p>So it has been the same situation with the latest update to conversation. It is a total game changer. To give you an example of how awesome it is, here is an image of a sample &#8220;I want to buy a dog&#8221; dialog flow.</p>
  210. <p><img data-attachment-id="2277" data-permalink="https://sodoherty.ai/2017/06/23/watson-conversation-just-got-turned-up-to-11/pre-slots/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png?w=756" data-orig-size="448,1246" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="pre-slots" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png?w=756?w=108" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png?w=756?w=368" class="alignnone size-full wp-image-2277 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png?w=756" alt="pre-slots" srcset="https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png 448w, https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png?w=54 54w, https://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png?w=108 108w" sizes="(max-width: 448px) 100vw, 448px"   /></p>
  211. <p>Now compare that to the new Slots code. (btw, you may have noticed the UI looks cooler too).</p>
  212. <p><img data-attachment-id="2281" data-permalink="https://sodoherty.ai/2017/06/23/watson-conversation-just-got-turned-up-to-11/slots/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/slots.png?w=756" data-orig-size="550,253" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="slots" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/slots.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/slots.png?w=756?w=550" class=" size-full wp-image-2281 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/slots.png?w=756" alt="slots" srcset="https://sodohertydotcom.files.wordpress.com/2017/06/slots.png 550w, https://sodohertydotcom.files.wordpress.com/2017/06/slots.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/06/slots.png?w=300 300w" sizes="(max-width: 550px) 100vw, 550px"   /></p>
  213. <p>The same functionality took a fraction of the time, and has even more complexity of understanding than the previous version. That single node looks something like this:</p>
  214. <p><img data-attachment-id="2291" data-permalink="https://sodoherty.ai/2017/06/23/watson-conversation-just-got-turned-up-to-11/slots2/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png?w=756" data-orig-size="401,394" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="slots2" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png?w=756?w=401" class="alignnone size-full wp-image-2291 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png?w=756" alt="slots2" srcset="https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png 401w, https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/06/slots2.png?w=300 300w" sizes="(max-width: 401px) 100vw, 401px"   /></p>
  215. <p>That&#8217;s all for the moment, better if you play with it yourself. I have some free time shortly, and I will be posting some outstanding stuff.</p>
  216. <p>&nbsp;</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/2253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/2253/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2253&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  217. <wfw:commentRss>https://sodoherty.ai/2017/06/23/watson-conversation-just-got-turned-up-to-11/feed/</wfw:commentRss>
  218. <slash:comments>1</slash:comments>
  219. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  220. <media:title type="html">simonodoherty</media:title>
  221. </media:content>
  222.  
  223. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/pre-slots.png" medium="image">
  224. <media:title type="html">pre-slots</media:title>
  225. </media:content>
  226.  
  227. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/slots.png" medium="image">
  228. <media:title type="html">slots</media:title>
  229. </media:content>
  230.  
  231. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/06/slots2.png" medium="image">
  232. <media:title type="html">slots2</media:title>
  233. </media:content>
  234. </item>
  235. <item>
  236. <title>I love Pandas!</title>
  237. <link>https://sodoherty.ai/2017/04/19/i-love-pandas/</link>
  238. <comments>https://sodoherty.ai/2017/04/19/i-love-pandas/#comments</comments>
  239. <pubDate>Wed, 19 Apr 2017 09:55:41 +0000</pubDate>
  240. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  241. <category><![CDATA[Python]]></category>
  242. <category><![CDATA[watson-conversation]]></category>
  243.  
  244. <guid isPermaLink="false">http://sodoherty.ai/?p=2116</guid>
  245. <description><![CDATA[Not the bamboo eating kind (but they are cute too), Python Pandas! But first&#8230; Conversation has a new feature! Logging!  You can now download your logs from your conversation workspace into a JSON format. So I thought I&#8217;d take this moment to introduce Pandas. Some people love the &#8220;Improve&#8221; UI, but personally I like being able to [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2116&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  246. <content:encoded><![CDATA[<p>Not the bamboo eating kind (but they are cute too), <a href="http://pandas.pydata.org">Python Pandas</a>!</p>
  247. <p>But first&#8230; Conversation has a new feature!</p>
  248. <h2 style="text-align:center;"><strong>Logging! </strong></h2>
  249. <p>You can now download your logs from your conversation workspace into a JSON format. So I thought I&#8217;d take this moment to introduce Pandas. Some people love the &#8220;Improve&#8221; UI, but personally I like being able to easily mold the data to what I need.</p>
  250. <p>First, if you are new to Python, I strongly recommend getting a Python Notebook like <a href="https://jupyter.org" target="_blank">Jupyter</a> set up or use <a href="http://datascience.ibm.com">IBM Data Science Experience</a>. It makes learning so much easier, and you build your applications like actual documentation.</p>
  251. <p>I have a <a title="AnalysingConversationLogs" href="https://sodohertydotcom.files.wordpress.com/2017/04/analysingconversationlogs.zip">notebook</a> created so you can play along.</p>
  252. <h2>Making a connection</h2>
  253. <p>As the feature is just out, the SDK&#8217;s don&#8217;t have the API for it, so I will be using requests library.</p>
  254. <pre>url='https://gateway.watsonplatform.net/conversation/api/v1/workspaces/WORKSPACE_ID/logs?version=2017-04-21'
  255. basic_auth = HTTPBasicAuth(ctx.get('username'), ctx.get('password'))
  256. response = requests.get(url=url, auth=basic_auth)
  257. j = json.loads(response.text)</pre>
  258. <p>So we have the whole log now sitting in <code>j</code> but we want to make a dataframe. Before we do that however, let&#8217;s talk about log analysis and the fields you need. There are three areas we want to analyse in logs.</p>
  259. <p><strong>Quantitive</strong> &#8211; These are fixed metrics, like number of users, response times, common intents, etc.</p>
  260. <p><strong>Qualitative</strong> &#8211; This is analysing how the end user is speaking, and how the system interpreted and responded. Some examples would be where the answer returned may give the wrong impression to the end user, or users ask things out of expected areas.</p>
  261. <p><strong>Debugging</strong> &#8211; This is really looking for coding issues with your conversation tree.</p>
  262. <p>So on to the fields that cover these areas. These are all contained in <code>j['response']</code>.</p>
  263. <table style="margin:0 auto;font-size:9pt;max-width:100%;">
  264. <tbody>
  265. <tr>
  266. <td><b>Field</b></td>
  267. <td><b>Usage</b></td>
  268. <td width="60%"><b>Description</b></td>
  269. </tr>
  270. <tr>
  271. <td>input.text</td>
  272. <td>Qualitative</td>
  273. <td>This is what the user or the application typed in.</td>
  274. </tr>
  275. <tr>
  276. <td>intents[]</td>
  277. <td>Qualitative</td>
  278. <td>This tells you the primary intent for the users question. You should capture the intent and confidence into columns. If the value is [] then means it was irrelevant.</td>
  279. </tr>
  280. <tr>
  281. <td>entities[]</td>
  282. <td>Quantitive</td>
  283. <td>The entities found in relation to the call. With this and intents though, it&#8217;s important to understand that the application can override these values.</td>
  284. </tr>
  285. <tr>
  286. <td>output.text[]</td>
  287. <td>Qualitative</td>
  288. <td>This is the response shown to the user (or application).</td>
  289. </tr>
  290. <tr>
  291. <td>output.log_messages</td>
  292. <td>Debugging</td>
  293. <td>Capturing this field is handy to look for coding issues within your conversation tree. SPEL errors show up here if they happen.</td>
  294. </tr>
  295. <tr>
  296. <td>output.nodes_visited</td>
  297. <td>Debugging<br />
  298. Qualitive</td>
  299. <td>This can be used to see how a progression through a tree happens</td>
  300. </tr>
  301. <tr>
  302. <td>context.conversation_id</td>
  303. <td>All</td>
  304. <td>Use this to group users conversation together. In some solutions however, one pass calls are sometimes done mid conversation. So if you do this, you need to factor that in.</td>
  305. </tr>
  306. <tr>
  307. <td>context.system.branch_exited</td>
  308. <td>Debugging</td>
  309. <td>This tells you if your conversation left a branch and returned to root.</td>
  310. </tr>
  311. <tr>
  312. <td>context.system.branch_exited_reason</td>
  313. <td>Debugging</td>
  314. <td>If branch.exited is true then this will tell the why. completed means that the branch found a matching node, and finished. fallback means that it could not find a matching node, so it jumps back to root to find the match.</td>
  315. </tr>
  316. <tr>
  317. <td>context.???</td>
  318. <td>All</td>
  319. <td>You may have context variables you want to capture. You can either do these individually, or code to remove conversation objects and grab what remains</td>
  320. </tr>
  321. <tr>
  322. <td>request_timestamp</td>
  323. <td>Quantitive<br />
  324. Qualitative</td>
  325. <td>When conversation received the users response.</td>
  326. </tr>
  327. <tr>
  328. <td>response_timestamp</td>
  329. <td>Quantitive<br />
  330. Qualitative</td>
  331. <td>When conversation responded to the user. You can do a delta to see if there are conversation performance issues, but generally keep one of the timestamp fields for analysis.</td>
  332. </tr>
  333. </tbody>
  334. </table>
  335. <p>&nbsp;</p>
  336. <p>So we create a row array, and fill it with dict objects of the columns we want to capture. For clarity of the blog post, the sample code below</p>
  337. <pre>import pandas as pd
  338. rows = []
  339.  
  340. # for object in Json Logs array.
  341. for o in j['logs']:
  342.    row = {}
  343.    # Let's shorthand the response object.
  344.    r = o['response']
  345.    row['conversation_id'] = r['context']['conversation_id']
  346.    # We need to check the fields exist before we read them.
  347.    if 'text' in r['input']: row['Input'] = r['input']['text']
  348.    if 'text' in r['output']:row['Output'] = ' '.join(r['output']['text'])
  349.    # Again we need to check it is not an Irrelevant response.
  350.    if len(r['intents']) &gt; 0:
  351.        row['Confidence'] = r['intents'][0]['confidence']
  352.        row['Intent'] = r['intents'][0]['intent']
  353.  
  354.    rows.append(row)
  355.  
  356. # Build the dataframe.
  357. df = pd.DataFrame(rows,columns=['conversation_id','Input','Output','Intent','Confidence'])
  358. df = df.fillna('')
  359.  
  360. # Display the dataframe.
  361. df</pre>
  362. <p>When this is run, all going well you end up with something like this:</p>
  363. <p><img data-attachment-id="2183" data-permalink="https://sodoherty.ai/2017/04/19/i-love-pandas/report1-1804/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=756" data-orig-size="997,185" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="report1-1804" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=756?w=756" class="alignnone size-full wp-image-2183" src="https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=756" alt="report1-1804" srcset="https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=756 756w, https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=300 300w, https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png?w=768 768w, https://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png 997w" sizes="(max-width: 756px) 100vw, 756px"   /></p>
  364. <p>The notebook has a better report, and is also sorted so it is actually readable.</p>
  365. <p><img data-attachment-id="2186" data-permalink="https://sodoherty.ai/2017/04/19/i-love-pandas/report2-1804/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=756" data-orig-size="1002,236" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="report2-1804" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=756?w=756" class="alignnone size-full wp-image-2186" src="https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=756" alt="report2-1804" srcset="https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=756 756w, https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=300 300w, https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png?w=768 768w, https://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png 1002w" sizes="(max-width: 756px) 100vw, 756px"   /></p>
  366. <p>Once you have everything you need in the dataframe, you can manipulate it very fast and easy. For example, let&#8217;s say you want to get a count of the intents found.</p>
  367. <pre># Get the counts.
  368. q_df = df.groupby('Intent').count()
  369.  
  370. # Remove all fields except conversation_id and intents.
  371. q_df = q_df.drop(['request TS', 'response TS', 'User Input', 'Output', 'Confidence', 'Exit Reason', 'Logging'],axis=1)
  372.  
  373. # Rename the conversation_id field to "Count".
  374. q_df.columns = ['Count']
  375.  
  376. # Sort and display.
  377. q_df = q_df.sort_values(['Count'], ascending=[False])
  378. q_df</pre>
  379. <p>This creates this:</p>
  380. <p><img data-attachment-id="2192" data-permalink="https://sodoherty.ai/2017/04/19/i-love-pandas/report3-1804/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png?w=756" data-orig-size="249,459" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="report3-1804" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png?w=756?w=163" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png?w=756?w=249" class="alignnone size-full wp-image-2192" src="https://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png?w=756" alt="report3-1804" srcset="https://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png 249w, https://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png?w=81 81w" sizes="(max-width: 249px) 100vw, 249px"   /></p>
  381. <p>The Jupyter notebook also allows for visualisation of data as well. Although I haven&#8217;t put any in the sample notebook.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/2116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/2116/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=2116&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  382. <wfw:commentRss>https://sodoherty.ai/2017/04/19/i-love-pandas/feed/</wfw:commentRss>
  383. <slash:comments>5</slash:comments>
  384. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  385. <media:title type="html">simonodoherty</media:title>
  386. </media:content>
  387.  
  388. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/report1-1804.png" medium="image">
  389. <media:title type="html">report1-1804</media:title>
  390. </media:content>
  391.  
  392. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/report2-1804.png" medium="image">
  393. <media:title type="html">report2-1804</media:title>
  394. </media:content>
  395.  
  396. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/report3-1804.png" medium="image">
  397. <media:title type="html">report3-1804</media:title>
  398. </media:content>
  399. </item>
  400. <item>
  401. <title>I have a dream&#8230;</title>
  402. <link>https://sodoherty.ai/2017/04/18/i-have-a-dream/</link>
  403. <comments>https://sodoherty.ai/2017/04/18/i-have-a-dream/#respond</comments>
  404. <pubDate>Tue, 18 Apr 2017 16:30:09 +0000</pubDate>
  405. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  406. <category><![CDATA[watson]]></category>
  407. <category><![CDATA[watson-text-to-speech]]></category>
  408.  
  409. <guid isPermaLink="false">http://sodoherty.ai/?p=1966</guid>
  410. <description><![CDATA[Following on from Speech to Text, let&#8217;s jump over to Text to Speech. Similar to conversation, what can make or break the system is the tone and personality you build into the system. Developers tend to think about the coding, and not the user experience so much. To give an example, let&#8217;s take a piece [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1966&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  411. <content:encoded><![CDATA[<p>Following on from Speech to Text, let&#8217;s jump over to Text to Speech. Similar to conversation, what can make or break the system is the tone and personality you build into the system.</p>
  412. <p>Developers tend to think about the coding, and not the user experience so much.</p>
  413. <p>To give an example, let&#8217;s take a piece of a <a href="http://www.americanrhetoric.com/speeches/mlkihaveadream.htm">very famous speech from MLK</a>. Small sample so it doesn&#8217;t take all day:</p>
  414. <blockquote><p>I still have a dream. It is a dream deeply rooted in the American dream.</p>
  415. <p>I have a dream that one day this nation will rise up and live out the true meaning of its creed: &#8220;We hold these truths to be self-evident, that all men are created equal.&#8221;</p></blockquote>
  416. <p>Let&#8217;s listen to Watson as it directly translates.</p>
  417. <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
  418. <audio class="wp-audio-shortcode" id="audio-1966-1" preload="none" style="width: 100%;" controls="controls"><source type="audio/wav" src="https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream.wav?_=1" /><a href="https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream.wav">https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream.wav</a></audio>
  419. <p>It sounds like how I act when I am reading a script. <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
  420. <p>Now lets listen to MLK.<br />
  421. <audio class="wp-audio-shortcode" id="audio-1966-2" preload="none" style="width: 100%;" controls="controls"><source type="audio/wav" src="https://sodohertydotcom.files.wordpress.com/2017/04/mlk-ihaveadream.wav?_=2" /><a href="https://sodohertydotcom.files.wordpress.com/2017/04/mlk-ihaveadream.wav">https://sodohertydotcom.files.wordpress.com/2017/04/mlk-ihaveadream.wav</a></audio></p>
  422. <p>You can feel the emotion behind it. The pauses and emphasis adds more meaning to it. Thankfully Watson supports <a href="https://www.ibm.com/watson/developercloud/doc/text-to-speech/SSML.html">SSML</a>, which allows you to mimic the speech.</p>
  423. <p>For this example I only used two tags. The first was <strong>&lt;parsody&gt;</strong> which allows Watson to have the same speaking speed as MLK. The other tag was<strong> &lt;break&gt;</strong> which allows me to make those dramatic pauses.</p>
  424. <p>Using <a href="http://www.audacityteam.org" target="_blank">Audacity</a> I was able to put the generated speech against the MLK speech. Then selecting the pause areas, I can quickly see the pause lengths.</p>
  425. <p><img data-attachment-id="2098" data-permalink="https://sodoherty.ai/2017/04/18/i-have-a-dream/audicity/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png?w=756" data-orig-size="549,224" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="audicity" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png?w=756?w=549" class="alignnone size-full wp-image-2098" src="https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png?w=756" alt="audicity" srcset="https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png 549w, https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/04/audicity.png?w=300 300w" sizes="(max-width: 549px) 100vw, 549px"   /></p>
  426. <p>I finally ended up with this:<br />
  427. <audio class="wp-audio-shortcode" id="audio-1966-3" preload="none" style="width: 100%;" controls="controls"><source type="audio/wav" src="https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream-markedup.wav?_=3" /><a href="https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream-markedup.wav">https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream-markedup.wav</a></audio></p>
  428. <p>Audacity also allows you to overlay audio, to get a feel to how it would sound if there were crowds listening.<br />
  429. <audio class="wp-audio-shortcode" id="audio-1966-4" preload="none" style="width: 100%;" controls="controls"><source type="audio/wav" src="https://sodohertydotcom.files.wordpress.com/2017/04/combined-mlk-watson.wav?_=4" /><a href="https://sodohertydotcom.files.wordpress.com/2017/04/combined-mlk-watson.wav">https://sodohertydotcom.files.wordpress.com/2017/04/combined-mlk-watson.wav</a></audio></p>
  430. <p>The final script ends up like this:</p>
  431. <pre>&lt;prosody rate="x-slow"&gt;I still have a dream.&lt;/prosody&gt;
  432. &lt;break time="1660ms"&gt;&lt;/break&gt;
  433. &lt;prosody rate="slow"&gt;It is a dream deeply rooted in the American dream.&lt;/prosody&gt;
  434. &lt;break time="500ms"&gt;&lt;/break&gt;
  435. &lt;prosody rate="slow"&gt;I have a dream&lt;/prosody&gt;
  436. &lt;break time="1490ms"&gt;&lt;/break&gt;
  437. &lt;prosody rate="x-slow"&gt;that one day&lt;/prosody&gt;
  438. &lt;break time="1480ms"&gt;&lt;/break&gt;
  439. &lt;prosody rate="slow"&gt;this nation &lt;prosody rate="x-slow"&gt;will &lt;/prosody&gt;ryeyes up&lt;/prosody&gt;
  440. &lt;break time="1798ms"&gt;&lt;/break&gt;
  441. &lt;prosody rate="slow"&gt;and live out the true meaning of its creed:&lt;/prosody&gt;
  442. &lt;break time="362ms"&gt;&lt;/break&gt;
  443. &lt;prosody rate="slow"&gt;"We hold these truths to be self-evident,&lt;/prosody&gt;
  444. &lt;break time="594ms"&gt;&lt;/break&gt;
  445. &lt;prosody rate="slow"&gt;that all men are created equal."&lt;/prosody&gt;</pre>
  446. <p>I have zipped up all the files for download, just in case you are having issues running the audio.</p>
  447. <p style="padding-left:30px;"><a title="IHaveADream" href="https://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream.zip">IHaveADream.zip</a></p>
  448. <p>In closing, if you plan to build a conversational system that speaks to the end user, you also need skills in talking to people, just not being able to write.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/1966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/1966/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1966&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  449. <wfw:commentRss>https://sodoherty.ai/2017/04/18/i-have-a-dream/feed/</wfw:commentRss>
  450. <slash:comments>0</slash:comments>
  451. <enclosure url="http://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream.wav" length="651662" type="audio/wav" />
  452. <enclosure url="http://sodohertydotcom.files.wordpress.com/2017/04/mlk-ihaveadream.wav" length="1179392" type="audio/wav" />
  453. <enclosure url="http://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream-markedup.wav" length="1204250" type="audio/wav" />
  454. <enclosure url="http://sodohertydotcom.files.wordpress.com/2017/04/combined-mlk-watson.wav" length="1179392" type="audio/wav" />
  455. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  456. <media:title type="html">simonodoherty</media:title>
  457. </media:content>
  458.  
  459. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/audicity.png" medium="image">
  460. <media:title type="html">audicity</media:title>
  461. </media:content>
  462.  
  463. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream.wav" medium="audio" />
  464.  
  465. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/mlk-ihaveadream.wav" medium="audio" />
  466.  
  467. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/ihaveadream-markedup.wav" medium="audio" />
  468.  
  469. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/combined-mlk-watson.wav" medium="audio" />
  470. </item>
  471. <item>
  472. <title>Speech to Text and Conversation</title>
  473. <link>https://sodoherty.ai/2017/04/18/speech-to-text-and-conversation/</link>
  474. <comments>https://sodoherty.ai/2017/04/18/speech-to-text-and-conversation/#respond</comments>
  475. <pubDate>Tue, 18 Apr 2017 12:57:49 +0000</pubDate>
  476. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  477. <category><![CDATA[tips]]></category>
  478. <category><![CDATA[watson]]></category>
  479. <category><![CDATA[watson-speech-to-text]]></category>
  480.  
  481. <guid isPermaLink="false">http://sodoherty.ai/?p=1967</guid>
  482. <description><![CDATA[I thought I would take a moment to play with Speech to Text and a utility that was released a few months ago. The Speech to Text Utils allows you to train S2T using your existing conversational system. To give a quick demo, I got my son to ask about buying a puppy. I set up [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1967&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  483. <content:encoded><![CDATA[<p>I thought I would take a moment to play with Speech to Text and a utility that was released a few months ago.</p>
  484. <p>The <a href="https://github.com/watson-developer-cloud/speech-to-text-utils" target="_blank">Speech to Text Utils</a> allows you to train S2T using your existing conversational system. To give a quick demo, I got my son to ask about buying a puppy.</p>
  485. <audio class="wp-audio-shortcode" id="audio-1967-5" preload="none" style="width: 100%;" controls="controls"><source type="audio/wav" src="https://sodohertydotcom.files.wordpress.com/2017/04/p4u-example1.wav?_=5" /><a href="https://sodohertydotcom.files.wordpress.com/2017/04/p4u-example1.wav">https://sodohertydotcom.files.wordpress.com/2017/04/p4u-example1.wav</a></audio>
  486. <p>I set up some quick Python code to print out results:</p>
  487. <pre>import json
  488. from watson_developer_cloud import SpeechToTextV1
  489.  
  490. # ctx is Service credentials copied from S2T Service.
  491.  
  492. s2t = SpeechToTextV1(
  493. username=ctx.get('username'),
  494. password=ctx.get('password')
  495. )
  496.  
  497. def wav(filename, **kwargs):
  498.  with open(filename,'rb') as wav:
  499.    response = s2t.recognize(wav, content_type='audio/wav', **kwargs)
  500.  
  501. if len(response['results']) &gt; 0:
  502.  return response['results'][0]['alternatives'][0]['transcript']
  503. else:
  504.  return '???';</pre>
  505. <p>So testing the audio with the following code:</p>
  506. <pre>wav_file = 'p4u-example1.wav'
  507. print('Broadband: {}'.format(wav(wav_file)))
  508. print('NarrowBand: {}'.format(wav(wav_file,model='en-US_NarrowbandModel')))</pre>
  509. <p>Gets these results:</p>
  510. <pre>Broadband: can I get a puppy
  511. NarrowBand: can I get a puppy</pre>
  512. <p>Of course the recording is crystal clear, which is why such a good result. So I added some ambient noises from <a href="https://www.soundjay.com/ambient-sounds-2.html" target="_blank">SoundJay</a> to the background. So now it sounds like it is in a subway.</p>
  513. <audio class="wp-audio-shortcode" id="audio-1967-6" preload="none" style="width: 100%;" controls="controls"><source type="audio/wav" src="https://sodohertydotcom.files.wordpress.com/2017/04/p4u-example2.wav?_=6" /><a href="https://sodohertydotcom.files.wordpress.com/2017/04/p4u-example2.wav">https://sodohertydotcom.files.wordpress.com/2017/04/p4u-example2.wav</a></audio>
  514. <p>Running the code above again get&#8217;s these results.</p>
  515. <pre>Broadband: Greg it appropriate
  516. Narrowband: can I get a phone</pre>
  517. <p>Ouch!</p>
  518. <h3>Utils to the rescue!</h3>
  519. <p>So the purpose of asking about a puppy is that I have a <a title="puppies4you" href="https://sodohertydotcom.files.wordpress.com/2017/04/puppies4you.zip">sample conversation</a> system that is about buying a dog. Using that conversation file I did the following.</p>
  520. <p>1: Installed <a href="https://github.com/watson-developer-cloud/speech-to-text-utils" target="_blank">Speech to Text Utils</a>.</p>
  521. <p>2: Before you begin you need to set up the connection to your S2T service (using service credentials).</p>
  522. <pre><code>watson-speech-to-text-utils set-credentials</code></pre>
  523. <p>It will walk you through the username and password.</p>
  524. <p>3: Once that was set up, I then tell it to create a customisation.</p>
  525. <pre>watson-speech-to-text-utils corpus-from-workspace puppies4you.json</pre>
  526. <p>You need to map to a particular model. For testing, I attached it to en-US_NarrowbandModel and en-US_BroadbandModel.</p>
  527. <p>4: Once it was run, I get the ID numbers for the customisations.</p>
  528. <pre>watson-speech-to-text-utils customization-list</pre>
  529. <p>Once I have the ID&#8217;s I try the audio again:</p>
  530. <pre>wav_file='p4u-example2.wav'
  531. print('Broadband: {}'.format(wav(wav_file,customization_id='beeebd80-2420-11e7-8f1c-176db802f8de',timestamps=True)))
  532. print('Narrowband: {}'.format(wav(wav_file,model='en-US_NarrowbandModel',customization_id='a9f80490-241b-11e7-8f1c-176db802f8de')))</pre>
  533. <p>This outputs:</p>
  534. <pre>Broadband: can I get a puppy
  535. Narrowband: can I get a phone</pre>
  536. <p>So the broadband now works. Narrowband is likely the quality is too poor to work with. There is also more <a href="http://www.soapboxlabs.com">specialised language models for children</a> done by others to cope with this.</p>
  537. <h3>One swallow does not make a summer.</h3>
  538. <p>So this is one example, of one phrase. Really for testing, you should test the whole model. From a demonstration from development, it was able to increase a S2T model accuracy from around 50% to over 80%.</p>
  539. <p>&nbsp;</p>
  540. <p>&nbsp;</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/1967/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/1967/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1967&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  541. <wfw:commentRss>https://sodoherty.ai/2017/04/18/speech-to-text-and-conversation/feed/</wfw:commentRss>
  542. <slash:comments>0</slash:comments>
  543. <enclosure url="http://sodohertydotcom.files.wordpress.com/2017/04/p4u-example1.wav" length="243756" type="audio/wav" />
  544. <enclosure url="http://sodohertydotcom.files.wordpress.com/2017/04/p4u-example2.wav" length="243850" type="audio/wav" />
  545. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  546. <media:title type="html">simonodoherty</media:title>
  547. </media:content>
  548.  
  549. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/p4u-example1.wav" medium="audio" />
  550.  
  551. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/p4u-example2.wav" medium="audio" />
  552. </item>
  553. <item>
  554. <title>Watson V3 Certification</title>
  555. <link>https://sodoherty.ai/2017/04/04/watson-v3-certification/</link>
  556. <comments>https://sodoherty.ai/2017/04/04/watson-v3-certification/#respond</comments>
  557. <pubDate>Tue, 04 Apr 2017 07:16:13 +0000</pubDate>
  558. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  559. <category><![CDATA[certification]]></category>
  560. <category><![CDATA[watson]]></category>
  561.  
  562. <guid isPermaLink="false">http://sodoherty.ai/?p=1898</guid>
  563. <description><![CDATA[So I got my Watson V3 Certification a week or so ago, and the badge just arrived yesterday. I sat the mock exam without studying and passed. So I thought I&#8217;d try the real exam, and passed that too. Overall if you have been working in the Watson group for 3+ years, where your job [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1898&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  564. <content:encoded><![CDATA[<p><a href="https://www.youracclaim.com/badges/ff8e531d-6987-41a3-b5e8-1554e6e47c29/public_url"><img data-attachment-id="1901" data-permalink="https://sodoherty.ai/2017/04/04/watson-v3-certification/ibm-certified-application-developer-watson-v3-certification/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/04/ibm-certified-application-developer-watson-v3-certification.png?w=756" data-orig-size="125,125" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ibm-certified-application-developer-watson-v3-certification" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/04/ibm-certified-application-developer-watson-v3-certification.png?w=756?w=125" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/04/ibm-certified-application-developer-watson-v3-certification.png?w=756?w=125" class=" size-full wp-image-1901 alignleft" src="https://sodohertydotcom.files.wordpress.com/2017/04/ibm-certified-application-developer-watson-v3-certification.png?w=756" alt="ibm-certified-application-developer-watson-v3-certification"   /></a>So I got my Watson V3 Certification a week or so ago, and the badge just arrived yesterday.</p>
  565. <p>I sat the mock exam without studying and passed. So I thought I&#8217;d try the real exam, and passed that too.</p>
  566. <p>Overall if you have been working in the Watson group for 3+ years, where your job role is to have medium to expert knowledge of all (non-Health) Watson products, then you are probably going to find the exam OK to pass.</p>
  567. <p>For people who haven&#8217;t, it&#8217;s not going to be easy. I strongly recommend following the <a href="http://www-03.ibm.com/certify/content/studyguides/study_guide_c7020-230.pdf">study guide</a> on the <a href="http://www-03.ibm.com/certify/tests/eduC7020-230.shtml">test preparation</a> certification page if you plan to get this.</p>
  568. <p>My only quibbles on the exam is that the technology changes a lot.</p>
  569. <p>For example, all the design patterns for coding conversation before December last year are not that relevant any more, and will likely change again soon. (Which is part reason for lack of updates on the blog, the other being laziness <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> )</p>
  570. <p>So you need to know the current active technologies even if they are going away. Plus there will probably be a V4 exam in 6 months or so time.</p>
  571. <p>I&#8217;d also like to see more focused certifications for some parts of the Watson Developer Cloud. For example, being an expert at Discovery Service, doesn&#8217;t make you an expert of Conversation and vise-versa.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/1898/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/1898/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1898&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  572. <wfw:commentRss>https://sodoherty.ai/2017/04/04/watson-v3-certification/feed/</wfw:commentRss>
  573. <slash:comments>0</slash:comments>
  574. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  575. <media:title type="html">simonodoherty</media:title>
  576. </media:content>
  577.  
  578. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/04/ibm-certified-application-developer-watson-v3-certification.png" medium="image">
  579. <media:title type="html">ibm-certified-application-developer-watson-v3-certification</media:title>
  580. </media:content>
  581. </item>
  582. <item>
  583. <title>Watson in the black and white room.</title>
  584. <link>https://sodoherty.ai/2017/02/10/watson-in-the-black-and-white-room/</link>
  585. <comments>https://sodoherty.ai/2017/02/10/watson-in-the-black-and-white-room/#comments</comments>
  586. <pubDate>Fri, 10 Feb 2017 20:32:54 +0000</pubDate>
  587. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  588. <category><![CDATA[watson-conversation]]></category>
  589.  
  590. <guid isPermaLink="false">http://sodoherty.ai/?p=1841</guid>
  591. <description><![CDATA[Let&#8217;s talk about the recent changes of how Watson determines it&#8217;s confidence. It seems to be a hot topic at the moment, and probably not best understood. &#160; Before:  Imagine that you are Watson, you are in a room with no doors or windows. You have learned everything about the world from Wikipedia. There is [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1841&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  592. <content:encoded><![CDATA[<p>Let&#8217;s talk about the recent changes of how Watson determines it&#8217;s confidence. It seems to be a hot topic at the moment, and probably not best understood.</p>
  593. <p>&nbsp;</p>
  594. <h2><strong>Before: </strong></h2>
  595. <p>Imagine that you are Watson, you are in a room with no doors or windows. You have learned everything about the world from Wikipedia. There is two objects, a cube and a pyramid in front of you.</p>
  596. <p>Now if someone tells you a question, you can use Wikipedia to try and figure out what the answer is, but you can only point to one of the two objects in the room. There is no other answer.</p>
  597. <p>So they may ask &#8220;Which one is an Orange?&#8221;. You may think that a cube is similar to the Discovery Cube in Orange county. You can also see that a food pyramid has an orange in it. Neither is a direct fit, but you only have two answers.</p>
  598. <p>So you respond: <em>&#8220;I am 51% sure that it is this pyramid&#8221;</em></p>
  599. <h2>After:</h2>
  600. <p>Now you are in the same room, but this time there is a window that shows you the outside world.</p>
  601. <p>You are asked the same question. You still come to the same conclusion, but because you can see the outside world you know that the answer is not in the room.</p>
  602. <p>This time you respond: <em>&#8220;I am confident that neither of these objects are an Orange&#8221;</em></p>
  603. <h2>But what about the lower confidence?</h2>
  604. <p>The first thing you notice is that the confidence is not as high as before. This in itself is not a bad thing. It is the relationship of the answer to the others found. For example:</p>
  605. <p><img data-attachment-id="1775" data-permalink="https://sodoherty.ai/2017/02/06/compound-questions/conv060217-2/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756" data-orig-size="361,262" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="conv060217-2" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756?w=361" class=" size-full wp-image-1775 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756" alt="conv060217-2" srcset="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png 361w, https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=300 300w" sizes="(max-width: 361px) 100vw, 361px"   /></p>
  606. <p>You can see in this example the first answer is 72%, while the next one is 70%. So it is either a compound question, or you need training to differentiate between the two intents that are close together. In the previous version you could not see this.</p>
  607. <p>The main point to take from this, the confidence hasn&#8217;t actually changed. You are just finally seeing the real confidence.</p>
  608. <h2>How does this impact me?</h2>
  609. <p>First Watson would always ignore an intent if the confidence is &lt;0.2. But how the confidences were previously determined, it was rare that you would hit this condition.</p>
  610. <p>Now this is possible.</p>
  611. <p>Also if you have written conditions to determine the real confidence boundary (<a href="https://sodoherty.ai/2016/09/05/handling-low-confidence-answers-in-conversation/">detailed here</a>), you need to determine the correct boundaries.</p>
  612. <p>Lastly if no intent is matched, the you get an empty intents list.</p>
  613. <h2>In closing</h2>
  614. <p>Although the new feature is considerably better, always test before you deploy!</p>
  615. <p><em>As for the title reference: </em></p>
  616. <div class="jetpack-video-wrapper"><iframe class='youtube-player' type='text/html' width='756' height='456' src='https://www.youtube.com/embed/mGYmiQkah4o?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></div><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/1841/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/1841/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1841&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  617. <wfw:commentRss>https://sodoherty.ai/2017/02/10/watson-in-the-black-and-white-room/feed/</wfw:commentRss>
  618. <slash:comments>1</slash:comments>
  619. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  620. <media:title type="html">simonodoherty</media:title>
  621. </media:content>
  622.  
  623. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png" medium="image">
  624. <media:title type="html">conv060217-2</media:title>
  625. </media:content>
  626. </item>
  627. <item>
  628. <title>Compound Questions</title>
  629. <link>https://sodoherty.ai/2017/02/06/compound-questions/</link>
  630. <comments>https://sodoherty.ai/2017/02/06/compound-questions/#respond</comments>
  631. <pubDate>Mon, 06 Feb 2017 21:05:33 +0000</pubDate>
  632. <dc:creator><![CDATA[sodoherty]]></dc:creator>
  633. <category><![CDATA[Python]]></category>
  634. <category><![CDATA[watson-conversation]]></category>
  635.  
  636. <guid isPermaLink="false">http://sodoherty.com/?p=1762</guid>
  637. <description><![CDATA[One problem that is tricky to solve is if a user has asked two questions. Previously some solutions were&#160;to look for conjunctions (&#8220;and&#8221;) or question marks. Then try to guess if it is a question. But you could end up with a question like &#8220;Has my dog been around other dogs and other people?&#8221;. This [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1762&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  638. <content:encoded><![CDATA[<p>One problem that is tricky to solve is if a user has asked two questions. Previously some solutions were&nbsp;to look for conjunctions (&#8220;and&#8221;) or question marks. Then try to guess if it is a question.</p>
  639. <p>But you could end up with a question like <em>&#8220;Has my dog been around other dogs and other people?&#8221;</em>. This is clearly one question.</p>
  640. <p>With the new conversation feature of &#8220;Absolute Confidences&#8221;, it is now possible to detect this. Earlier versions of conversation would have all intents would add up to 1.0.</p>
  641. <p>Now each confidence has it&#8217;s own value. Taking the earlier example, if we map the confidences to a chart, we get:</p>
  642. <p><img data-attachment-id="1768" data-permalink="https://sodoherty.ai/2017/02/06/compound-questions/conv060217-1/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png?w=756" data-orig-size="361,262" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="conv060217-1" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png?w=756?w=361" class="size-full wp-image-1768 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png?w=756" alt="conv060217-1" srcset="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png 361w, https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png?w=300 300w" sizes="(max-width: 361px) 100vw, 361px"  ></p>
  643. <p>Visually we can see that the first and second intent are not related. The next sentence&nbsp;<em>&#8220;Has my dog been around other dogs and is it certified?&#8221;</em> is two questions. When we chart this we see:</p>
  644. <p><img data-attachment-id="1775" data-permalink="https://sodoherty.ai/2017/02/06/compound-questions/conv060217-2/" data-orig-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756" data-orig-size="361,262" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="conv060217-2" data-image-description="" data-medium-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756?w=300" data-large-file="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756?w=361" class="size-full wp-image-1775 aligncenter" src="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=756" alt="conv060217-2" srcset="https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png 361w, https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=150 150w, https://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png?w=300 300w" sizes="(max-width: 361px) 100vw, 361px"  ></p>
  645. <p>Very easy to see that there are two questions. So how to do it in your code?</p>
  646. <p>You can use a clustering technique called K-means. This will cluster your data into sets of &#8216;K&#8217;. In this case we have &#8220;important intents&#8221; and &#8220;unimportant intents&#8221;. Two groups, means K = 2.</p>
  647. <p>For this demonstration I am going to use Python, but K-means exists in a number of languages. I have a sample of the full code, and example conversation workspace. So for this I will only show code snippets.</p>
  648. <h3>Walkthrough</h3>
  649. <p>Conversation request&nbsp;needs to set <strong>alternate_intents</strong> to <strong>true</strong>. So that you can get access to the top 10 intents.</p>
  650. <p>Once you get your response back, convert your confidence list into an array.</p>
  651. <pre>intent_confidences = list(o['confidence'] for o in response['intents'])</pre>
  652. <p>Next the main method will return True if it thinks it is a compound question. It requires numpy + scipy.</p>
  653. <pre>def compoundQuestion(intents):
  654. &nbsp; &nbsp; v = np.array(intents)
  655. &nbsp; &nbsp; codebook, _ = kmeans(v,2)
  656. &nbsp; &nbsp; ci, _ = vq(v,codebook)
  657.  
  658. &nbsp; &nbsp; # We want to make everything in the top bucket to have a value of 1.
  659. &nbsp; &nbsp; if ci[0] == 0: ci = 1-ci
  660. &nbsp; &nbsp; if sum(ci) == 2: return True
  661. &nbsp; &nbsp; return False</pre>
  662. <p>The first three lines will take the array of confidences and generate two centroids. A centroid is the mean of each cluster found. It will then group each of the confidences into one of the two centroids.</p>
  663. <p>Once it runs <strong>ci&nbsp;</strong>will look something like this: <strong>[ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 ]</strong> . This however can be the reverse.</p>
  664. <p>The first value is the first intent. So if the first value is 0 we invert the array and then add up all the values:</p>
  665. <p><strong>[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ] =&gt; 2&nbsp;</strong></p>
  666. <p>If we get a value of 2, then the first two intents are related to the question that was entered. Any other value, then we only have one question, or potentially more than two important intents.</p>
  667. <p>Example output from the code:</p>
  668. <pre><strong>Has my dog been around other dogs and other people?</strong>
  669. &gt; Single intent: DOG_SOCIALISATION (0.9876400232315063)
  670.  
  671. <strong>Has my dog been around others dogs and is it certified?</strong>
  672. &gt; This might be a compound question. Intent 1: DOG_SOCIALISATION (0.7363447546958923). Intent 2: DOG_CERTIFICATION (0.6973928809165955).
  673.  
  674. <strong>Has my dog been around other dogs? Has it been around other people?</strong>
  675. &gt; Single intent: DOG_SOCIALISATION (0.992318868637085)
  676.  
  677. <strong>Do I need to get shots for the puppy and deworm it?</strong>
  678. &gt; This might be a compound question. Intent 1: DOG_VACCINATIONS (0.832768440246582). Intent 2: DOG_DEWORMING (0.49955931305885315).</pre>
  679. <p>Of course you still need to write code to take action on both intents, but this might make it a bit easier to handle compound questions.</p>
  680. <p>Here is the <a title="compoundquestionexample" href="https://sodohertydotcom.files.wordpress.com/2017/02/compoundquestionexample.zip">sample code and workspace</a>.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sodohertydotcom.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sodohertydotcom.wordpress.com/1762/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=sodoherty.ai&#038;blog=31007449&#038;post=1762&#038;subd=sodohertydotcom&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  681. <wfw:commentRss>https://sodoherty.ai/2017/02/06/compound-questions/feed/</wfw:commentRss>
  682. <slash:comments>0</slash:comments>
  683. <media:content url="http://0.gravatar.com/avatar/074e6aa01640f2d5425f42e8d7dca51a?s=96&#38;d=identicon&#38;r=G" medium="image">
  684. <media:title type="html">simonodoherty</media:title>
  685. </media:content>
  686.  
  687. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/02/conv060217-1.png" medium="image">
  688. <media:title type="html">conv060217-1</media:title>
  689. </media:content>
  690.  
  691. <media:content url="http://sodohertydotcom.files.wordpress.com/2017/02/conv060217-2.png" medium="image">
  692. <media:title type="html">conv060217-2</media:title>
  693. </media:content>
  694. </item>
  695. </channel>
  696. </rss>
  697.  

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. Add this HTML to your page (change the image src attribute if necessary):

If you would like to create a text link instead, here is the URL you can use:

http://www.feedvalidator.org/check.cgi?url=http%3A//sodoherty.com/feed/

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda