{
    "componentChunkName": "component---src-templates-docs-js",
    "path": "/assignments/a2",
    "result": {"data":{"site":{"siteMetadata":{"title":"Linnaeus University","language":"en"}},"mdx":{"fields":{"id":"3de7f2e8-3db4-592c-9960-4429f594ddc5","title":"A2 - Clustering","slug":"/assignments/a2"},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"A2 - Clustering\",\n  \"metaTitle\": \"2DV515 | A2\",\n  \"metaDescription\": \"metaDescription\",\n  \"order\": 2\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar Hint = makeShortcode(\"Hint\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", null, \"Description\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"In this assignment, you shall implement clustering on the blogs dataset containing 99 blogs.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"You can use any programming language you like.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"You shall present your application and code at an oral examination.\")), mdx(\"h2\", null, \"Submission instructions\"), mdx(\"p\", null, \"See the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"../study-guide/deadlines-and-submissions\"\n  }, \"Deadlines and Submissions\"), \" page.\"), mdx(\"h2\", null, \"Requirements\"), mdx(\"table\", null, mdx(\"tr\", null, mdx(\"th\", null, \"Grade\"), mdx(\"th\", null, \"Requirements\")), mdx(\"tr\", null, mdx(\"td\", null, \"E\"), mdx(\"td\", null, mdx(\"ul\", null, mdx(\"li\", null, \"Implement K-means Clustering with Pearson similarity.\"), mdx(\"li\", null, \"Run the algorithm on the \", mdx(\"em\", null, \"blog data\"), \" dataset (see \", mdx(\"a\", {\n    href: \"datasets\"\n  }, \"Datasets\"), \" page) with five clusters.\"), mdx(\"li\", null, \"The iteration shall stop after a specified number of iterations.\"), mdx(\"li\", null, \"Present the result as a list of clusters and their assignments.\"), mdx(\"li\", null, \"Implement the system using a REST web service where:\", mdx(\"ol\", null, mdx(\"li\", null, \"client sends a request to a server.\"), mdx(\"li\", null, \"the server responds with \", mdx(\"em\", null, \"json\"), \" data.\"), mdx(\"li\", null, \"the \", mdx(\"em\", null, \"json\"), \" data is decoded and presented in a client GUI.\")))))), mdx(\"tr\", null, mdx(\"td\", null, \"C-D\"), mdx(\"td\", null, mdx(\"ul\", null, mdx(\"li\", null, \"Instead of stopping after a specified number of iterations, you shall implement functionality for stopping when no new assignments are made.\"), mdx(\"li\", null, \"Each cluster must keep track of the previous assignment, and a check is made if the new cluster assignment matches the previous one.\")))), mdx(\"tr\", null, mdx(\"td\", null, \"A-B\"), mdx(\"td\", null, mdx(\"ul\", null, mdx(\"li\", null, \"Implement Hierarchical Clustering with Pearson similarity.\"), mdx(\"li\", null, \"Run the algorithm on the \", mdx(\"em\", null, \"blog data\"), \" dataset.\"), mdx(\"li\", null, \"Present the result as an interactive tree in the client GUI (it shall be possible to expand/collapse branches).\"))))), mdx(\"h2\", null, \"Test cases\"), mdx(\"h3\", null, \"K-means\"), mdx(\"p\", null, \"K-means is not deterministic (the results differ between runs), but you usually find related blogs such as the Google and search engine blogs in one cluster as shown here:\"), mdx(\"p\", null, mdx(\"span\", {\n    parentName: \"p\",\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"338px\"\n    }\n  }, \"\\n      \", mdx(\"a\", {\n    parentName: \"span\",\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/courses/web-intelligence-ht24/static/a8c33bde537c9fc1ee4522aae83e4084/2b41d/A2-Kmeans.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }, \"\\n    \", mdx(\"span\", {\n    parentName: \"a\",\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"151.35135135135135%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAACXBIWXMAAAsTAAALEwEAmpwYAAACuElEQVRIx52WCVPqQBCE+f8/S63yQFBub5RLE0RMJJdXv/rG2kgBIfJStbWBZHu7Z3pmU0nTTFmWKJr3NR6PdHFxoeFwqPl8rsvLS729vYnr+/tbf7kqcZIoSSK9eh2NhgM1Gg3d3NxoOp2q0+koCILdAJMkUZpECvyeATabTV1dXWkymRjT/wBMlSaxAr+bA15fX2s0Gmk8HudAq3MhYBTFiqOFwukPw1a7rdvbW2MIcBzHOdBfWFaCIFQYvprkyXikWq1ukh8fHw04iqLdGL6/v+vz81NJmtm8WCwsGfV6Xd1uV+fn58aUZ8tMizaoZFkmQFPLdirP8w2o1Wqp1+spDMMcbPkqYpoDWrbTVM/Pzzo7OzP79Pt9fX196ePjw94BhJnfRaBrgLPZzBje39/r6OhIp6enarfbtsHBwYGq1ar29vb08PCwXTKA3Pu+b3IZd3d3ZiM2gCkDAELAmu0xTNOcIUkgMVQMmR4MBnkcHeifJRNDJFLTyCPrRVcpIPee5xk7BkkBlEEMCUOtVrNR5M8lyb8MWUzsiCFyX15e7H/C4ebVTK8BOsksxtR4kAzTdcrkLt9vjKGrDmcV4gnbw8NDHR8fm53cM9huZQggcokhsUMy75BlnnPPjGTWkPUSwJnt7uLoJLuFZfLXAAEghsgmy5sWr47SpGAPwDA20rGJq5ayFrbRNrCjQkgGwGScTYrKbaux6dSNxo9cQGEIOwbvlJXfGkNXy8iFIYCw3rn0liUjEUAGzADmSMCLbqbxlrYvDn0AT05ODISeh30cKNmnT9KAmZ385da2lmXfn1q3QSpM3PkCIIkpPfVWk/L05JmhAYUhbGDISQgwYYCdsxThcc/5bFmLIcbGNtQri/i+cTEF0J2GuICyBBQw1NA7N9YyMXSS6TgYm0VO/v7+vn1ZbJL8Dzg16f2rExhMAAAAAElFTkSuQmCC')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  }), \"\\n  \", mdx(\"img\", {\n    parentName: \"a\",\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"resources/A2-Kmeans.png\",\n    \"title\": \"resources/A2-Kmeans.png\",\n    \"src\": \"/courses/web-intelligence-ht24/static/a8c33bde537c9fc1ee4522aae83e4084/2b41d/A2-Kmeans.png\",\n    \"srcSet\": [\"/courses/web-intelligence-ht24/static/a8c33bde537c9fc1ee4522aae83e4084/a2ead/A2-Kmeans.png 259w\", \"/courses/web-intelligence-ht24/static/a8c33bde537c9fc1ee4522aae83e4084/2b41d/A2-Kmeans.png 338w\"],\n    \"sizes\": \"(max-width: 338px) 100vw, 338px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\",\n    \"decoding\": \"async\"\n  }), \"\\n  \"), \"\\n    \")), mdx(Hint, {\n    mdxType: \"Hint\"\n  }, \"Note that you can make some performance improvements to speed up the cluster generation. In comparison, my implementation in Python takes around 3 seconds to generate the clusters and build a JSON response.\"), mdx(\"h3\", null, \"Hierarchical\"), mdx(\"p\", null, \"Hierarchical clustering always gives the same result. The tree is too large to show here, but if you get the branch shown below, it most likely works correctly:\"), mdx(\"p\", null, mdx(\"span\", {\n    parentName: \"p\",\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"375px\"\n    }\n  }, \"\\n      \", mdx(\"a\", {\n    parentName: \"span\",\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/courses/web-intelligence-ht24/static/98cb26960ca2aaa79b4abc7f4446807b/5ff7e/A2-Hierarchical.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }, \"\\n    \", mdx(\"span\", {\n    parentName: \"a\",\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"85.71428571428571%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1UlEQVQ4y5VUaY+qQBD0//8rY/zibbxPUOOJrMDIMDOA9dK9gbDIHs+kHaZpiqquHmqeHyAMHISPLf7n93q9KvM1+ouNhgwDaB1jt9thtVphsVhgNBphu93ynmI6nXI+TdMctAzMgEppeJ4HKRzc73eO6/WK4/EI13VxuVx4f7vdOPcTy0+GcQIZCgT39VthkiRvbJRS+f6NYTEhIwWlDdbrNZrNJkvsdrtotVoYDodoNBqYzWao1+usooplDpimCfxAwLvOkRjxqynFPlYC0krSQ/GBODZw3QcbQWwzk+i6KLO85j0sy9bRE65zhmXZ7PrhcIBtf15XgX0BLN8IRIjQP0OJ05/kVo5NeQyMiSGl4p4OBgM2ZjweszntdhudTgebzSYHp8ierRXflCXF8wnv4wbpH5AUimmEvjshGU4lQ1qMlhDeGUn64oE+nU5wHOfLSgNP/d3v9zDGvEsug4ZSIXz6sG2LZ5Iens/nHNmRpDwd0SiKqnuYAcZxDN/38biM6c6fPxiVDIvORzRGWvMZnkwmzGi5XDJL2luWhX6/z+aR7NpPnyZyT6mIC2kGyeVer8dBICSVJoDkk2Sq/5ZhFlREgCQ/M4BMIhAyhV4khMgl/wNphh9SjsO/sgAAAABJRU5ErkJggg==')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  }), \"\\n  \", mdx(\"img\", {\n    parentName: \"a\",\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"resources/A2-Hierarchical.png\",\n    \"title\": \"resources/A2-Hierarchical.png\",\n    \"src\": \"/courses/web-intelligence-ht24/static/98cb26960ca2aaa79b4abc7f4446807b/5ff7e/A2-Hierarchical.png\",\n    \"srcSet\": [\"/courses/web-intelligence-ht24/static/98cb26960ca2aaa79b4abc7f4446807b/a2ead/A2-Hierarchical.png 259w\", \"/courses/web-intelligence-ht24/static/98cb26960ca2aaa79b4abc7f4446807b/5ff7e/A2-Hierarchical.png 375w\"],\n    \"sizes\": \"(max-width: 375px) 100vw, 375px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\",\n    \"decoding\": \"async\"\n  }), \"\\n  \"), \"\\n    \")), mdx(Hint, {\n    mdxType: \"Hint\"\n  }, \"Note that there are many performance improvements you can make to speed up tree generation. As a comparison, my implementation in Python takes around 10 seconds to generate the tree and build a JSON response.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#description","title":"Description"},{"url":"#submission-instructions","title":"Submission instructions"},{"url":"#requirements","title":"Requirements"},{"url":"#test-cases","title":"Test cases","items":[{"url":"#k-means","title":"K-means"},{"url":"#hierarchical","title":"Hierarchical"}]}]},"parent":{"relativePath":"assignments/a2.md"},"frontmatter":{"metaTitle":"2DV515 | A2","metaDescription":"metaDescription"}},"allMdx":{"edges":[{"node":{"fields":{"slug":"/","title":"Web Intelligence (2DV515)"}}},{"node":{"fields":{"slug":"/_playground/_todo-examination","title":"TODO: Examination"}}},{"node":{"fields":{"slug":"/_playground/expectations","title":"Expectations"}}},{"node":{"fields":{"slug":"/_playground","title":"Playground"}}},{"node":{"fields":{"slug":"/assignments/a1","title":"A1 - Recommendation System"}}},{"node":{"fields":{"slug":"/assignments/a2","title":"A2 - Clustering"}}},{"node":{"fields":{"slug":"/assignments/a3","title":"A3 - Search Engine"}}},{"node":{"fields":{"slug":"/assignments/a4","title":"A4 - Machine Learning"}}},{"node":{"fields":{"slug":"/assignments/datasets","title":"Datasets"}}},{"node":{"fields":{"slug":"/assignments","title":"Assignments"}}},{"node":{"fields":{"slug":"/lectures","title":"Lectures"}}},{"node":{"fields":{"slug":"/lectures/lecture01","title":"L01 - Introduction"}}},{"node":{"fields":{"slug":"/lectures/lecture02","title":"L02 - Recommendation Systems"}}},{"node":{"fields":{"slug":"/lectures/lecture03","title":"L03 - Clustering"}}},{"node":{"fields":{"slug":"/lectures/lecture04","title":"L04 - Search Engines"}}},{"node":{"fields":{"slug":"/lectures/lecture05","title":"L05 - What is Machine Learning?"}}},{"node":{"fields":{"slug":"/lectures/lecture06","title":"L06 - Data and Learning"}}},{"node":{"fields":{"slug":"/lectures/lecture07","title":"L07 - Naïve Bayes"}}},{"node":{"fields":{"slug":"/projects","title":"Projects"}}},{"node":{"fields":{"slug":"/projects/p1","title":"P1 – Recommendation System"}}},{"node":{"fields":{"slug":"/projects/p2","title":"P2 – Clustering"}}},{"node":{"fields":{"slug":"/projects/p3","title":"P3 – Text Classification"}}},{"node":{"fields":{"slug":"/projects/p4","title":"P4 – Web scraping"}}},{"node":{"fields":{"slug":"/projects/project","title":"Project"}}},{"node":{"fields":{"slug":"/sandbox/basic-elements","title":"Basic elements"}}},{"node":{"fields":{"slug":"/sandbox/code","title":"Code"}}},{"node":{"fields":{"slug":"/sandbox/exercise","title":"Exercises"}}},{"node":{"fields":{"slug":"/sandbox/frontmatter","title":"Frontmatter"}}},{"node":{"fields":{"slug":"/sandbox/hint","title":"Hint"}}},{"node":{"fields":{"slug":"/sandbox","title":"Sandbox"}}},{"node":{"fields":{"slug":"/sandbox/markdown-import","title":"Imported markdown"}}},{"node":{"fields":{"slug":"/sandbox/mermaid","title":"Mermaid"}}},{"node":{"fields":{"slug":"/sandbox/tabs","title":"Tabs"}}},{"node":{"fields":{"slug":"/sandbox/youtube","title":"YouTube"}}},{"node":{"fields":{"slug":"/study-guide/communication","title":"Communication"}}},{"node":{"fields":{"slug":"/study-guide/deadlines-and-submissions","title":"Deadlines and Submissions"}}},{"node":{"fields":{"slug":"/study-guide/grading","title":"Grading"}}},{"node":{"fields":{"slug":"/study-guide/registration","title":"Registration"}}},{"node":{"fields":{"slug":"/study-guide/welcome","title":"🎉 Welcome"}}},{"node":{"fields":{"slug":"/projects/_DEPRECATED/project","title":"Project"}}},{"node":{"fields":{"slug":"/study-guide/guides/an-introduction-to-git","title":"An introduction to Git"}}},{"node":{"fields":{"slug":"/study-guide/guides/git-and-multiple-computers","title":"Git and multiple computers"}}},{"node":{"fields":{"slug":"/study-guide/guides/git-commit-best-practices","title":"Git commit best practices"}}},{"node":{"fields":{"slug":"/study-guide/guides","title":"Guides"}}},{"node":{"fields":{"slug":"/study-guide/guides/set-up-git","title":"Set up Git"}}},{"node":{"fields":{"slug":"/study-guide/guides/multiple-git-user-configs","title":"Multiple Git user configs"}}},{"node":{"fields":{"slug":"/study-guide/guides/submit-an-assignment-as-a-merge-request","title":"Submit an assignment as a merge request"}}},{"node":{"fields":{"slug":"/study-guide/guides/this-happens-with-git-commands","title":"This happens with Git commands"}}},{"node":{"fields":{"slug":"/study-guide/guides/troubleshooting-ssh","title":"Troubleshooting SSH"}}},{"node":{"fields":{"slug":"/study-guide/readings","title":"Readings"}}},{"node":{"fields":{"slug":"/study-guide/instructors","title":"Instructors"}}},{"node":{"fields":{"slug":"/study-guide","title":"Study Guide"}}}]}},"pageContext":{"id":"3de7f2e8-3db4-592c-9960-4429f594ddc5"}},
    "staticQueryHashes": ["253607798","3706406642","710574383"]}