{"id":2138463,"date":"2020-11-17T14:11:03","date_gmt":"2020-11-17T08:41:03","guid":{"rendered":"http:\/\/stockviz.biz\/index.php\/?p=2138463"},"modified":"2020-11-17T14:11:17","modified_gmt":"2020-11-17T08:41:17","slug":"euclidean-distance-for-pattern-matching","status":"publish","type":"post","link":"https:\/\/stockviz.biz\/index.php\/2020\/11\/17\/euclidean-distance-for-pattern-matching\/","title":{"rendered":"Euclidean Distance for Pattern Matching"},"content":{"rendered":"\n<p>Most of us have learnt how to calculate the distance between 2 points on a plane in high school. The simplest one is called the Euclidean Distance &#8211; a pretty basic application of the Pythagorean Theorem. The concept can be extended to calculate the distance between to vectors. This is where it gets interesting.<\/p>\n\n\n\n<p>Suppose you want to match a price series with another, ranking a rolling window by its Euclidean Distance is the fastest and simplest way of pattern matching.<\/p>\n\n\n\n<p>For example, take the most recent 20-day VIX time-series and &#8220;match&#8221; it with a rolling window of historical 20-day VIX segments and sort it by its Euclidean Distance (ED.)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/volatility\/vix-match\/closest-euclidean.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>Here, the ED has dug up a segment from November-2010 as one of the top 5 matches. Take a closer look:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/volatility\/vix-match\/closest-match-euclidean.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>While not a perfect match, it &#8220;sort of&#8221; comes close.<\/p>\n\n\n\n<p>Sometimes, a simple tool is good enough to get you 80% of the way. This is one of them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of us have learnt how to calculate the distance between 2 points on a plane in high school. The simplest one is called the Euclidean Distance &#8211; a pretty basic application of the Pythagorean Theorem. The concept can be extended to calculate the distance between to vectors. This is where it gets interesting. Suppose &hellip; <\/p>\n","protected":false},"author":2,"featured_media":2106273,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3471],"tags":[2761,3221],"class_list":["post-2138463","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-investing-insight","tag-quant","tag-vix","entry"],"_links":{"self":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/2138463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/comments?post=2138463"}],"version-history":[{"count":0,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/2138463\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media\/2106273"}],"wp:attachment":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media?parent=2138463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/categories?post=2138463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/tags?post=2138463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}