{"id":171,"date":"2022-01-29T22:01:03","date_gmt":"2022-01-29T22:01:03","guid":{"rendered":"http:\/\/aurimas.eu\/blog\/?p=171"},"modified":"2022-07-23T04:58:03","modified_gmt":"2022-07-23T04:58:03","slug":"an-interactive-introduction-to-wavelets-and-discrete-wavelet-transformation-for-data-scientists","status":"publish","type":"post","link":"https:\/\/aurimas.eu\/blog\/2022\/01\/an-interactive-introduction-to-wavelets-and-discrete-wavelet-transformation-for-data-scientists\/","title":{"rendered":"An interactive introduction to wavelets and discrete wavelet transformation for data scientists"},"content":{"rendered":"\n<p>A few weeks ago, our team won Georgia Tech&#8217;s MSc Analytics case competition week sponsored by COX communications. In it, we were asked to build a solution to detect impaired cable transmission signal frequencies, cluster such signals based on similarity of impairments and, leveraging information about the physical network structure, identify potential upstream sources of impairment.<\/p>\n\n\n\n<p>One of the reasons we were able to get to a winning solution was the fact that I happened to learn about this magical thing called discrete wavelet transformation in one of my classes in the fall (ISYE6404 Nonparametric Statistics, in case you&#8217;re wondering). Why magical? Well, I don&#8217;t know how else to describe an approach that allows you to take a ~8700 data points long signal and approximate it with a small set of coefficients (perhaps as few as 100-1000) while keeping approximation error below ~5%. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"298\" src=\"https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/orig_signal.png?resize=567%2C298\" alt=\"\" class=\"wp-image-185\" srcset=\"https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/orig_signal.png?w=567&amp;ssl=1 567w, https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/orig_signal.png?resize=300%2C158&amp;ssl=1 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><figcaption>Original signal<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"566\" height=\"280\" src=\"https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/reconstr_signal.png?resize=566%2C280\" alt=\"\" class=\"wp-image-184\" srcset=\"https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/reconstr_signal.png?w=566&amp;ssl=1 566w, https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/reconstr_signal.png?resize=300%2C148&amp;ssl=1 300w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><figcaption>Reconstructed signal that achieves 95% compression rate with only 3.5% error rate.<\/figcaption><\/figure>\n\n\n\n<p>When I first learned about them, I looked for resources online but a lot of them were too advanced to fully grasp. One exception to the rule was a blog post <a href=\"https:\/\/ataspinar.com\/2018\/12\/21\/a-guide-for-using-the-wavelet-transform-in-machine-learning\/\">A Guide to Using the Wavelet Transform in Machine Learning<\/a> &#8211; I highly recommend reading it through. <\/p>\n\n\n\n<p>In any way, I figured I will create something myself, too. The case competition provided an excellent dataset to build on, and <a href=\"https:\/\/share.streamlit.io\/kamicollo\/intro-to-dwt\/wavelets.py\" target=\"_blank\" rel=\"noreferrer noopener\">The Practical Guide to Discrete Wavelet Transformation<\/a> was born. I hope you find it useful!<\/p>\n\n\n\n<div style=\"padding:20px\" class=\"wp-block-tnp-minimal\"><p>Subscribe for infrequent new posts:<\/p><div><div class=\"tnp tnp-subscription-minimal  \"><form action=\"https:\/\/aurimas.eu\/a\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\" method=\"post\" style=\"text-align: center\"><input type=\"hidden\" name=\"nr\" value=\"minimal\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<input class=\"tnp-email\" type=\"email\" required name=\"ne\" value=\"\" placeholder=\"Email\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<div class=\"tnp-field tnp-privacy-field\"><label><input type=\"checkbox\" name=\"ny\" required class=\"tnp-privacy\"> I agree to to receive new post notifications via email<\/label><\/div><\/form><\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I built a practical intro guide to wavelets and discrete wavelet transformation for data scientists. Welcome to magic!<\/p>\n","protected":false},"author":1,"featured_media":183,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Yay, my first (and hopefully not the last) \"real\" data science post: on the magic of discrete wavelet transformations","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[67],"tags":[78],"class_list":["post-171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-analytics","tag-wavelets"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/aurimas.eu\/a\/wp-content\/uploads\/visualization.png?fit=666%2C300&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paWzzQ-2L","_links":{"self":[{"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":5,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":383,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/posts\/171\/revisions\/383"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/media\/183"}],"wp:attachment":[{"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aurimas.eu\/blog\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}