{"id":2488,"date":"2017-12-18T14:52:52","date_gmt":"2017-12-18T19:52:52","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=2488"},"modified":"2017-12-22T12:50:04","modified_gmt":"2017-12-22T17:50:04","slug":"when-is-a-baked-good-a-cookie","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2017\/12\/18\/when-is-a-baked-good-a-cookie\/","title":{"rendered":"When is a Baked Good a Cookie?"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>This is one time of the year when there is often an abundance of baked goods showing up in my office, and many others no doubt.  And you hear people say things like, \"That's the best cookie I ever had!\".  And sometimes a debate ensues.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2017\/cookies.png\" alt=\"\"> <\/p><p>One problem, of course, is that not all cookies are good. Another is not all baked goods are cookies. Hmmm, there must be some math that could help us out here.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#5f0aaa6c-5128-412a-85a1-ed73012e9e32\">Quantifying \"Cookieness\"<\/a><\/li><li><a href=\"#828336e2-a380-4fb1-a4a6-63c9d8b8a86f\">Methodology<\/a><\/li><li><a href=\"#96b5bf82-5e8e-4f9e-84cd-4f99101ae282\">Outcome<\/a><\/li><\/ul><\/div><h4>Quantifying \"Cookieness\"<a name=\"5f0aaa6c-5128-412a-85a1-ed73012e9e32\"><\/a><\/h4><p>A colleague just pointed out a <a href=\"https:\/\/np.reddit.com\/r\/dataisbeautiful\/comments\/7ke5a6\/the_christmas_cookie_competition_at_my_office\/drdkcgz\/\">thread on Reddit<\/a> where there is a discussion about cookies, and which ones are best.  In an effort to resolve the intense debate, one employee analyzed recipes to determine which ones qualify as a cookie.<\/p><h4>Methodology<a name=\"828336e2-a380-4fb1-a4a6-63c9d8b8a86f\"><\/a><\/h4><p>To do so, the author<\/p><div><ol><li>scraped recipes from the net, including ones including the term \"cookie\" and some other chosen terms,<\/li><li>used the ingredient lists as input to <a href=\"https:\/\/www.mathworks.com\/help\/stats\/pca.html\">principal component analysis<\/a> to reduce the dimensionality of the problem,<\/li><li>applied <a href=\"https:\/\/www.mathworks.com\/discovery\/cluster-analysis.html\">clustering algorithms<\/a> and and <a href=\"https:\/\/www.mathworks.com\/help\/search.html?qdoc=svm+product%3Astats\">support vector machines<\/a> to distinguish between pastries and cookies<\/li><\/ol><\/div><h4>Outcome<a name=\"96b5bf82-5e8e-4f9e-84cd-4f99101ae282\"><\/a><\/h4><p>The conclusion reached - some very tasty tarts did not quality for best cookie!  Do you use MATLAB recreationally?  To learn new concepts that might not yet be relevant for your work, but you are curious about?  We'd love to hear your ideas <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=2488#respond\">here<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_5a0e100bd0344ccd9bb297eca9a8d0d3() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='5a0e100bd0344ccd9bb297eca9a8d0d3 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 5a0e100bd0344ccd9bb297eca9a8d0d3';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2017 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_5a0e100bd0344ccd9bb297eca9a8d0d3()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2017b<br><\/p><\/div><!--\r\n5a0e100bd0344ccd9bb297eca9a8d0d3 ##### SOURCE BEGIN #####\r\n%% When is a Baked Good a Cookie?\r\n% This is one time of the year when there is often an abundance of baked\r\n% goods showing up in my office, and many others no doubt.  And you hear\r\n% people say things like, \"That's the best cookie I ever had!\".  And\r\n% sometimes a debate ensues.\r\n%\r\n% <<cookies.png>>\r\n%\r\n% One problem, of course, is that not all cookies are good. Another is not\r\n% all baked goods are cookies. Hmmm, there must be some math that could\r\n% help us out here.\r\n\r\n%% Quantifying \"Cookieness\"\r\n% A colleague just pointed out a\r\n% <https:\/\/np.reddit.com\/r\/dataisbeautiful\/comments\/7ke5a6\/the_christmas_cookie_competition_at_my_office\/drdkcgz\/\r\n% thread on Reddit> where there is a discussion about cookies, and which\r\n% ones are best.  In an effort to resolve the intense debate, one employee\r\n% analyzed recipes to determine which ones qualify as a cookie.\r\n%% Methodology\r\n% To do so, the author \r\n%\r\n% # scraped recipes from the net, including ones including the term\r\n% \"cookie\" and some other chosen terms,\r\n% # used the ingredient lists as input to\r\n% <https:\/\/www.mathworks.com\/help\/stats\/pca.html principal component\r\n% analysis> to reduce the dimensionality of the problem,\r\n% # applied <https:\/\/www.mathworks.com\/discovery\/cluster-analysis.html\r\n% clustering algorithms> and and\r\n% <https:\/\/www.mathworks.com\/help\/search.html?qdoc=svm+product%3Astats\r\n% support vector machines> to distinguish between pastries and cookies\r\n%% Outcome\r\n% The conclusion reached - some very tasty tarts did not quality for best\r\n% cookie!  Do you use MATLAB recreationally?  To learn new concepts that\r\n% might not yet be relevant for your work, but you are curious about?  We'd\r\n% love to hear your ideas <https:\/\/blogs.mathworks.com\/loren\/?p=2488#respond\r\n% here>.\r\n\r\n\r\n\r\n\r\n##### SOURCE END ##### 5a0e100bd0344ccd9bb297eca9a8d0d3\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2017\/cookies.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>This is one time of the year when there is often an abundance of baked goods showing up in my office, and many others no doubt.  And you hear people say things like, \"That's the best cookie I ever had!\".  And sometimes a debate ensues.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2017\/12\/18\/when-is-a-baked-good-a-cookie\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[33,48],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/2488"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=2488"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/2488\/revisions"}],"predecessor-version":[{"id":2492,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/2488\/revisions\/2492"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=2488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=2488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=2488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}