{"id":451,"date":"2024-06-23T10:41:07","date_gmt":"2024-06-23T10:41:07","guid":{"rendered":"https:\/\/alandix.com\/labs\/?page_id=451"},"modified":"2025-03-20T16:10:31","modified_gmt":"2025-03-20T16:10:31","slug":"qbb","status":"publish","type":"page","link":"https:\/\/alandix.com\/labs\/qbb\/","title":{"rendered":"Query-by-Browsing"},"content":{"rendered":"\n<p class=\"has-text-align-center has-text-color\" style=\"color:#764499;font-size:1.5em\">intelligent transparent database access<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-font-size is-style-fill has-medium-font-size\"><a class=\"wp-block-button__link has-black-color has-text-color has-background wp-element-button\" href=\"https:\/\/datatodata.com\/qbb\/qbb-demo.html\" style=\"border-radius:25px;background-color:#bcaed0\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>try QbB now!<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Query-by-Browsing (QbB) is an intelligent database interface, that was originally envisaged more than 30 years ago, to highlight the potential danger of social, gender and ethnic bias in black-box machine learning systems, and to demonstrate how these dangers could be ameliorated through transparency and effective user interaction.<\/p>\n\n\n\n<p>The basic idea is the user starts to select records that there are or are not interested in (marked (1) in the annotated screenshot below) and then, when asked (2) the system suggests a potential database query that agrees with the user choices so far.  Crucially both the inferred query (3) and the records selected (4) are presented back to the user to make it easy to assess whether the inferred query is indeed what is wanted.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"462\" src=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-1024x462.png\" alt=\"\" class=\"wp-image-453\" srcset=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-1024x462.png 1024w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-300x135.png 300w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-768x347.png 768w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-1536x693.png 1536w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-2048x924.png 2048w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-behaviour-new-500x226.png 500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the web demo you can experiment with one of the small example databases and also add your own CSV files.  Any data you add is stored in your browser data and will be available when you revisit QbB so long as you don&#8217;t clear the browser data for the site.,<\/p>\n\n\n\n<p>Under the bonnet, the positive and negative examples selected by the user are fed into a machine learning system, that generates a decision tree, which is then translated into an SQL query, as this is the most common database query notation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"649\" src=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works-1024x649.png\" alt=\"\" class=\"wp-image-454\" srcset=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works-1024x649.png 1024w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works-300x190.png 300w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works-768x487.png 768w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works-1536x973.png 1536w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works-473x300.png 473w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-how-it-works.png 2020w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">History and variants<\/h1>\n\n\n\n<p>There have been several variants over the years.  The current <a href=\"https:\/\/datatodata.com\/qbb\/qbb-demo.html\" target=\"_blank\" rel=\"noreferrer noopener\">web demo<\/a> uses a variant of ID3, a machine learning algorithm that infers a decision tree, so is intrinsically more &#8216;explainable&#8217; than many types of ML.  This was the form initially proposed in the <a href=\"https:\/\/alandix.com\/academic\/papers\/neuro92\/\" target=\"_blank\" rel=\"noreferrer noopener\">1992 paper<\/a>, which introduced QbB, however one variant also used a Query-by-Example style tableau and rules learnt using a genetic algorithm.  A semantic web variant was also produced in the 2010s, but never published.  Query-by-Browsing was also used as a case study in the <a href=\"https:\/\/alandix.com\/aibook\/first-edition\/\" target=\"_blank\" rel=\"noreferrer noopener\">introductory AI textbook<\/a> that Janet Finlay and I published in 1996, and also features in the <a href=\"https:\/\/alandix.com\/aibook\/second-edition\/\" target=\"_blank\" rel=\"noreferrer noopener\">new edition<\/a>, with is currently in press.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"419\" src=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1-1024x419.png\" alt=\"\" class=\"wp-image-457\" srcset=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1-1024x419.png 1024w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1-300x123.png 300w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1-768x314.png 768w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1-1536x628.png 1536w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1-500x204.png 500w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-original-envisionment-1992-1.png 1813w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>First envisionment of Query-by-browsing in 1992 <\/strong><br>(<a href=\"https:\/\/alandix.com\/academic\/papers\/neuro92\/\" target=\"_blank\" rel=\"noreferrer noopener\">A. Dix, 1992. Human issues in the use of pattern recognition techniques.<\/a> In&nbsp;<em>Neural Networks and Pattern Recognition in Human Computer Interaction<\/em>&nbsp;Eds. R. Beale and J. Finlay. Ellis Horwood. 429-451.)<\/figcaption><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"596\" src=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994-1024x596.png\" alt=\"\" class=\"wp-image-458\" srcset=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994-1024x596.png 1024w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994-300x175.png 300w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994-768x447.png 768w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994-1536x895.png 1536w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994-500x291.png 500w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-mac-1994.png 1698w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>First implemented version of QbB on Macintosh 1994<\/strong><br>(<a href=\"https:\/\/alandix.com\/academic\/papers\/QbB-IDS94\/\" data-type=\"link\" data-id=\"https:\/\/alandix.com\/academic\/papers\/QbB-IDS94\/\" target=\"_blank\" rel=\"noreferrer noopener\">A. Dix and A. Patrick, 1994. Query By Browsing<\/a>. <em>Proceedings of IDS&#8217;94: The 2nd International Workshop on User Interfaces to Databases,<\/em>&nbsp;Ed. P. Sawyer. Lancaster, UK, Springer Verlag. 236-248.)<\/figcaption><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"999\" src=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-windows-variant-1998-1-1024x999.png\" alt=\"\" class=\"wp-image-459\" srcset=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-windows-variant-1998-1-1024x999.png 1024w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-windows-variant-1998-1-300x293.png 300w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-windows-variant-1998-1-768x749.png 768w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-windows-variant-1998-1-307x300.png 307w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-windows-variant-1998-1.png 1520w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Windows version in 1998 with relational Query0by-Browsing-style tableau<\/strong><br>(<a href=\"https:\/\/www.alandix.com\/academic\/papers\/IQ98\/\" target=\"_blank\" rel=\"noreferrer noopener\">A. Dix, 1998. Interactive Querying &#8211; locating and discovering information<\/a>. <em>Second Workshop on&nbsp;Information Retrieval and Human Computer Interaction<\/em>, Glasgow, 11th September 1998.)<\/figcaption><\/figure>\n\n\n\n<p>The first web version was created around New Year 2005, initially using a CGI backend written in C.  This was later translated into PHP.  The current <a href=\"https:\/\/datatodata.com\/qbb\/qbb-demo.html\" target=\"_blank\" rel=\"noreferrer noopener\">web demo<\/a> retains the look and feel of this 2000s web version, but as a single page web app with the machine learning running in Javascript.  In addition, it allows the upload of the user&#8217;s own CSV file.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Bias and discrimination<\/h1>\n\n\n\n<p>As noted, the first envisionment of Query-by-Browsing was in a 1991 talk and later 1992 book chapter <a href=\"https:\/\/alandix.com\/academic\/papers\/neuro92\/\" target=\"_blank\" rel=\"noreferrer noopener\">Human issues in the use of pattern recognition techniques<\/a>, which was probably the first publication to highlight the potential dangers of gender, ethnic and social bias in black-box machine learning algorithms. It was written at the hight of excitement in AI around 1990, and just before the great &#8216;AI Winter&#8217;. At the time I thought that discriminatory uses of AI would arise within the next five years. In fact it took more like 25 years before these became a problem, so in many way the paper was far too early to be a useful warning.<\/p>\n\n\n\n<p>The core idea of the dual list and query (<em><a href=\"https:\/\/alandix.com\/glossary\/aibook\/extensional%20representation\" target=\"_blank\" rel=\"noreferrer noopener\">extensional<\/a><\/em> and <em><a href=\"https:\/\/alandix.com\/glossary\/aibook\/intensional%20representation\">intensional<\/a><\/em>) representation in QbB was to help the user see if the machine learning was using a potential biased rule, that is what would now be considered <a href=\"https:\/\/alandix.com\/glossary\/aibook\/explainable%20ai\" target=\"_blank\" rel=\"noreferrer noopener\">explainable AI<\/a>. The screen shot below shows an example of this using the <a href=\"https:\/\/datatodata.com\/qbb\/qbb-demo.html\" target=\"_blank\" rel=\"noreferrer noopener\">web demo<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"440\" src=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias-1024x440.png\" alt=\"\" class=\"wp-image-460\" srcset=\"https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias-1024x440.png 1024w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias-300x129.png 300w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias-768x330.png 768w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias-1536x661.png 1536w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias-500x215.png 500w, https:\/\/alandix.com\/labs\/files\/2024\/06\/qbb-showing-potential-bias.png 1860w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The web demo also allows you to switch between SQL and tree versions of the query.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"403\" src=\"https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact-1024x403.png\" alt=\"\" class=\"wp-image-532\" srcset=\"https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact-1024x403.png 1024w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact-300x118.png 300w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact-768x302.png 768w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact-1536x605.png 1536w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact-500x197.png 500w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-tree-view-compact.png 2009w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Local explanation<\/h1>\n\n\n\n<p>As well as the transparency of the query, you can explore the system query in more detail.<\/p>\n\n\n\n<p>If you hover the mouse over a row in the table you can see the line of query choices that led to the row being selected or not.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"457\" src=\"https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact-1024x457.png\" alt=\"\" class=\"wp-image-534\" srcset=\"https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact-1024x457.png 1024w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact-300x134.png 300w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact-768x343.png 768w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact-1536x686.png 1536w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact-500x223.png 500w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-1-compact.png 1952w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Similarly if you hover over part of the query, you can see the data roes that satisfy the branch of the query.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"458\" src=\"https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact-1024x458.png\" alt=\"\" class=\"wp-image-533\" srcset=\"https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact-1024x458.png 1024w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact-300x134.png 300w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact-768x343.png 768w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact-1536x687.png 1536w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact-500x224.png 500w, https:\/\/alandix.com\/labs\/files\/2025\/03\/QbB-v2a-local-explanation-2-compact.png 1953w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">User Explanations<\/h1>\n\n\n\n<p>User explanations are when the user offers some guidance as to what it important either for data as a whole (global user guidance) or a specific example (local user explanations).  The general AI-UI design principle is described in more detail in \u201c<a href=\"https:\/\/alandix.com\/academic\/papers\/AXAI2025-talking-back\/\" target=\"_blank\" rel=\"noreferrer noopener\">Talking Back: human input and explanations to interactive AI systems<\/a>\u201d.  QbB supports both, although to a limited degree, mainly as an proof of concept.<\/p>\n\n\n\n<p><em>Global user guidance<\/em>  \u2013 Click row headers to toggle between important (red border), ignore (grey) or standard.\u00a0 The query refreshes taking into account these preferences .\u00a0 Columns marked &#8216;ignore&#8217; are not used at all by the machine learning, whereas those marked as &#8216;important&#8217; are given preference when it creates the query.  In the screenshot below the Wage column is marked as important so the query uses this rather than a simpler query using names.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/alandix.com\/wp-content\/uploads\/2025\/03\/QbB-v3-global-user-feedback-1024x695.png\" alt=\"\" class=\"wp-image-2971\"\/><\/figure>\n\n\n\n<p><em>Local user explanations<\/em> \u2013 Click data cells in individual rows to toggle between important (red border), not important (grey) or standard.\u00a0 This means that for this particular example the relevant field is more or less important.\u00a0 Note that is a <em>local<\/em> explanation, just because a field is important for this record selection, it does not mean it is important for them all.  In the same example with the column headers all equally important, but the cell with contents &#8216;Tom&#8217; annotated as unimportant (grey).\u00a0 The generated query does not use this value.\u00a0 However, note that while the algorithm does its best to follow the preferences, it may not always be able to do so.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/alandix.com\/wp-content\/uploads\/2025\/03\/QbB-v3-local-user-feedback-1024x695.png\" alt=\"\" class=\"wp-image-2970\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>intelligent transparent database access Query-by-Browsing (QbB) is an intelligent database interface, that was originally envisaged more than 30 years ago, to highlight the potential danger of social, gender and ethnic bias in black-box machine learning systems, and to demonstrate how &hellip; <a href=\"https:\/\/alandix.com\/labs\/qbb\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":510,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"class_list":["post-451","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/pages\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":6,"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/pages\/451\/revisions"}],"predecessor-version":[{"id":537,"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/pages\/451\/revisions\/537"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/media\/510"}],"wp:attachment":[{"href":"https:\/\/alandix.com\/labs\/wp-json\/wp\/v2\/media?parent=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}