<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Demyank's Tlog</title>
    <link>https://demyank.tistory.com/</link>
    <description>For organizing technical knowledge and experience.
demyank88@gmail.com</description>
    <language>ko</language>
    <pubDate>Thu, 6 Aug 2026 19:24:03 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>데먕</managingEditor>
    <image>
      <title>Demyank's Tlog</title>
      <url>https://tistory1.daumcdn.net/tistory/3215274/attach/f199a552990d42d7b970a05118cc202a</url>
      <link>https://demyank.tistory.com</link>
    </image>
    <item>
      <title>[패스트캠퍼스] AI 기술을 활용한 의료 데이터 분석과 바이오 진단 학습후기</title>
      <link>https://demyank.tistory.com/922</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;전반적으로 강의에서 소개되는 기술들은 현재 서비스나 제품에서 활용되는 최신 기술들이라기보다는 몇 년전까지 사용되던 기술들이라는 인상을 받았다. 다만, 최신 기술들도 결국에는 해당 기술들의 아이디어나 한계점을 개선하기 위한 방법들이기 결국 모두 알아야하는 내용들이라고 판단되었기 때문에 관심을 가지고 수강하게 되었다. 해당 강의에서 절반은 MLP, CNN, RNN, Transformer, GAN 등 주요 Deep Learning 기초들을 다루고 있고 나머지 절반은 의료에서 주로 사용되는 데이터처리, 학습방법, 평가방법, 응용 분야 등을 다루고 있다. 워낙 다루는 범위가 넓다보니 하나의 기술이나 논문에 대해서 짧게는 몇 십초에서 길게는 몇 분정도의 분량을 가지고 있다. 하지만 해당 기술들이나 논문에 대해서 너무 개괄적으로 설명하기 때문에 처음 접하는 내용들에 대해서는 해당 강의만으로는 이해하기 어려웠다. 따라서 해당 강의 내용들을 entry point로 보다 깊은 이해를 위해 NotebookLM, ChatGPT, 그리고 Gemini 등을 통해서 보다 깊은 이해를 할 수 있었다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1057&quot; data-origin-height=&quot;896&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bP9wpM/btsNWisDW70/YJKP3GtkB9fwNioVuJe9g0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bP9wpM/btsNWisDW70/YJKP3GtkB9fwNioVuJe9g0/img.png&quot; data-alt=&quot;NotebookLM&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bP9wpM/btsNWisDW70/YJKP3GtkB9fwNioVuJe9g0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbP9wpM%2FbtsNWisDW70%2FYJKP3GtkB9fwNioVuJe9g0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;708&quot; height=&quot;600&quot; data-origin-width=&quot;1057&quot; data-origin-height=&quot;896&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;NotebookLM&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;앞서 말한바와 같이 9차시까지는 주로 MLP, Deep Learning의 기초에 관한 내용으로 이미 널리 알려진 내용들을 다루고 있고 해당 내용에 대해서 이미 접한 경험이 있기 때문에 리마인드 차원에서 빠르게 훑어보았다.&amp;nbsp;이하로는 내가 이 강의를 통해서 주로 관심있게 시청하였던 Object Detection, Instance Segmentation에 관하여 키워드들을 정리해놓았다.&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Image Segmentation&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;ROI 분할&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;challenges: a lot of noise, hard to acquire a perfect annotation, bias of annotators&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Preprocessing&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;pretrained model, patching, and oversampling&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Augmentation&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;flipping, cropping, rotation, color jitter, cutout, mixup, cutmix&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Architecture&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;UNET&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Deep Lab&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Atrous convolution: dilate rate를 조절하여 receptive field를 키움&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;565&quot; data-origin-height=&quot;265&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bLXjsI/btsNXYs0K4K/qpsSFJQQZjhzoBhsY3OqLK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bLXjsI/btsNXYs0K4K/qpsSFJQQZjhzoBhsY3OqLK/img.png&quot; data-alt=&quot;DeepLab - atrous convolution&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bLXjsI/btsNXYs0K4K/qpsSFJQQZjhzoBhsY3OqLK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbLXjsI%2FbtsNXYs0K4K%2FqpsSFJQQZjhzoBhsY3OqLK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;565&quot; height=&quot;265&quot; data-origin-width=&quot;565&quot; data-origin-height=&quot;265&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;DeepLab - atrous convolution&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; text-align: center;&quot;&gt;Astrou spatial pyramid pooling (ASPP): multi-scale kernel에 대해서 다양한 receptive field 얻어 다양한 position에 대하여 학습&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;663&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/E0dDI/btsNX3nvLke/54pkFKy0kYKxT8yJG4wuJ1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/E0dDI/btsNX3nvLke/54pkFKy0kYKxT8yJG4wuJ1/img.png&quot; data-alt=&quot;DeepLab - astrou spatial pyramid pooling (ASPP)&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/E0dDI/btsNX3nvLke/54pkFKy0kYKxT8yJG4wuJ1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FE0dDI%2FbtsNX3nvLke%2F54pkFKy0kYKxT8yJG4wuJ1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;663&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;663&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;DeepLab - astrou spatial pyramid pooling (ASPP)&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;UENTR&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Encoder 부분에 Transformer를 활용하여 기존보다 long range에 대해서 spatial dependency를 개선&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Transformer를 사용하여 단일 계층 내에서도 patches의 attention을 통해 전역적인 receptive field를 확보하여 Deep Lab의 locality 연산의 누적의 한계를 극복함.&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1381&quot; data-origin-height=&quot;862&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/q3Mk7/btsNXSsLkmN/VXk3VodwfluXU7EGkfduVK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/q3Mk7/btsNXSsLkmN/VXk3VodwfluXU7EGkfduVK/img.png&quot; data-alt=&quot;UENTR&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/q3Mk7/btsNXSsLkmN/VXk3VodwfluXU7EGkfduVK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fq3Mk7%2FbtsNXSsLkmN%2FVXk3VodwfluXU7EGkfduVK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1381&quot; height=&quot;862&quot; data-origin-width=&quot;1381&quot; data-origin-height=&quot;862&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;UENTR&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Inference&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Test Time Augmentation (TTA)&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Ensemble: robustness, generalization, prediction confidence&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;685&quot; data-origin-height=&quot;319&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ba3U0T/btsNX4tbbev/moKnQkMddM0bxi4FkX5FK0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ba3U0T/btsNX4tbbev/moKnQkMddM0bxi4FkX5FK0/img.png&quot; data-alt=&quot;TTA&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ba3U0T/btsNX4tbbev/moKnQkMddM0bxi4FkX5FK0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fba3U0T%2FbtsNX4tbbev%2FmoKnQkMddM0bxi4FkX5FK0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;685&quot; height=&quot;319&quot; data-origin-width=&quot;685&quot; data-origin-height=&quot;319&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;TTA&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Postprocessing&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Edge enhancement, Hole filling&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Loss&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Cross Entropy: pixel-wise classification, weight for class imbalance&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Dice Coefficient Loss:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;923&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/EEbXQ/btsNYGee3AU/8CK7FYpK7E7S4MwGlbxb91/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/EEbXQ/btsNYGee3AU/8CK7FYpK7E7S4MwGlbxb91/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/EEbXQ/btsNYGee3AU/8CK7FYpK7E7S4MwGlbxb91/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FEEbXQ%2FbtsNYGee3AU%2F8CK7FYpK7E7S4MwGlbxb91%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;732&quot; height=&quot;923&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;923&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Jaccard/Intersection over Union(IoU) Loss:&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;694&quot; data-origin-height=&quot;370&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bMXkDw/btsNXZSZlr4/82NiSC8b6PXVzJF1fYj4x1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bMXkDw/btsNXZSZlr4/82NiSC8b6PXVzJF1fYj4x1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bMXkDw/btsNXZSZlr4/82NiSC8b6PXVzJF1fYj4x1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbMXkDw%2FbtsNXZSZlr4%2F82NiSC8b6PXVzJF1fYj4x1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;694&quot; height=&quot;370&quot; data-origin-width=&quot;694&quot; data-origin-height=&quot;370&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Dice Loss vs Jaccard Loss&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;813&quot; data-origin-height=&quot;202&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bwVlf2/btsNXk4nIcZ/ewdkjQ3g12XNODRit7rlLk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bwVlf2/btsNXk4nIcZ/ewdkjQ3g12XNODRit7rlLk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bwVlf2/btsNXk4nIcZ/ewdkjQ3g12XNODRit7rlLk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbwVlf2%2FbtsNXk4nIcZ%2FewdkjQ3g12XNODRit7rlLk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;813&quot; height=&quot;202&quot; data-origin-width=&quot;813&quot; data-origin-height=&quot;202&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1697&quot; data-origin-height=&quot;1101&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/C0ydW/btsNYTYK1L4/NiSquXXc8HK5o0akDuY8MK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/C0ydW/btsNYTYK1L4/NiSquXXc8HK5o0akDuY8MK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/C0ydW/btsNYTYK1L4/NiSquXXc8HK5o0akDuY8MK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FC0ydW%2FbtsNYTYK1L4%2FNiSquXXc8HK5o0akDuY8MK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;755&quot; height=&quot;490&quot; data-origin-width=&quot;1697&quot; data-origin-height=&quot;1101&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-end=&quot;707&quot; data-start=&quot;695&quot; data-ke-size=&quot;size16&quot;&gt;주요 차이점&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; data-end=&quot;1163&quot; data-start=&quot;709&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li data-end=&quot;844&quot; data-start=&quot;709&quot;&gt;&lt;b&gt;감도(Gradient) 분포&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-end=&quot;844&quot; data-start=&quot;737&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li data-end=&quot;811&quot; data-start=&quot;737&quot;&gt;&lt;b&gt;Dice Loss&lt;/b&gt;: 낮은 IoU 영역에서 &lt;b&gt;비선형&lt;/b&gt;으로 급격한 펄스를 줘 소형 객체나 초기 학습에서 빠른 수렴 유도&lt;/li&gt;
&lt;li data-end=&quot;844&quot; data-start=&quot;815&quot;&gt;&lt;b&gt;Jaccard Loss&lt;/b&gt;: &lt;b&gt;선형&lt;/b&gt; 감소&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li data-end=&quot;1002&quot; data-start=&quot;846&quot;&gt;&lt;b&gt;수치적 안정성&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-end=&quot;1002&quot; data-start=&quot;866&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li data-end=&quot;977&quot; data-start=&quot;866&quot;&gt;두 Loss 모두 0&amp;ndash;1 사이지만, Dice 식에 분모가 &lt;span&gt;&lt;span&gt;2&amp;thinsp;TP+FP+FN2\,\text{TP}+\text{FP}+\text{FN}&lt;/span&gt;&lt;span aria-hidden=&quot;true&quot;&gt;&lt;span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;&lt;span&gt;TP&lt;/span&gt;&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;FP&lt;/span&gt;&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;FN&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; 이므로 &lt;b&gt;소수 FP/FN&lt;/b&gt; 존재 시에도 &lt;b&gt;더 높은 값&lt;/b&gt;을 유지&lt;/li&gt;
&lt;li data-end=&quot;1002&quot; data-start=&quot;981&quot;&gt;Jaccard는 FP+FN 에 민감&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li data-end=&quot;1163&quot; data-start=&quot;1004&quot;&gt;&lt;b&gt;사용 사례&lt;/b&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-end=&quot;1163&quot; data-start=&quot;1022&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li data-end=&quot;1074&quot; data-start=&quot;1022&quot;&gt;&lt;b&gt;Dice Loss&lt;/b&gt;: 의료 영상 segmentation, 클래스 불균형 극심할 때&lt;/li&gt;
&lt;li data-end=&quot;1163&quot; data-start=&quot;1078&quot;&gt;&lt;b&gt;Jaccard Loss&lt;/b&gt;(IoU Loss): 객체 탐지의 위치 회귀(IoU-based), 세그멘테이션에서도 쓰이나 Dice 만큼 보편적이지 않음&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Evalution&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Annotator에 따라 차이가 큼&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;698&quot; data-origin-height=&quot;591&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/osagu/btsNYVbbhj2/n7pUb8sRlYD6wk6KKlsg00/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/osagu/btsNYVbbhj2/n7pUb8sRlYD6wk6KKlsg00/img.png&quot; data-alt=&quot;TOWARDS A GUIDELINE FOR EVALUATION METRICS IN MEDICAL IMAGE SEGMENTATION&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/osagu/btsNYVbbhj2/n7pUb8sRlYD6wk6KKlsg00/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fosagu%2FbtsNYVbbhj2%2Fn7pUb8sRlYD6wk6KKlsg00%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;698&quot; height=&quot;591&quot; data-origin-width=&quot;698&quot; data-origin-height=&quot;591&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;TOWARDS A GUIDELINE FOR EVALUATION METRICS IN MEDICAL IMAGE SEGMENTATION&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Specificity: Brain - 미세한 cancel region이 모두 matter이기 때문에 유효&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Sensitivity: histopathology - 최대한 많은 영역을 segmentation하는 것이 목적이기 때문에 유효&lt;/p&gt;
&lt;p style=&quot;color: #333333; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;Dice, Jaccard, Mean IoU - 모든 class에 대한 IoU 평, GIoU - region의 거리까지 고, DIoU - gt, predict의 center points 거리까지 고려&lt;/p&gt;
&lt;p style=&quot;color: #333333; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;pixel-wise evaluation: f1 score, sensitivity, specificity, accuracy&lt;/p&gt;
&lt;p style=&quot;color: #333333; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;Hausdorff distance: gt, prediction 간의 꼭지점 거리를 계산하여 매칭 계산&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Object Detection&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Localization and classification&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Challenges: Positive and Negative imbalance data, Anchor box, feature map&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Preprocessing&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Online Hard Negative Mining (OHEM): Top N confidence negative sampling&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;649&quot; data-origin-height=&quot;319&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dmpC3j/btsNXAluUZ5/3acZVJqK1qHivocXhkWQjK/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dmpC3j/btsNXAluUZ5/3acZVJqK1qHivocXhkWQjK/img.jpg&quot; data-alt=&quot;HEM&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dmpC3j/btsNXAluUZ5/3acZVJqK1qHivocXhkWQjK/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdmpC3j%2FbtsNXAluUZ5%2F3acZVJqK1qHivocXhkWQjK%2Fimg.jpg&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;649&quot; height=&quot;319&quot; data-origin-width=&quot;649&quot; data-origin-height=&quot;319&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;HEM&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1346&quot; data-origin-height=&quot;574&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6zGf0/btsNWrbSwr0/8gHLWnDOEd3ynEfXE0q21K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6zGf0/btsNWrbSwr0/8gHLWnDOEd3ynEfXE0q21K/img.png&quot; data-alt=&quot;OHEM&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6zGf0/btsNWrbSwr0/8gHLWnDOEd3ynEfXE0q21K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6zGf0%2FbtsNWrbSwr0%2F8gHLWnDOEd3ynEfXE0q21K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1346&quot; height=&quot;574&quot; data-origin-width=&quot;1346&quot; data-origin-height=&quot;574&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;OHEM&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Multi-scale sample&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;improving robustness to scale variations, enhancing feature representation, and capturing both local detail and global context&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;444&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c8GFt5/btsNYv5bpT8/N9g0i6PDs7gAuMlaI80r3K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c8GFt5/btsNYv5bpT8/N9g0i6PDs7gAuMlaI80r3K/img.png&quot; data-alt=&quot;Convolutional Neural Networks for Automated PET/CT Detection of Diseased Lymph Node Burden in Patients with Lymphoma&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c8GFt5/btsNYv5bpT8/N9g0i6PDs7gAuMlaI80r3K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc8GFt5%2FbtsNYv5bpT8%2FN9g0i6PDs7gAuMlaI80r3K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;444&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;444&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;Convolutional Neural Networks for Automated PET/CT Detection of Diseased Lymph Node Burden in Patients with Lymphoma&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Augmentation: flip, rotate, cutout, mosaic, mixup, cutmix&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Models&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Faster-RCNN: Region proposal network. Localization에 대해서 Proposal된 영역에 대해서만 classification하여 기존의 sliding windows 방법 대비 효율적&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;886&quot; data-origin-height=&quot;509&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/yuThE/btsNWIxwphs/Xi71ZzeOnJn4wxhIfJKcnK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/yuThE/btsNWIxwphs/Xi71ZzeOnJn4wxhIfJKcnK/img.png&quot; data-alt=&quot;Cancel Cells detection in Phase-Contrast Microscopy Images Based on Faster RCNN&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/yuThE/btsNWIxwphs/Xi71ZzeOnJn4wxhIfJKcnK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FyuThE%2FbtsNWIxwphs%2FXi71ZzeOnJn4wxhIfJKcnK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;698&quot; height=&quot;401&quot; data-origin-width=&quot;886&quot; data-origin-height=&quot;509&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;Cancel Cells detection in Phase-Contrast Microscopy Images Based on Faster RCNN&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;FPN&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;648&quot; data-origin-height=&quot;506&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/br7r5d/btsNYV9XfLx/Bg36SKRI8geSnwk0P7umo0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/br7r5d/btsNYV9XfLx/Bg36SKRI8geSnwk0P7umo0/img.png&quot; data-alt=&quot;FPN&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/br7r5d/btsNYV9XfLx/Bg36SKRI8geSnwk0P7umo0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbr7r5d%2FbtsNYV9XfLx%2FBg36SKRI8geSnwk0P7umo0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;648&quot; height=&quot;506&quot; data-origin-width=&quot;648&quot; data-origin-height=&quot;506&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;FPN&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;YOLO: 1-stage, cell &amp;amp; anchor box, confidence&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Fully Convolutional One-stage Object Detection: Anchor-free&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;End-to-End Object Detection with Transformers (DETR): Hungarian maximum matching algorithm, Transformer, patch&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;nnUNET&lt;/span&gt;&lt;/h4&gt;
&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;Annotation과 Image만으로 Model 학습. Positive patch, Anchor box, NMS 등 preprocessing, postprocessing의 수고를 줄이기 위함. Fixed parameter, Rule-based parameter, Empirical parameter &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;color: #333333; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;AutoML vs NNunet&lt;/p&gt;
&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;Fixed parameter - optimizer, loss function, network (ex: UNET), Augmentation, Inference (ex: sliding window), Epoch&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;Rule-based parameter: depending on the data. normalizing, pixel scaling, batch, patch size, number of gpu&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;Empirical parameter: Auto&lt;/span&gt;&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;nnDetection&lt;/h4&gt;
&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;Successor of nnUNET&lt;/p&gt;
&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;Hard negative mining: 1/3 positive, 2/3 negative, Classification: CE, Optimizer: SGD, 60 epochs, Architecture: Multi-scale FPN&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;733&quot; data-origin-height=&quot;845&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cpW4mZ/btsNYZR8lZy/VxPySH7N6K0W9BlONmGTUK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cpW4mZ/btsNYZR8lZy/VxPySH7N6K0W9BlONmGTUK/img.png&quot; data-alt=&quot;nnDetection&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cpW4mZ/btsNYZR8lZy/VxPySH7N6K0W9BlONmGTUK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcpW4mZ%2FbtsNYZR8lZy%2FVxPySH7N6K0W9BlONmGTUK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;733&quot; height=&quot;845&quot; data-origin-width=&quot;733&quot; data-origin-height=&quot;845&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;nnDetection&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Generalized IOU used for searching anchor box automatically&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;시나리오 IoU GIoU 시각적 특징&amp;nbsp;&amp;amp;&amp;nbsp;해석&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Perfect overlap&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;두&amp;nbsp;박스가 완전히 일치 &amp;rarr; 외접 C = A = B, 빈 공간&amp;nbsp;0 &amp;rArr; GIoU = IoU = 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Partial overlap&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;0.195&lt;/td&gt;
&lt;td&gt;0.015&lt;/td&gt;
&lt;td&gt;교집합은 작고 외접 C 가 커서 &lt;b&gt;빈 공간 비율&lt;/b&gt;&amp;nbsp;&amp;uarr; &amp;rarr; GIoU가 IoU보다 더 낮음&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;No overlap&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;0.000&lt;/td&gt;
&lt;td&gt;&amp;ndash;0.263&lt;/td&gt;
&lt;td&gt;IoU = 0 이라 gradient&amp;nbsp;0 이지만, GIoU는 &lt;b&gt;음수 페널티&lt;/b&gt; &amp;rarr; 학습 신호 유지&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1580&quot; data-origin-height=&quot;1035&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b6Y0Ei/btsNXCRfzSq/7FFegpCgLGNkclYmSWUbrk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b6Y0Ei/btsNXCRfzSq/7FFegpCgLGNkclYmSWUbrk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b6Y0Ei/btsNXCRfzSq/7FFegpCgLGNkclYmSWUbrk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb6Y0Ei%2FbtsNXCRfzSq%2F7FFegpCgLGNkclYmSWUbrk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1580&quot; height=&quot;1035&quot; data-origin-width=&quot;1580&quot; data-origin-height=&quot;1035&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1580&quot; data-origin-height=&quot;1035&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bfS12v/btsNYsmZ3Zx/gHKgqvZfHvRmkoeVGs3YLK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bfS12v/btsNYsmZ3Zx/gHKgqvZfHvRmkoeVGs3YLK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bfS12v/btsNYsmZ3Zx/gHKgqvZfHvRmkoeVGs3YLK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbfS12v%2FbtsNYsmZ3Zx%2FgHKgqvZfHvRmkoeVGs3YLK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1580&quot; height=&quot;1035&quot; data-origin-width=&quot;1580&quot; data-origin-height=&quot;1035&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1580&quot; data-origin-height=&quot;1035&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/XXoyr/btsNX3nuWWQ/VLh6NpAm2Z7j9FMQKYCpjk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/XXoyr/btsNX3nuWWQ/VLh6NpAm2Z7j9FMQKYCpjk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/XXoyr/btsNX3nuWWQ/VLh6NpAm2Z7j9FMQKYCpjk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FXXoyr%2FbtsNX3nuWWQ%2FVLh6NpAm2Z7j9FMQKYCpjk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1580&quot; height=&quot;1035&quot; data-origin-width=&quot;1580&quot; data-origin-height=&quot;1035&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Rule-based parameters: heuristic rules, searching for IOU maximizing an anchor box, differ resampling for each image domain, from full-resolution model to low resolution model when missing context&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Empirical parameters: Postprocessing, Sliding windows for NMS, Weighted box clustering&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Loss&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Focal loss - weighted to too many negatives&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Postprocessing&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Non-maximum Suppression (NMS) - IOU &amp;gt; Threshold, Sliding window - patch inference for small objects&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Evaluation&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;IOU&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;337&quot; data-origin-height=&quot;251&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6rcJL/btsNXq4ySfj/bR5BTBsvkEixsb3AqKsr61/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6rcJL/btsNXq4ySfj/bR5BTBsvkEixsb3AqKsr61/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6rcJL/btsNXq4ySfj/bR5BTBsvkEixsb3AqKsr61/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6rcJL%2FbtsNXq4ySfj%2FbR5BTBsvkEixsb3AqKsr61%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;337&quot; height=&quot;251&quot; data-origin-width=&quot;337&quot; data-origin-height=&quot;251&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Precision-recall curve, MAP, ROC Curve - Sensitivity and specificity, Free-Response ROC Curve (FROC)&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;661&quot; data-origin-height=&quot;287&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bvmiBd/btsNWH6se7r/iDtemqIaRrJGjzxha3QWUk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bvmiBd/btsNWH6se7r/iDtemqIaRrJGjzxha3QWUk/img.png&quot; data-alt=&quot;Precision-Recall with Threshold&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bvmiBd/btsNWH6se7r/iDtemqIaRrJGjzxha3QWUk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbvmiBd%2FbtsNWH6se7r%2FiDtemqIaRrJGjzxha3QWUk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;661&quot; height=&quot;287&quot; data-origin-width=&quot;661&quot; data-origin-height=&quot;287&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;Precision-Recall with Threshold&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;875&quot; data-origin-height=&quot;671&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/0AxC1/btsNYDPlzDJ/weAOL0ZDP1AAhWl6mVFrTk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/0AxC1/btsNYDPlzDJ/weAOL0ZDP1AAhWl6mVFrTk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/0AxC1/btsNYDPlzDJ/weAOL0ZDP1AAhWl6mVFrTk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F0AxC1%2FbtsNYDPlzDJ%2FweAOL0ZDP1AAhWl6mVFrTk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;703&quot; height=&quot;539&quot; data-origin-width=&quot;875&quot; data-origin-height=&quot;671&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Fully Convolutional One-Stage Object Detection (FPOC)&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Anchor box size나 scale을 custom하게 설정하는 것이 아니라 class label classification, bounding box regression, and centerness 등을 prediction함. 또 FPN으로 다양한 scale에 대한 객체 처리.&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1359&quot; data-origin-height=&quot;702&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cd1wKm/btsNYlamMyw/PcyDEfKkJcMS6Qus4AZeM1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cd1wKm/btsNYlamMyw/PcyDEfKkJcMS6Qus4AZeM1/img.png&quot; data-alt=&quot;FPOC&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cd1wKm/btsNYlamMyw/PcyDEfKkJcMS6Qus4AZeM1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcd1wKm%2FbtsNYlamMyw%2FPcyDEfKkJcMS6Qus4AZeM1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1359&quot; height=&quot;702&quot; data-origin-width=&quot;1359&quot; data-origin-height=&quot;702&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;FPOC&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;개념 정의 표준 ROC와의 차이&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Sensitivity (TPR)&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;span&gt;탐지된&amp;nbsp;병변(Correct&amp;nbsp;Lesions)전체&amp;nbsp;실제&amp;nbsp;병변\dfrac{\text{탐지된&amp;nbsp;병변(Correct&amp;nbsp;Lesions)}}{\text{전체&amp;nbsp;실제&amp;nbsp;병변}}&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;동일&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;FP / Image&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;한 이미지당 잘못&amp;nbsp;탐지된&amp;nbsp;개수&amp;nbsp;평균&lt;/td&gt;
&lt;td&gt;ROC의 FPR(비율) 대신 &lt;b&gt;절대 개수&lt;/b&gt; 사용&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;FROC Curve&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;x축 = FP per image&lt;/b&gt;, &lt;b&gt;y축 = Sensitivity&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;한 이미지 안에 &lt;b&gt;복수의 탐지 후보&lt;/b&gt;가 있어도 평가 가능&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1589&quot; data-origin-height=&quot;1002&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/peBy3/btsNWn1wNHQ/kQ5YKsXTFrO5ixp5AtA1p0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/peBy3/btsNWn1wNHQ/kQ5YKsXTFrO5ixp5AtA1p0/img.png&quot; data-alt=&quot;Threshold 0.9 - few detections&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/peBy3/btsNWn1wNHQ/kQ5YKsXTFrO5ixp5AtA1p0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FpeBy3%2FbtsNWn1wNHQ%2FkQ5YKsXTFrO5ixp5AtA1p0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1589&quot; height=&quot;1002&quot; data-origin-width=&quot;1589&quot; data-origin-height=&quot;1002&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;Threshold 0.9 - few detections&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1589&quot; data-origin-height=&quot;1002&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/LZ8ou/btsNYluzK7k/CwCagW3s3ke1vGmTRppuxk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/LZ8ou/btsNYluzK7k/CwCagW3s3ke1vGmTRppuxk/img.png&quot; data-alt=&quot;threshold 0.5 - balanced&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/LZ8ou/btsNYluzK7k/CwCagW3s3ke1vGmTRppuxk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLZ8ou%2FbtsNYluzK7k%2FCwCagW3s3ke1vGmTRppuxk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1589&quot; height=&quot;1002&quot; data-origin-width=&quot;1589&quot; data-origin-height=&quot;1002&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;threshold 0.5 - balanced&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1589&quot; data-origin-height=&quot;1002&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/WxcIz/btsNXRtMp2Z/9WbXpGrJKPfAapzbnhPPt1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/WxcIz/btsNXRtMp2Z/9WbXpGrJKPfAapzbnhPPt1/img.png&quot; data-alt=&quot;threshold 0.1 - many fp&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/WxcIz/btsNXRtMp2Z/9WbXpGrJKPfAapzbnhPPt1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FWxcIz%2FbtsNXRtMp2Z%2F9WbXpGrJKPfAapzbnhPPt1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1589&quot; height=&quot;1002&quot; data-origin-width=&quot;1589&quot; data-origin-height=&quot;1002&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;threshold 0.1 - many fp&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Instance Segmentation&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Preprocessing: Copy and pastes augmentation, Contour mask, Gradient map&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;ToothNet: Mask-RCNN, 2-stage, Edge map, Region proposal network (RPN), Similarity Matrix&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1064&quot; data-origin-height=&quot;439&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bBYBRt/btsNXl3bsnl/UPZqHLvKjVp9SRlAoYRmqk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bBYBRt/btsNXl3bsnl/UPZqHLvKjVp9SRlAoYRmqk/img.png&quot; data-alt=&quot;ToothNet&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bBYBRt/btsNXl3bsnl/UPZqHLvKjVp9SRlAoYRmqk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbBYBRt%2FbtsNXl3bsnl%2FUPZqHLvKjVp9SRlAoYRmqk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;766&quot; height=&quot;316&quot; data-origin-width=&quot;1064&quot; data-origin-height=&quot;439&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;ToothNet&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; text-align: center;&quot;&gt; Real-time Instance Segmentation of Surgical Instruments using Attention and Multi-scale Feature Fusion&lt;/span&gt;: YOLACT++, 1-stage, FPN, Attention&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1064&quot; data-origin-height=&quot;796&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bkbJ1D/btsNWg2FgjO/bc5QafOj6q1wc3SS0piSF1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bkbJ1D/btsNWg2FgjO/bc5QafOj6q1wc3SS0piSF1/img.png&quot; data-alt=&quot;Real-time Instance Segmentation of Surgical Instruments using Attention and Multi-scale Feature Fusion&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bkbJ1D/btsNWg2FgjO/bc5QafOj6q1wc3SS0piSF1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbkbJ1D%2FbtsNWg2FgjO%2Fbc5QafOj6q1wc3SS0piSF1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;725&quot; height=&quot;542&quot; data-origin-width=&quot;1064&quot; data-origin-height=&quot;796&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;Real-time Instance Segmentation of Surgical Instruments using Attention and Multi-scale Feature Fusion&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;524&quot; data-origin-height=&quot;385&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dAZYKt/btsNXlhQ8ip/gKvza5YKdEbViXnH3q7Qck/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dAZYKt/btsNXlhQ8ip/gKvza5YKdEbViXnH3q7Qck/img.png&quot; data-alt=&quot;Real-time Instance Segmentation of Surgical Instruments using Attention and Multi-scale Feature Fusion&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dAZYKt/btsNXlhQ8ip/gKvza5YKdEbViXnH3q7Qck/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdAZYKt%2FbtsNXlhQ8ip%2FgKvza5YKdEbViXnH3q7Qck%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;524&quot; height=&quot;385&quot; data-origin-width=&quot;524&quot; data-origin-height=&quot;385&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;Real-time Instance Segmentation of Surgical Instruments using Attention and Multi-scale Feature Fusion&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Postprocessing: Watershed&lt;/p&gt;
&lt;div id=&quot;ag-1747225948404&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id=&quot;ag-1747226114718&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script src=&quot;chrome-extension://lopnbnfpjmgpbppclhclehhgafnifija/aiscripts/script-main.js&quot;&gt;&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id=&quot;ag-1747226287770&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script src=&quot;chrome-extension://lopnbnfpjmgpbppclhclehhgafnifija/aiscripts/script-main.js&quot;&gt;&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id=&quot;ag-1747226559114&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script src=&quot;chrome-extension://lopnbnfpjmgpbppclhclehhgafnifija/aiscripts/script-main.js&quot;&gt;&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id=&quot;ag-1747227563102&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script src=&quot;chrome-extension://lopnbnfpjmgpbppclhclehhgafnifija/aiscripts/script-main.js&quot;&gt;&lt;/script&gt;
&lt;/p&gt;</description>
      <category>fastcampus</category>
      <category>국비지원</category>
      <category>패스트캠퍼스</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/922</guid>
      <comments>https://demyank.tistory.com/922#entry922comment</comments>
      <pubDate>Wed, 14 May 2025 19:25:20 +0900</pubDate>
    </item>
    <item>
      <title>Accept-Reject Sampling</title>
      <link>https://demyank.tistory.com/919</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;Sample and Sampling&lt;/h2&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Sample&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #222222;&quot;&gt;A&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;sample&lt;span style=&quot;background-color: #ffffff; color: #222222;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is an outcome of a random experiment. When we sample a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;random variable&lt;span style=&quot;background-color: #ffffff; color: #222222;&quot;&gt;, we obtain one specific value out of the set of its possible values. That particular value is called a sample.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #222222;&quot;&gt;The possible values and the likelihood of each are determined by the random variable's&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;probability distribution&lt;span style=&quot;background-color: #ffffff; color: #222222;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Sampling&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #fdfdfd; color: #000000;&quot;&gt;Mathematically performing sampling is the same as performing an inverse function operation of CDF(cumulative density function.&lt;/span&gt;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;background-color: #fdfdfd; color: #000000;&quot;&gt;Why sampling is difficult?&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Mathematically, sampling is calculating the inverse function of the CDF&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #fdfdfd; color: #000000;&quot;&gt;Calculating  CDF for a given PDF requires an integral operation&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #fdfdfd; color: #000000;&quot;&gt;Calculating the CDF is not easy to obtain an inverse function&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #fdfdfd; color: #000000;&quot;&gt;Thus, performing sampling numerically accurately is difficult&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Proposal distribution $g(x)$&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;The proposed distribution utilizes a distribution that allows us to sample easily: such as uniform distribution&lt;/li&gt;
&lt;li&gt;If possible, similar distribution to the target distribution is preferable&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Sampling Process&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$q(x)$ is proposal distribution&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$p(x)$ is target distribution&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;1. Multiply constant M to proposal distribution for $Mq(x)\geq p(x)$&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;820&quot; data-origin-height=&quot;352&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/d7o9Nh/btrHicLxQGr/MNyC1wRQ5RLuezBpzxCaf0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/d7o9Nh/btrHicLxQGr/MNyC1wRQ5RLuezBpzxCaf0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/d7o9Nh/btrHicLxQGr/MNyC1wRQ5RLuezBpzxCaf0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fd7o9Nh%2FbtrHicLxQGr%2FMNyC1wRQ5RLuezBpzxCaf0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;552&quot; height=&quot;237&quot; data-origin-width=&quot;820&quot; data-origin-height=&quot;352&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;2. Generate $x_{0}$ from q&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;3. Generate sample $u$ from a uniform distribution between $\left [ 0, Mq(x_{0}) \right ]$&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;820&quot; data-origin-height=&quot;353&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dlND1S/btrHfQWxT5C/Vu4jcWrR0K71EjZGfY3Ee0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dlND1S/btrHfQWxT5C/Vu4jcWrR0K71EjZGfY3Ee0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dlND1S/btrHfQWxT5C/Vu4jcWrR0K71EjZGfY3Ee0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdlND1S%2FbtrHfQWxT5C%2FVu4jcWrR0K71EjZGfY3Ee0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;566&quot; height=&quot;244&quot; data-origin-width=&quot;820&quot; data-origin-height=&quot;353&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;4. If $u$ site within A, reject. Or $u$ site within B, accept.&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{p(x_{0})}{Mq(x_{0})} &amp;gt; random \ value \ from [0, 1]$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;5. Repeat this accept-reject process numerously, samples from reject sampling follows approximately $p(x)$&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;638&quot; data-origin-height=&quot;304&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bw5I1D/btrHfA0oSz9/zxRatEiiR58xYImRPsslvK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bw5I1D/btrHfA0oSz9/zxRatEiiR58xYImRPsslvK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bw5I1D/btrHfA0oSz9/zxRatEiiR58xYImRPsslvK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbw5I1D%2FbtrHfA0oSz9%2FzxRatEiiR58xYImRPsslvK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;638&quot; height=&quot;304&quot; data-origin-width=&quot;638&quot; data-origin-height=&quot;304&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; font-size: 1.62em; letter-spacing: -1px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Apple SD Gothic Neo', Arial, sans-serif;&quot;&gt;Reference&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://mathinsight.org/definition/random_variable_sample&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://mathinsight.org/definition/random_variable_sample&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=7wtVFfwAps4&quot;&gt;https://www.youtube.com/watch?v=7wtVFfwAps4&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://angeloyeo.github.io/2020/09/16/rejection_sampling.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://angeloyeo.github.io/2020/09/16/rejection_sampling.html&lt;/a&gt;&lt;/p&gt;</description>
      <category>Stats</category>
      <category>accept-reject sampling</category>
      <category>reject sampling</category>
      <category>sampling</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/919</guid>
      <comments>https://demyank.tistory.com/919#entry919comment</comments>
      <pubDate>Thu, 14 Jul 2022 13:43:44 +0900</pubDate>
    </item>
    <item>
      <title>Matrix Factorization</title>
      <link>https://demyank.tistory.com/918</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1184&quot; data-origin-height=&quot;522&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/uFTo4/btrG6XB3nZq/Zk8k9g71S6hcDFMJ8RVqak/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/uFTo4/btrG6XB3nZq/Zk8k9g71S6hcDFMJ8RVqak/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/uFTo4/btrG6XB3nZq/Zk8k9g71S6hcDFMJ8RVqak/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FuFTo4%2FbtrG6XB3nZq%2FZk8k9g71S6hcDFMJ8RVqak%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;515&quot; height=&quot;227&quot; data-origin-width=&quot;1184&quot; data-origin-height=&quot;522&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Split the matrix into the product of 2 other matrices&lt;/li&gt;
&lt;li&gt;We call it &lt;i&gt;&lt;b&gt;R hat&lt;/b&gt;&lt;/i&gt; because it only approximates R - it is our model of R&lt;/li&gt;
&lt;li&gt;We would like W and U to be very skinny&lt;/li&gt;
&lt;li&gt;$W(N \times K)$ - users matrix, $U(M \times K)$ - movie matrix&lt;/li&gt;
&lt;li&gt;K somewhere from 10-50&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;The scale of matrix R, W, and U&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Key: $W$ and $U$ should be much smaller than $R$&lt;/li&gt;
&lt;li&gt;$R$ is $N \times M$&lt;/li&gt;
&lt;li&gt;Generally, we can't store $R$ in memory&lt;/li&gt;
&lt;li&gt;We can represent it using a special data structure
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Dict{(u, m) -&amp;gt; r}&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If N = 130k, M = 26k
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$N \times M$ = 3.38 billion&lt;/li&gt;
&lt;li&gt;# ratings = 20 million&lt;/li&gt;
&lt;li&gt;Space used: 20 million / 3.38 billion = 0.006&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;This is called a sparse representation&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Scale down to K&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;If K = 10, N = 130k, M = 26k, then size of W and U: NK + MK = 1.56 million&lt;/li&gt;
&lt;li&gt;How much savings? 1.56 million / 3.38 billion = 0.0005
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;This takes up less space than the ratings&lt;/li&gt;
&lt;li&gt;This is good, we like # parameters &amp;lt; # of data pts)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Calculate only at i and j&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;What happens if you try to calculate $WU^{T}$ in code?&lt;/li&gt;
&lt;li&gt;Don't do it. The result is $N \times M$, which can't load on memory unless you've selected a small subset of your data&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;What if I just want one rating, for user i, item j?&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Just a dot product between 2 vectors of size K&lt;/li&gt;
&lt;li&gt;Unlike calculating all of our $\hat{R}$, this is very fast and takes up a trivial amount of space&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{r}_{ij}=w_{i}^{T}u_{j}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$where \ \hat{r}_{ij}=\hat{R}[i,j],w_{i}=W[i],u_{j}=U[j]$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Singular value decomposition (SVD)&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;A matrix X can be decomposed into 3 separate matrices multiplied together&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$X=USV^{T}$$&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;What's the justification for calling matrix factorization SVD?&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;S can be absorbed into $U$ or $V$, we get an $(N \times K) \times (K \times M) \to (N \times M)$&lt;/li&gt;
&lt;li&gt;The model is thus exactly like MF&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{x}_{ij}=\sum_{k}u_{ik}s_{kk}v_kj=\sum_{k}(u_{ik}s_{kk})v_{kj}=\sum_{k}{u}'_{ik}v_{kj}=u_{i}^{'T}v_{j}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Linear algebra&lt;/h3&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1336&quot; data-origin-height=&quot;520&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bkpFpc/btrG5rXLU6W/WVVxKzG5Ahx6DgcfNbOdhk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bkpFpc/btrG5rXLU6W/WVVxKzG5Ahx6DgcfNbOdhk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bkpFpc/btrG5rXLU6W/WVVxKzG5Ahx6DgcfNbOdhk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbkpFpc%2FbtrG5rXLU6W%2FWVVxKzG5Ahx6DgcfNbOdhk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;616&quot; height=&quot;240&quot; data-origin-width=&quot;1336&quot; data-origin-height=&quot;520&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$X(N \times M)$, $U(N \times K)$, $S(K \times K)$, $V(M \times K)$&lt;/li&gt;
&lt;li&gt;If I multiply $U$ by $S$, I just get another $N \times K$ matrix
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Then $X$ is a product of 2 matrices, just like matrix factorization&lt;/li&gt;
&lt;li&gt;Or equivalently, I could combine $S$ with $V^{T}$&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;$R$ (rating matrix) is sparse
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;If $U$, $S$, and $V$ can properly approximate a full $X$ matrix, then surely it can approximate a mostly empty $R$ matrix&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Interpretation&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Each of the K elements in $w_{i}$ and $u_{j}$ is a feature&lt;/li&gt;
&lt;li&gt;Let's suppose K=5, and they are:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Action/adventure&lt;/li&gt;
&lt;li&gt;Comedy&lt;/li&gt;
&lt;li&gt;Romance&lt;/li&gt;
&lt;li&gt;Horror&lt;/li&gt;
&lt;li&gt;Animation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;$w_{i}(1)$ is how much user_i likes action&lt;/li&gt;
&lt;li&gt;$w_{i}(2)$ is how much user_i likes comedy, etc.&lt;/li&gt;
&lt;li&gt;$u_{j}(1)$ is how much movie j contains action&lt;/li&gt;
&lt;li&gt;$u_{j}(2)$ is how much movie j contains comedy, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt; Questions&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;What happens when we dot $w_{i}^{T}u_{j}$?&lt;/li&gt;
&lt;li&gt;How well do user_i's preferences correlate with movie_j's attributes?&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{i}^{T}u_{j}=\left\|&amp;nbsp;w_{i}\right\|\left\|&amp;nbsp;u_{j}\right\|cos\theta&amp;nbsp;\propto&amp;nbsp;sim(i,j)$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Example&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Batman Animation&lt;/h4&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;550&quot; data-origin-height=&quot;777&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cogZO1/btrG88vGBjV/gskD8N8p0PVfA563kkQ03K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cogZO1/btrG88vGBjV/gskD8N8p0PVfA563kkQ03K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cogZO1/btrG88vGBjV/gskD8N8p0PVfA563kkQ03K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcogZO1%2FbtrG88vGBjV%2FgskD8N8p0PVfA563kkQ03K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;163&quot; height=&quot;230&quot; data-origin-width=&quot;550&quot; data-origin-height=&quot;777&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$w_{i}=(1, 0.8, -1, 0.1, 1)$&lt;/li&gt;
&lt;li&gt;$u_{j}=(1, 1.5, -1.3, 0, 1.2)$&lt;/li&gt;
&lt;li&gt;result = 1*1 + 0.8*1.5+1*1.3+0.1*0+1*1.2=4.7&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;THE NOTEBOOK&lt;/h4&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1000&quot; data-origin-height=&quot;1481&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/l4Cqa/btrG6cFVEav/l5ScKyqy2U9t6ZfF6snc3k/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/l4Cqa/btrG6cFVEav/l5ScKyqy2U9t6ZfF6snc3k/img.jpg&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/l4Cqa/btrG6cFVEav/l5ScKyqy2U9t6ZfF6snc3k/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fl4Cqa%2FbtrG6cFVEav%2Fl5ScKyqy2U9t6ZfF6snc3k%2Fimg.jpg&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;166&quot; height=&quot;246&quot; data-origin-width=&quot;1000&quot; data-origin-height=&quot;1481&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$w_{i}=(1, 0.8, -1, 0.1, 1)$&lt;/li&gt;
&lt;li&gt;$u_{j}=(-1, -1, 1, 0, -1)$&lt;/li&gt;
&lt;li&gt;result = -1*1 + -1*0.8 + -1*1 -1*1 = -3.8&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Supervised Machine Learning&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;400&quot; data-origin-height=&quot;682&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cOBryh/btrHdx3FjbJ/2iQAYlkSxAXmgi5M3K8wVk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cOBryh/btrHdx3FjbJ/2iQAYlkSxAXmgi5M3K8wVk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cOBryh/btrHdx3FjbJ/2iQAYlkSxAXmgi5M3K8wVk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcOBryh%2FbtrHdx3FjbJ%2F2iQAYlkSxAXmgi5M3K8wVk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;382&quot; height=&quot;652&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;400&quot; data-origin-height=&quot;682&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;We could predict how much a user likes an item, by extracting features from both and feeding it into a model like Random Forest or Neural Network
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;We might include features about the user like age, gender, location, and so forth&lt;/li&gt;
&lt;li&gt;Some attributes about the item like RAM, Display, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The difference is that MF extracts the features automatically using only ratings
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Only by looking at the patterns between users, items, and the ratings&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Dimensionality Reduction&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1368&quot; data-origin-height=&quot;610&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dg9qMs/btrHaWV5UnG/A347rrCfOQCHcxKrCE8Zt1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dg9qMs/btrHaWV5UnG/A347rrCfOQCHcxKrCE8Zt1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dg9qMs/btrHaWV5UnG/A347rrCfOQCHcxKrCE8Zt1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fdg9qMs%2FbtrHaWV5UnG%2FA347rrCfOQCHcxKrCE8Zt1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;654&quot; height=&quot;292&quot; data-origin-width=&quot;1368&quot; data-origin-height=&quot;610&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Is exactly equal to X if K=M (assuming N &amp;gt; M and the rank of X is M)&lt;/li&gt;
&lt;li&gt;By shrinking U, S, and V, we make it an approximation&lt;/li&gt;
&lt;li&gt;Is called Truncated SVD: and yields our best rank-K approximation of X&lt;/li&gt;
&lt;li&gt;Similarly, MF reduces the dimensionality of R&lt;/li&gt;
&lt;li&gt;We encourage the model to learn the most important features required to generate R&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Training&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;How can we ensure our approximation is good? We would like $R$ and $\hat{R}$ to close together which are rating matrices&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$R\approx&amp;nbsp;\hat{R}=WU^{T}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Squared error loss&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega&amp;nbsp;}(r_{ij}-\hat{r}_{ij})^{2}=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-w_{i}^{T}u_{j})^{2}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\Omega=$set of pairs (i, j) where user_i rated movie_j&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Minimize the loss&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;How? Find the gradient, set it to 0, and solve for the parameters&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega&amp;nbsp;}(r_{ij}-\hat{r}_{ij})^{2}=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-w_{i}^{T}u_{j})^{2}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Solving for $W$&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega&amp;nbsp;}(r_{ij}-\hat{r}_{ij})^{2}=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-w_{i}^{T}u_{j})^{2}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial J}{\partial w_{i}}=2\sum_{j\in \Psi_{i} }(r_{ij}-w_{i}^{T}u_{j})(-u_{j})=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Careful about which sets are being summed over&lt;/li&gt;
&lt;li&gt;$\Omega$ represents the set of pairs (i,j) where user_i has rated movie_j&lt;/li&gt;
&lt;li&gt;$\Psi_{i}$ is the set of all movies that user_i has rated&amp;nbsp;&lt;/li&gt;
&lt;li&gt;For $J$, we want to sum over all rating&lt;/li&gt;
&lt;li&gt;For a particular user vector $w_{i}$, we only care about movies that user rated (because only those ratings involve $w_{i}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}(w_{i}^{T}u_{j})(u_{j})=\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}r_{ij}u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Try to isolate $w_{i}$&lt;/li&gt;
&lt;li&gt;Dot product is commutative&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}(u_{j}^{T}w_{i})u_{j}=\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}r_{ij}u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Result of dot product is scalar&lt;/li&gt;
&lt;li&gt;$scalar \times vector = vector \times scalar$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}u_{j}(u_{j}^{T}w_{i})=\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}r_{ij}u_{j}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in \Psi_{i} }u_{j}u_{j}^{T}w_{i}=\sum_{j\in \Psi_{i} }r_{ij}u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Summation doesn't actually depend on i&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Add more brackets&lt;/li&gt;
&lt;li&gt;Do the outer products between $u_{j}$ and itself sum over all values of j&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\left&amp;nbsp;(&amp;nbsp;\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}u_{j}u_{j}^{T}&amp;nbsp;\right&amp;nbsp;)w_{i}=\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}r_{ij}u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Now it's just $Ax = b$, which we know how to solve&lt;/li&gt;
&lt;li&gt;x = np.linalg.solve(A, b)&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{i}=\left&amp;nbsp;(&amp;nbsp;\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}u_{j}u_{j}^{T}&amp;nbsp;\right&amp;nbsp;)^{-1}\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}r_{ij}u_{j}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Solving for $U$&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Loss is symmetric in $W$ and $U$, so the steps should be the same&lt;/li&gt;
&lt;li&gt;Remember to be careful which set to sum over&lt;/li&gt;
&lt;li&gt;Since we only one terms involving $u_{j}$, that means we only want the user_i who rated item_j, that's $\Omega_{j}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega&amp;nbsp;}(r_{ij}-\hat{r}_{ij})^{2}=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-w_{i}^{T}u_{j})^{2}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial J}{\partial u_{j}}=2\sum_{i\in \Omega_{j} }(r_{ij}-w_{i}^{T}u_{j})(-w_{i})=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Try to isolate $u_{j}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{i\in \Omega_{j} }(w_{i}^{T}u_{j})w_{i}=\sum_{i\in \Omega_{j} }r_{ij}w_{i}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Change order of mulitiplication&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{i\in&amp;nbsp;\Omega_{j}}w_{i}w_{i}^{T}u_{j}=\sum_{i\in&amp;nbsp;\Omega_{j}}r_{ij}w_{i}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\left&amp;nbsp;(&amp;nbsp;\sum_{i\in&amp;nbsp;\Omega_{j}}w_{i}w_{i}^{T}&amp;nbsp;\right&amp;nbsp;)u_{j}=\sum_{i\in&amp;nbsp;\Omega_{j}}r_{ij}w_{i}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$u_{j}=\left&amp;nbsp;(&amp;nbsp;\sum_{i\in&amp;nbsp;\Omega_{j}}w_{i}w_{i}^{T}&amp;nbsp;\right&amp;nbsp;)^{-1}\sum_{i\in&amp;nbsp;\Omega_{j}}r_{ij}w_{i}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Training algorithm&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;2-way dependency&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Solution for $W$ depends on $U$&lt;/li&gt;
&lt;li&gt;Solution for $U$ depends on $W$&lt;/li&gt;
&lt;li&gt;The issue is we're going to have two separate steps, but there isn't just one global equation
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;This is the nature of our model&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Simply apply the equation as is, iteratively&lt;/li&gt;
&lt;li&gt;Is called &lt;i&gt;&lt;b&gt;Alternating Least Squares&lt;/b&gt;&lt;/i&gt;&lt;i&gt;&lt;b&gt;&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Algorithm&lt;/h4&gt;
&lt;pre id=&quot;code_1657685869884&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;W = randn(N, K); U = randn(M, K);
for t in range(T):&lt;/code&gt;&lt;/pre&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;$$w_{i}=\left&amp;nbsp;(&amp;nbsp;\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}u_{j}u_{j}^{T}&amp;nbsp;\right&amp;nbsp;)^{-1}\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}r_{ij}u_{j}$$&lt;/h4&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;$$u_{j}=\left&amp;nbsp;(&amp;nbsp;\sum_{i\in&amp;nbsp;\Omega_{j}}w_{i}w_{i}^{T}&amp;nbsp;\right&amp;nbsp;)^{-1}\sum_{i\in&amp;nbsp;\Omega_{j}}r_{ij}w_{i}$$&lt;i&gt;&lt;b&gt;&lt;/b&gt;&lt;/i&gt;&lt;/h4&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;FAQ&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Does it matter which order you update in? No&lt;/li&gt;
&lt;li&gt;Should you use the old values of $W$ when updating $U$?
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Tends to go faster if you use the new values&lt;/li&gt;
&lt;li&gt;Computationally, if you wanted to use the old values, you'd have to make a copy (very slow)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Bias Terms&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;The predicted rating, $\hat{r}_{ij}$, is the sum of the product of the user vector multiplied by the movie vector + user bias $b_{i}$, the movie bias $c_{j}$, and the global average $\mu$&lt;/li&gt;
&lt;li&gt;Normally, simple linear regression needs only one bias term, but MF would like to have 3&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{r}_{ij}=w_{i}^{T}u_{j}+b_{i}+c_{j}+\mu$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$\mu$: Global average. centering the data set. just calculate it directly from train data.&lt;/li&gt;
&lt;li&gt;The reason we like both a user bias and a movie bias is that both these dimensions can be biased&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Ex: Movie Bias&lt;/h3&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;250&quot; data-origin-height=&quot;358&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vXGR3/btrHdateDIN/mEBi484ekfqOhRUNWSwqYk/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vXGR3/btrHdateDIN/mEBi484ekfqOhRUNWSwqYk/img.jpg&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vXGR3/btrHdateDIN/mEBi484ekfqOhRUNWSwqYk/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FvXGR3%2FbtrHdateDIN%2FmEBi484ekfqOhRUNWSwqYk%2Fimg.jpg&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;250&quot; height=&quot;358&quot; data-origin-width=&quot;250&quot; data-origin-height=&quot;358&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1000&quot; data-origin-height=&quot;1482&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c2FpGJ/btrHaYfL34V/lpvUBmDeW0kseRkMTJjWF0/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c2FpGJ/btrHaYfL34V/lpvUBmDeW0kseRkMTJjWF0/img.jpg&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c2FpGJ/btrHaYfL34V/lpvUBmDeW0kseRkMTJjWF0/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc2FpGJ%2FbtrHaYfL34V%2FlpvUBmDeW0kseRkMTJjWF0%2Fimg.jpg&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;253&quot; height=&quot;375&quot; data-origin-width=&quot;1000&quot; data-origin-height=&quot;1482&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Consider a universally well-liked movie like James Cameron's Avatar&lt;/li&gt;
&lt;li&gt;MF might find latent features, e.g.
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Sci-if&lt;/li&gt;
&lt;li&gt;Aliens&lt;/li&gt;
&lt;li&gt;Humans fighting aliens&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Battlefield Earth has these attributes&lt;/li&gt;
&lt;li&gt;Widely considered to be the worst sci-fi movie of all time&lt;/li&gt;
&lt;li&gt;Thus, a movie-specific bias term makes sense&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Training&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Solving for $W$&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Objective function&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-\hat{r}_{ij})^2$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{r}_{ij}=w_{i}^{T}u_{j}+b_{i}+c_{j}+\mu$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Differentiate wrt $w_{i}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial J}{\partial w_{i}}=2\sum_{j\in \Psi_{i} }(r_{ij}-w_{i}^{T}u_{j}-b_{i}-c_{j}-\mu)(-u_{j})=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Move other terms to RHS&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in \Psi_{i} }(w_{i}^{T}u_{j})(u_{j})=\sum_{j\in \Psi_{i} }(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Use the same tricks from before to isolate w&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{i}=\left ( \sum_{j\in \Psi_{i} }u_{j}u_{j}^{T} \right )^{-1}\sum_{j\in \Psi_{i} }(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Solving for $U$&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$u_{j}=\left ( \sum_{i\in \Omega_{j}}w_{i}w_{i}^{T} \right )^{-1}\sum_{i\in \Omega_{j}}(r_{ij}-b_{i}-c_{j}-\mu)w_{i}$$&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Solving for b&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Differentiate wrt b&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-\hat{r}_{ij})^2$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{r}_{ij}=w_{i}^{T}u_{j}+b_{i}+c_{j}+\mu$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial J}{\partial b_{i}}=2\sum_{j\in \Psi_{i} }(r_{ij}-w_{i}^{T}u_{j}-b_{i}-c_{j}-\mu)(-1)=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Isolate b&lt;/li&gt;
&lt;li&gt;Common mistake: moving a variable outside a summation is equal to the variable itself (don't forget to multiply by # of terms being summed)&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$b_{i}=\frac{1}{\left|\Psi_{i}&amp;nbsp;\right|}\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}(r_{ij}-w_{i}^{T}u_{j}-c_{j}-\mu)$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$b_{i}$ is the average deviation between target and modeling prediction, if the prediction did not involve $b_{i}$&lt;/li&gt;
&lt;li&gt;i.e. $b_{i}$ is exactly how much you need to add to the model prediction without $b_{i}$&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Solving for c&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;The only difference is what we sum over which is now all the users who rate movie_j&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-\hat{r}_{ij})^2$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{r}_{ij}=w_{i}^{T}u_{j}+b_{i}+c_{j}+\mu$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial J}{\partial c_{j}}=2\sum_{i\in \Omega_{j} }(r_{ij}-w_{i}^{T}u_{j}-b_{i}-c_{j}-\mu)(-1)=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Again makes sense that $c_{j}$ is the average deviation of a model that doesn't involve $c_{j}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$c_{j}=\frac{1}{\left|\Omega_{j} \right|}\sum_{i\in \Omega_{j} }(r_{ij}-w_{i}^{T}u_{j}-b_{i}-\mu)$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Summary&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{i}=\left ( \sum_{j\in \Psi_{i} }u_{j}u_{j}^{T} \right )^{-1}\sum_{j\in \Psi_{i} }(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$u_{j}=\left ( \sum_{i\in \Omega_{j}}w_{i}w_{i}^{T} \right )^{-1}\sum_{i\in \Omega_{j}}(r_{ij}-b_{i}-c_{j}-\mu)w_{i}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$b_{i}=\frac{1}{\left|\Psi_{i}&amp;nbsp;\right|}\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}(r_{ij}-w_{i}^{T}u_{j}-c_{j}-\mu)$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$c_{j}=\frac{1}{\left|\Omega_{j} \right|}\sum_{i\in \Omega_{j} }(r_{ij}-w_{i}^{T}u_{j}-b_{i}-\mu)$$&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Regularization&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;A technique to prevent overfitting and help generalization&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;In linear regression&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Model: $\hat{y}=w^{T}x$&lt;/li&gt;
&lt;li&gt;Objective: $J=\sum_{i=1}^{N}(y_{i}-\hat{y}_{i})^{2}+\lambda\left\|&amp;nbsp;w\right\|_{2}^{2}$&lt;/li&gt;
&lt;li&gt;Solution: $w=(\lambda I + X^{T}X)^{-1}X^{T}y$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;where $\left\| w\right\|_{2}^{2}$ is squared magnitude of the weights themselves which is called penalty term. The idea is if the weights become too large, that's a good sign of overfitting. So large weights are penalized.&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Regularization in Matrix Factorization&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Same approach, add squared magnitude of each parameter multiplied by regularization constant&lt;/li&gt;
&lt;li&gt;$\left\| *\right\|_{F}$ is called the Frobenius norm on a matrix&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-\hat{r}_{ij})^{2}+\lambda(\left\|&amp;nbsp;W\right\|_{F}^{2}+\left\|&amp;nbsp;U\right\|_{F}^{2}+\left\|&amp;nbsp;b\right\|_{2}^{2}+\left\|&amp;nbsp;c\right\|_{2}^{2})$$&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Solve for $W$&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Derivatives are additive, we just need to differentiate the 2nd term and add it to the existing derivative&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial J}{\partial w_{i}}=2\sum_{j\in \Psi_{i} }(r_{ij}-w_{i}^{T}u_{j}-b_{i}-c_{j}-\mu)(-u_{j})+2\lambda w_{i}=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;If you can't see how I differentiated $w_{i}$ wrt Frobenius norm, expand it&lt;/li&gt;
&lt;li&gt;Now it's just a dot product which we know how to differentiate&lt;/li&gt;
&lt;li&gt;The Frobenius norm is just the sum of the magnitudes of each individual element&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Therefore, I can also split them up in terms of each row as well&lt;/li&gt;
&lt;li&gt;The squared magnitude of a vector is just the dot product of the vector with itself&lt;/li&gt;
&lt;li&gt;The derivative of the dot product is just the vector itself&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\left\|&amp;nbsp;W\right\|_{F}^{2}=\sum_{i=1}^{N}\sum_{k=1}^{K}\left|&amp;nbsp;w_{ik}\right|^{2}=\sum_{i=1}^{N}\left\|&amp;nbsp;w_{i}\right\|_{2}^{2}=\sum_{i=1}^{N}w_{i}^{T}w_{i}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Group like-terms&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in&amp;nbsp;\Psi_{i}}u_{j}u_{j}^{T}w_{i}+\lambda&amp;nbsp;w_{i}=\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Factor out w&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\left (&amp;nbsp;&amp;nbsp;\sum_{j\in \Psi_{i}}u_{j}u_{j}^{T} + \lambda I\right )w_{i}=\sum_{j\in \Psi_{i}}(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Apply our usual solution&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{i}=\left&amp;nbsp;(&amp;nbsp;&amp;nbsp;\sum_{j\in&amp;nbsp;\Psi_{i}}u_{j}u_{j}^{T}&amp;nbsp;+&amp;nbsp;\lambda&amp;nbsp;I\right&amp;nbsp;)^{-1}\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Solve for $U$&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Use symmetry reasoning&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$u_{j}=\left&amp;nbsp;(&amp;nbsp;&amp;nbsp;\sum_{i\in&amp;nbsp;\Omega_{j}}w_{i}w_{i}^{T}&amp;nbsp;+&amp;nbsp;\lambda&amp;nbsp;I\right&amp;nbsp;)^{-1}\sum_{i\in&amp;nbsp;\Omega_{j}}(r_{ij}-b_{i}-c_{j}-\mu)w_{i}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Solve for b&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;differentiate&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$J=\sum_{i,j\in&amp;nbsp;\Omega}(r_{ij}-\hat{r}_{ij})^{2}+\lambda(\left\|&amp;nbsp;W\right\|_{F}^{2}+\left\|&amp;nbsp;U\right\|_{F}^{2}+\left\|&amp;nbsp;b\right\|_{2}^{2}+\left\|&amp;nbsp;c\right\|_{2}^{2})$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\frac{\partial&amp;nbsp;J}{\partial&amp;nbsp;b_{i}}=2\sum_{j\in&amp;nbsp;\Psi_{i}&amp;nbsp;}(r_{ij}-w_{i}^{T}u_{j}-b_{i}-c_{j}-\mu)(-1)+2\lambda&amp;nbsp;b_{i}=0$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Isolate $b_{i}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sum_{j\in&amp;nbsp;\Psi_{i}}b_{i}+\lambda&amp;nbsp;b_{i}=\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-w_{i}^{T}u_{j}-c_{j}-\mu)$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Factor out $b_{i}$&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$b_{i}\left\{&amp;nbsp;\left&amp;nbsp;(&amp;nbsp;\sum_{j\in&amp;nbsp;\Psi_{i}}1&amp;nbsp;\right&amp;nbsp;)+\lambda&amp;nbsp;\right\}&amp;nbsp;=\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-w_{i}^{T}u_{j}-c_{j}-\mu)$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Divide by constant&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$1+\lambda$ is bigger than 1, so $b_{i}$ become smaller&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$b_{i}=\frac{1}{\left|&amp;nbsp;\Psi_{i}&amp;nbsp;\right|&amp;nbsp;+&amp;nbsp;\lambda}\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-w_{i}^{T}u_{j}-c_{j}-\mu)$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Solve for c&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Apply symmetry reasoning again&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$c_{j}=\frac{1}{\left|&amp;nbsp;\Omega_{j}&amp;nbsp;\right|&amp;nbsp;+&amp;nbsp;\lambda}\sum_{i\in&amp;nbsp;\Omega_{j}}(r_{ij}-w_{i}^{T}u_{j}-b_{i}-\mu)$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Summary&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{i}=\left&amp;nbsp;(&amp;nbsp;&amp;nbsp;\sum_{j\in&amp;nbsp;\Psi_{i}}u_{j}u_{j}^{T}&amp;nbsp;+&amp;nbsp;\lambda&amp;nbsp;I\right&amp;nbsp;)^{-1}\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-b_{i}-c_{j}-\mu)u_{j}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$u_{j}=\left&amp;nbsp;(&amp;nbsp;&amp;nbsp;\sum_{i\in&amp;nbsp;\Omega_{j}}w_{i}w_{i}^{T}&amp;nbsp;+&amp;nbsp;\lambda&amp;nbsp;I\right&amp;nbsp;)^{-1}\sum_{i\in&amp;nbsp;\Omega_{j}}(r_{ij}-b_{i}-c_{j}-\mu)w_{i}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$b_{i}=\frac{1}{\left|&amp;nbsp;\Psi_{i}&amp;nbsp;\right|&amp;nbsp;+&amp;nbsp;\lambda}\sum_{j\in&amp;nbsp;\Psi_{i}}(r_{ij}-w_{i}^{T}u_{j}-c_{j}-\mu)$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$c_{j}=\frac{1}{\left|&amp;nbsp;\Omega_{j}&amp;nbsp;\right|&amp;nbsp;+&amp;nbsp;\lambda}\sum_{i\in&amp;nbsp;\Omega_{j}}(r_{ij}-w_{i}^{T}u_{j}-b_{i}-\mu)$$&lt;/p&gt;</description>
      <category>MLAI/RecommendSystem</category>
      <category>alternating least square</category>
      <category>Dimension reduction</category>
      <category>Matrix Factorization</category>
      <category>SVD</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/918</guid>
      <comments>https://demyank.tistory.com/918#entry918comment</comments>
      <pubDate>Tue, 12 Jul 2022 18:58:59 +0900</pubDate>
    </item>
    <item>
      <title>Item-Item Collaborative Filtering</title>
      <link>https://demyank.tistory.com/917</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;Intuition&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;The correlation between the column vectors is high&lt;/li&gt;
&lt;li&gt;If you like Power Rangers, you'll also like Transformers because users give them similar ratings&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 85px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;Power Rangers&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;Transformers&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;Ninja Turtles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;User 1&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;4.5&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;User 2&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;4.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;User 3&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;User 4&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 25%; height: 17px;&quot;&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;User-User Collaborative Filtering&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;480&quot; data-origin-height=&quot;360&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/d3lZpN/btrG8Hdu8rz/gTgKgxJb1chn3hFw9GyuxK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/d3lZpN/btrG8Hdu8rz/gTgKgxJb1chn3hFw9GyuxK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/d3lZpN/btrG8Hdu8rz/gTgKgxJb1chn3hFw9GyuxK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fd3lZpN%2FbtrG8Hdu8rz%2FgTgKgxJb1chn3hFw9GyuxK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;480&quot; height=&quot;360&quot; data-origin-width=&quot;480&quot; data-origin-height=&quot;360&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;For user-user CF, I want to find &quot;users like me&quot;&lt;/li&gt;
&lt;li&gt;The movies that those users have seen, that I haven't seen, become my recommendations&lt;/li&gt;
&lt;li&gt;It's intuitive that if they are &quot;like me&quot;, I would like movies they've rated highly&lt;/li&gt;
&lt;li&gt;Looks row-wise&lt;/li&gt;
&lt;li&gt;Each row is a vector&lt;/li&gt;
&lt;li&gt;2 users are similar in their row vectors have a small distance between them&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Item-Item Collaborative Filtering&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;800&quot; data-origin-height=&quot;343&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/7FBmo/btrG8zNqmxj/WcpLyK2MS2t6RW4OQIWolk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/7FBmo/btrG8zNqmxj/WcpLyK2MS2t6RW4OQIWolk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/7FBmo/btrG8zNqmxj/WcpLyK2MS2t6RW4OQIWolk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7FBmo%2FbtrG8zNqmxj%2FWcpLyK2MS2t6RW4OQIWolk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;800&quot; height=&quot;343&quot; data-origin-width=&quot;800&quot; data-origin-height=&quot;343&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;What if we looked column-wise instead?&lt;/li&gt;
&lt;li&gt;Let's find 2 products that are similar&lt;/li&gt;
&lt;li&gt;They are similar if their column vectors' distance is small&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Item Correlation&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{ii'}=\frac{\sum_{j\in\Omega_{ii'}}(r_{ij}-\bar{r}_{i})(r_{i'j}-\bar{r}_{i'})}{\sqrt{\sum_{j\in\Omega_{ii'}}(r_{ij}-\bar{r}_{i})^2}\sqrt{\sum_{j\in\Omega_{ii'}}(r_{i'j}-\bar{r}_{i'})^2}}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\Omega_{j}=users \ who \ rated \ item \ j$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\Omega_{jj'}=users \ who \ rated \ item \ j \ and \ item \ j'$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\bar{r}_{j}=average \ rating \ for \ item \ j$&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Item Score&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$s(i,j)=\bar{r}_{i}+\frac{\sum_{i'\in\Psi_{j}}{w_{ii'}(r(i',j)-\bar{r}_{i'})}}{\sum_{i'\in\Psi_{j}}|w_{ii'}|}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\Psi= items \ user \ i \ has \ rated$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Deviation: how much user i likes item j', compared to how much everyone else likes j' (IMO, not as intuitive as user-user CF)&lt;/li&gt;
&lt;li&gt;If user i really likes j' (more than other users do) and j is similar to j' ($w_{jj'}$ is high), then user i probably likes j too&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Comparison&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;User-User CF: choose items for a user, because those items have been liked by similar users&lt;/li&gt;
&lt;li&gt;Item-Item CF: choose items for a user, because this user has liked similar items in the past&lt;/li&gt;
&lt;li&gt;By flipping the ratings matrix sideways, we can convert user-user CF algorithm into an item-item CF algorithm&lt;/li&gt;
&lt;li&gt;User-based and Item-based CF are mathematically identical&lt;/li&gt;
&lt;li&gt;Item-based CF is more accurate because more data to work with&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Practical differences&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;When comparing 2 items, you have a lot more data than when comparing 2 users
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Each user: up to ~ 20k items to look at&lt;/li&gt;
&lt;li&gt;Each item: up to 100k users to look at&lt;/li&gt;
&lt;li&gt;Thus for item-based CF, weights are calculated based on more data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Item-based CF is faster
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Given a user, calculate scores for each item: $O(M^{2}N)
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;There are $M^{2}$ item-item weights, and each vector is length N&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;For user-based CF we saw $O(N^{2}M)$&lt;/li&gt;
&lt;li&gt;N &amp;gt;&amp;gt; M, so $N^{2}$ compared to $M^{2}$ is even worse&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Item-based CF is more accurate&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Limitation&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Item-based CF may be too accurate&lt;/li&gt;
&lt;li&gt;It's always suggesting similar products&lt;/li&gt;
&lt;li&gt;This leads to a lack of diversity in recommendations - the YouTube problem&lt;/li&gt;
&lt;li&gt;Worse MSE might be more desirable&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;The Cold-Start Problem&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;We know that if we don't have enough data, we can't calculate correlations&lt;/li&gt;
&lt;li&gt;What if we don't have any data at all?
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Add a prior to the average&lt;/li&gt;
&lt;li&gt;The score can be a weighted sum of prediction + prior average&lt;/li&gt;
&lt;li&gt;No data at all -&amp;gt; rely solely on prior&lt;/li&gt;
&lt;li&gt;How to get prior? Scrape from the web or something else&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Not necessarily movies/ratings&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;user-item matrix doesn't have to be ratings at all&lt;/li&gt;
&lt;li&gt;Explicit feedback is sparse&lt;/li&gt;
&lt;li&gt;# of times user viewed a product&lt;/li&gt;
&lt;li&gt;Did they purchase?&lt;/li&gt;
&lt;li&gt;Hit like?&lt;/li&gt;
&lt;li&gt;Share on social media?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Reference&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://www.cs.umd.edu/~samir/498/Amazon-Recommendations.pdf&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.cs.umd.edu/~samir/498/Amazon-Recommendations.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://takuti.github.io/Recommendation.jl/latest/collaborative_filtering/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://takuti.github.io/Recommendation.jl/latest/collaborative_filtering/&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-sims.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-sims.html&lt;/a&gt;&lt;/p&gt;</description>
      <category>MLAI/RecommendSystem</category>
      <category>aws sims</category>
      <category>CF</category>
      <category>Collaborative filtering</category>
      <category>item-item cf</category>
      <category>item-to-item cf</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/917</guid>
      <comments>https://demyank.tistory.com/917#entry917comment</comments>
      <pubDate>Tue, 12 Jul 2022 14:49:29 +0900</pubDate>
    </item>
    <item>
      <title>Sigmoid and Softmax</title>
      <link>https://demyank.tistory.com/899</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;1. Softmax&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Softmax function calculates the probability distribution of the event over k different events. This function will calculate the probabilities of each target class over all possible target classes.&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Equation&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$P(y=j&amp;nbsp;|&amp;nbsp;x)&amp;nbsp;=&amp;nbsp;\frac{e^{x_j}}{\sum_{k=1}^K&amp;nbsp;e^{x_k}}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Plot&lt;/h3&gt;
&lt;pre id=&quot;code_1657273866946&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;x = np.arange(-2.0, 6.0, 0.1)
input = np.vstack([x, np.ones_like(x), 0.2 * np.ones_like(x)])&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;4210&quot; data-origin-height=&quot;234&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/UQqyO/btrGPDJ83JM/gHKj8smJfE5xRKTg1wSTzK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/UQqyO/btrGPDJ83JM/gHKj8smJfE5xRKTg1wSTzK/img.png&quot; data-alt=&quot;input&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/UQqyO/btrGPDJ83JM/gHKj8smJfE5xRKTg1wSTzK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FUQqyO%2FbtrGPDJ83JM%2FgHKj8smJfE5xRKTg1wSTzK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;4210&quot; height=&quot;234&quot; data-origin-width=&quot;4210&quot; data-origin-height=&quot;234&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;input&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;372&quot; data-origin-height=&quot;248&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/CwU6U/btrGQEakkcp/RXFGkO8MQxxaoeeKuKkohk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/CwU6U/btrGQEakkcp/RXFGkO8MQxxaoeeKuKkohk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/CwU6U/btrGQEakkcp/RXFGkO8MQxxaoeeKuKkohk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FCwU6U%2FbtrGQEakkcp%2FRXFGkO8MQxxaoeeKuKkohk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;372&quot; height=&quot;248&quot; data-origin-width=&quot;372&quot; data-origin-height=&quot;248&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Characteristic&lt;/h3&gt;
&lt;ol style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;It normalizes your data: Outputs a proper probability distribution&lt;/li&gt;
&lt;li&gt;It is differentiable
&lt;ol style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;A hardmax function such as argmax is not differentiable. The softmax gives at least a minimal amount of probability to all elements in the output vector, and so is nicely differentiable, hence the term &amp;ldquo;soft&amp;rdquo; in softmax&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;It uses the exponential form. The interesting property of the exponential function combined with the normalization in the softmax is that high scores in x become much more probable than low scores&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;640&quot; data-origin-height=&quot;480&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b24dcV/btrGKHkLNrt/QEUlKKhui0j8cY0voldk61/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b24dcV/btrGKHkLNrt/QEUlKKhui0j8cY0voldk61/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b24dcV/btrGKHkLNrt/QEUlKKhui0j8cY0voldk61/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb24dcV%2FbtrGKHkLNrt%2FQEUlKKhui0j8cY0voldk61%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;640&quot; height=&quot;480&quot; data-origin-width=&quot;640&quot; data-origin-height=&quot;480&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h1&gt;2. Sigmoid&lt;/h1&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Equation&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$sigmoid(x_{i})=\sigma(x)=\frac{1}{1+e^{-x_{i}}}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Plot&lt;/h3&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;500&quot; data-origin-height=&quot;279&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/di3rMZ/btrGObHPFvM/qnAWHKnGMFngVS3RYynisk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/di3rMZ/btrGObHPFvM/qnAWHKnGMFngVS3RYynisk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/di3rMZ/btrGObHPFvM/qnAWHKnGMFngVS3RYynisk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fdi3rMZ%2FbtrGObHPFvM%2FqnAWHKnGMFngVS3RYynisk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;500&quot; height=&quot;279&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;500&quot; data-origin-height=&quot;279&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Characteristic&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Input domain: $(-\infty, +\infty )$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Output range: (0, +1)&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\sigma(0)=0.5$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #555555;&quot;&gt;The function is monotonically increasing&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #555555;&quot;&gt;The function is continuous everywhere&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #555555;&quot;&gt;The function is differentiable everywhere in its domain&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #555555;&quot;&gt;Numerically, it is enough to compute this function&amp;rsquo;s value over a small range of numbers, e.g., [-10, +10]. For values less than -10, the function&amp;rsquo;s value is almost zero. For values greater than 10, the function&amp;rsquo;s values are almost one&lt;/span&gt;&lt;/p&gt;
&lt;h1&gt;Reference&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://datascience.stackexchange.com/questions/23159/in-softmax-classifier-why-use-exp-function-to-do-normalization&quot;&gt;https://datascience.stackexchange.com/questions/23159/in-softmax-classifier-why-use-exp-function-to-do-normalization&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://www.quora.com/How-does-softmax-relate-to-the-true-probability-of-a-sample-being-correctly-classified&quot;&gt;https://www.quora.com/How-does-softmax-relate-to-the-true-probability-of-a-sample-being-correctly-classified&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://machinelearningmastery.com/a-gentle-introduction-to-sigmoid-function/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://machinelearningmastery.com/a-gentle-introduction-to-sigmoid-function/&lt;/a&gt;&lt;/p&gt;</description>
      <category>MLAI/DeepLearning</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/899</guid>
      <comments>https://demyank.tistory.com/899#entry899comment</comments>
      <pubDate>Thu, 7 Jul 2022 18:32:36 +0900</pubDate>
    </item>
    <item>
      <title>AWS Personalize</title>
      <link>https://demyank.tistory.com/890</link>
      <description>&lt;h1&gt;Built-in Recipe (Model)&lt;/h1&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Sims&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #fdfdfd; color: #000000;&quot;&gt;Based on &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;collaborative filtering&lt;/span&gt;. &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;SIMS identifies the co-occurrence of the item in user histories in your Interaction dataset to recommend similar items. &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;For example, with SIMS Amazon Personalize could recommend coffee shop items customers frequently bought together or movies that different users also watched.&lt;/span&gt;&lt;/span&gt;&amp;nbsp; Recommended for improved item searchability and faster performance on detail pages.&lt;/span&gt;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;HPO tunable hyper-parameter&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;The process of choosing the best value for a hyper-parameter is called hyper-parameter optimization(HPO).&amp;nbsp;&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 51px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style14&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.5117%; height: 17px;&quot;&gt;Name&lt;/td&gt;
&lt;td style=&quot;width: 73.4883%; height: 17px;&quot;&gt;Description&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.5117%; height: 17px;&quot;&gt;popularity_discount_factor&lt;/td&gt;
&lt;td style=&quot;width: 73.4883%; height: 17px;&quot;&gt;It affects the balance between popularity and correlation when you calculate similarity. If you calculate similarities to a specific item, a value of 0 makes the most popular items appear as recommendations regardless of their correlation. A value of 1 makes most items that make co-interactions regardless of their popularity. Using either extreme might create an overly long list of recommended items. For most cases, a value around 0.5 works best.&lt;br /&gt;Default: 0.5&lt;br /&gt;Range: [0.0, 1.0]&lt;br /&gt;Value type: Float&lt;br /&gt;HPO tunable: Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.5117%; height: 17px;&quot;&gt;min_cointeraction_count&lt;/td&gt;
&lt;td style=&quot;width: 73.4883%; height: 17px;&quot;&gt;The minimum number of co-interactions you need to calculate the similarity between a pair of items. For example, a value of 3 means that you need 3 or more users who interacted with both items for the algorithm to calculate their similarity&lt;br /&gt;Default: 3&lt;br /&gt;Range: [0, 10]&lt;br /&gt;Value type: Integer&lt;br /&gt;HPO tunable: Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;HPO tunable&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;Can the parameter participate in hyperparameter optimization (HPO)?&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;python&quot; data-ke-language=&quot;python&quot;&gt;&lt;code&gt;create_solution_response = personalize.create_solution(
    name = &quot;DEMO-sims-solution-hpo-&quot;+suffix,
    datasetGroupArn = dataset_group_arn,
    recipeArn = recipe_arn,
    performHPO = True,
    solutionConfig={
        'hpoConfig': {
            'hpoResourceConfig': {
                  'maxNumberOfTrainingJobs': '40',
                  'maxParallelTrainingJobs': '10'
              }
        }
    }
)&lt;/code&gt;&lt;/pre&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Featurization hyper-parameter&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Choose an appropriate value after you review user history lengths, using a histogram or similar tool. We recommend setting a value that retains the majority of users but removes the edge cases.&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 278px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style14&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 33.9536%; height: 17px;&quot;&gt;Name&lt;/td&gt;
&lt;td style=&quot;width: 66.0464%; height: 17px;&quot;&gt;Description&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 210px;&quot;&gt;
&lt;td style=&quot;width: 33.9536%; height: 210px;&quot;&gt;min_user_history_length_percentile&lt;/td&gt;
&lt;td style=&quot;width: 66.0464%; height: 210px;&quot;&gt;The minimum percentile of user history lengths to include in model training. History length is the total amount of available data on a user. Use min_user_history_length_percentile to exclude a percentage of users with short history lengths. Users with a short history often show patterns based on item popularity instead of the user's personal needs or wants. Removing them can train models with more focus on underlying patterns in your data.&lt;br /&gt;Default: 0.005&lt;br /&gt;Range: [0.0, 1.0]&lt;br /&gt;Value type: Float&lt;br /&gt;HPO Tunable: No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 33.9536%; height: 17px;&quot;&gt;max_user_history_length_percentile&lt;/td&gt;
&lt;td style=&quot;width: 66.0464%; height: 17px;&quot;&gt;The maximum percentile of user history lengths to include in model training. History length is the total amount of available data on a user. Use max_user_history_length_percentile to exclude a percentage of users with long history lengths. Users with a long history tend to contain noise. For example, a robot might have a long list of automated interactions. Removing these users limits noise in training.&lt;br /&gt;For example, min_hist_length_percentile = 0.05 and max_hist_length_percentile = 0.95 includes all users except ones with history lengths at the bottom or top 5%&lt;br /&gt;Default: 0.995&lt;br /&gt;Range: [0.0, 1.0]&lt;br /&gt;Value type: Float&lt;br /&gt;HPO tunable: No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 33.9536%; height: 17px;&quot;&gt;min_item_interaction_count_percentile&lt;/td&gt;
&lt;td style=&quot;width: 66.0464%; height: 17px;&quot;&gt;The minimum percentile of item interaction counts to include in model training. Use min_item_interaction_count_percentile to exclude a percentage of items with a short history of interactions. Items with a short history often are new items. Removing them can train models with more focus on items with a known history.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 33.9536%; height: 17px;&quot;&gt;max_item_interaction_count_percentile&lt;/td&gt;
&lt;td style=&quot;width: 66.0464%; height: 17px;&quot;&gt;The maximum percentile of item interaction counts to include in model training. Use max_item_interaction_count_percentile to exclude a percentage of items with a long history of interactions. Items with a long history tend to be older and might be out of date. For example, a movie release that is out of print. Removing these items can focus on more relevant items.&lt;br /&gt;For example, min_item_interaction_count_percentile = 0.05 and max_item_interaction_count_percentile = 0.95 includes all items except ones with an interaction count at the bottom or top 5%&lt;br /&gt;Default: 0.9&lt;br /&gt;Range: [0.0, 1.0]&lt;br /&gt;Value type: Float&lt;br /&gt;HPO tunale: No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;User-Personalize&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Based on &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;automatic item exploration. &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;It predicts the items that a user will interact with based on Interactions, Items, and Users datasets. &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;With automatic exploration, Amazon Personalize automatically tests different item recommendations, learns from how users interact with these recommended items, and boost recommendations for items that drive better engagement and conversion. &lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;You can balance how much to explore (where items with fewer interactions data or relevance are recommended more frequently) against how much to exploit (where recommendations are based on what we know or relevance). Amazon Personalize automatically adjusts future recommendations based on implicit user feedback.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;HPO t&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;unable Hyper-parameter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style14&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25.6977%;&quot;&gt;Name&lt;/td&gt;
&lt;td style=&quot;width: 74.3023%;&quot;&gt;Description&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25.6977%;&quot;&gt;hidden_dimension&lt;/td&gt;
&lt;td style=&quot;width: 74.3023%;&quot;&gt;The number of hidden variables used in the model. Hidden variables recreate the user's purchase history and item statistics to generate ranking scores. Specify a greater number of hidden dimensions when your interactions dataset includes more complicated patterns. Using more hidden dimensions requires a larger dataset and more time to process. To decide on the best value, use HPO. To use HPO, set performHPO to true when you call &lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_CreateSolution.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;CreateSolution&lt;/a&gt; and &lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_CreateSolutionVersion.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;CreateSolutionVersion&lt;/a&gt; operations.&lt;br /&gt;Default: 149&lt;br /&gt;Range: [32, 256]&lt;br /&gt;Value type: Integer&lt;br /&gt;HPO tunable: Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25.6977%;&quot;&gt;bptt&lt;/td&gt;
&lt;td style=&quot;width: 74.3023%;&quot;&gt;Determines whether to use the back-propagation time technique. Back-propagation through time is a technique that updates weights in recurrent neural network-based algorithms. Use bptt for long-term credits to connect delayed rewards to early events. For example, a delayed reward can be a purchase made after several clicks. An early event can be an initial click. Even within the same event types, such as a click, it's a good idea to consider long-term effects and maximize the total rewards. To consider long-term effects, use larger bptt values. Using a larger bptt value requires larger datasets and more time to process.&lt;br /&gt;Default: 32&lt;br /&gt;Range: [2, 32]&lt;br /&gt;Value type: Integer&lt;br /&gt;HPO tunable: Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25.6977%;&quot;&gt;recency_mask&lt;/td&gt;
&lt;td style=&quot;width: 74.3023%;&quot;&gt;Determines whether the model should consider the latest popularity trends in the interactions dataset. Latest popularity trends might include sudden changes in the underlying patterns of interaction events. To train a model that places more weight on recent events, set recency_mask to true. To train a model that equally weights all past interactions, set recency_mask to false. To get good recommendations using an equal weight, you might need a larger training dataset.&lt;br /&gt;Default: True&lt;br /&gt;Range: True or False&lt;br /&gt;Value type: Boolean&lt;br /&gt;HPO tunable: Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Featurization hyper-parameter&lt;/h4&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 51px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style14&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 31.3954%; height: 17px;&quot;&gt;Name&lt;/td&gt;
&lt;td style=&quot;width: 68.6046%; height: 17px;&quot;&gt;Description&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 31.3954%; height: 17px;&quot;&gt;min_user_history_length_percentile&lt;/td&gt;
&lt;td style=&quot;width: 68.6046%; height: 17px;&quot;&gt;The&amp;nbsp;minimum&amp;nbsp;percentile&amp;nbsp;of&amp;nbsp;user&amp;nbsp;history&amp;nbsp;lengths&amp;nbsp;to&amp;nbsp;include&amp;nbsp;in&amp;nbsp;model&amp;nbsp;training.&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 31.3954%; height: 17px;&quot;&gt;max_user_history_length_percentile&lt;/td&gt;
&lt;td style=&quot;width: 68.6046%; height: 17px;&quot;&gt;The&amp;nbsp;maximum&amp;nbsp;percentile&amp;nbsp;of&amp;nbsp;user&amp;nbsp;history&amp;nbsp;lengths&amp;nbsp;to&amp;nbsp;include&amp;nbsp;in&amp;nbsp;model&amp;nbsp;training.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Item exploration campaign configuration hyper-parameter&lt;/h4&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style14&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 26.7441%;&quot;&gt;Name&lt;/td&gt;
&lt;td style=&quot;width: 73.2559%;&quot;&gt;Description&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 26.7441%;&quot;&gt;exploration_weight&lt;/td&gt;
&lt;td style=&quot;width: 73.2559%;&quot;&gt;Determines how frequently recommendations include items with fewer interactions data or relevance. The closer the value is to 1.0, the more exploration. At 0, no exploration occurs and recommendations are based on current data (relevance).&lt;br /&gt;Default: 0.3&lt;br /&gt;Range: [0.0, 1.0]&lt;br /&gt;Value type: Float&lt;br /&gt;HPO tunable: No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 26.7441%;&quot;&gt;exploration_item_age_cut_off&lt;/td&gt;
&lt;td style=&quot;width: 73.2559%;&quot;&gt;Determine items to be explored based on the time frame since the latest interaction. Provide the maximum item age, in days since the latest interaction, to define the scope of item exploration. The larger the value, the more items are considered during exploration.&lt;br /&gt;Default: 30.0&lt;br /&gt;Range: Positive Floats&lt;br /&gt;Value type: Float&lt;br /&gt;HPO tunale: No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Datasets and schemas&lt;/h2&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Users&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Required fields&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;USER_ID (string)&lt;/li&gt;
&lt;li&gt;1 metadata field (categorical string or numerical)&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;This dataset stores metadata about your users. This might include information such as age, gender, or loyalty membership, which can be important signals in personalization systems&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Categorical metadata&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;With some recipes and both VIDEO_ON_DEMAND and ECOMMERCE domains, Amazon Personalize uses categorical metadata, such as a user's gender or membership status, when identifying underlying patterns that reveal the most relevant items for your users. You define your own range of values based on your use case. Categorical metadata can be in any language.&lt;/span&gt;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;User metadata schema example&lt;/span&gt;&lt;/h4&gt;
&lt;pre id=&quot;code_1657534976802&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;{
  &quot;type&quot;: &quot;record&quot;,
  &quot;name&quot;: &quot;Users&quot;,
  &quot;namespace&quot;: &quot;com.amazonaws.personalize.schema&quot;,
  &quot;fields&quot;: [
      {
          &quot;name&quot;: &quot;USER_ID&quot;,
          &quot;type&quot;: &quot;string&quot;
      },
      {
          &quot;name&quot;: &quot;AGE&quot;,
          &quot;type&quot;: &quot;int&quot;
      },
      {
          &quot;name&quot;: &quot;GENDER&quot;,
          &quot;type&quot;: &quot;string&quot;,
          &quot;categorical&quot;: true
      }
  ],
  &quot;version&quot;: &quot;1.0&quot;
}&lt;/code&gt;&lt;/pre&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Items&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;This dataset stores metadata about your items. This might include information such as price, SKU type, or availability.&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Required Fields&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;ITEM_ID (string)&lt;/li&gt;
&lt;li&gt;1 metadata field (categorical or textual string field or numerical field)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Reserved keywords&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;CREATION_TIMESTAMP: For item datasets with a timestamp for each item's creation date, use the CREATION_TIMESTAMP field with a type long. Amazon Personalize uses CREATION_TIMESTAMP data to calculate the age of an item and adjust recommendations accordingly.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Categorical metadata&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;With certain recipes and domains, Amazon Personalize uses categorical metadata, such as an item's genre or color, when identifying underlying patterns that reveal the most relevant items for your users. You define your own range of values based on your use case. Categorical metadata can be in any language.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;Categorical values can have a maximum of 1000 characters. If you have an item with a categorical value of more than 1000 characters, your dataset import job will fail.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;For Domain dataset groups, both &lt;i&gt;&lt;b&gt;VIDEO_ON_DEMAND&lt;/b&gt;&lt;/i&gt; and &lt;i&gt;&lt;b&gt;ECOMMERCE&lt;/b&gt;&lt;/i&gt; domains use categorical metadata. For Custom dataset groups and custom solutions, recipes that use categorical metadata include the following:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;User-Personalization&lt;/li&gt;
&lt;li&gt;Personalized-Ranking&lt;/li&gt;
&lt;li&gt;Similar-Items&lt;/li&gt;
&lt;li&gt;Item-Affinity&lt;/li&gt;
&lt;li&gt;Item-Attribute-Affinity&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Unstructured text metadata&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;With certain recipes and domains, Amazon Personalize can extract meaningful information from unstructured text metadata, such as product descriptions, product reviews, or movie synopses. Amazon Personalize uses unstructured text to identify relevant items for your users, particularly when items are new or have fewer interactions data. Include unstructured text data in your Items dataset to increase click-through rates and conversation rates for new items in your catalog.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;To use unstructured data, add a field with a type&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;string&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to your Items schema and set the field's&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;textual&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;attribute to&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;true&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;. Then include the text data in your bulk CSV file and incremental item imports. For bulk CSV files, wrap the text in double-quotes. Use the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;\&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;character to escape any double quotes or \ characters in your data.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Text can be in the following languages:&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Chinese (Simplified)&lt;/li&gt;
&lt;li&gt;Chinese (Traditional)&lt;/li&gt;
&lt;li&gt;English&lt;/li&gt;
&lt;li&gt;French&lt;/li&gt;
&lt;li&gt;German&lt;/li&gt;
&lt;li&gt;Japanese&lt;/li&gt;
&lt;li&gt;Portuguese&lt;/li&gt;
&lt;li&gt;Spanish&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Item metadata schema example&lt;/h4&gt;
&lt;pre id=&quot;code_1657534801012&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;{
  &quot;type&quot;: &quot;record&quot;,
  &quot;name&quot;: &quot;Items&quot;,
  &quot;namespace&quot;: &quot;com.amazonaws.personalize.schema&quot;,
  &quot;fields&quot;: [
    {
      &quot;name&quot;: &quot;ITEM_ID&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    {
      &quot;name&quot;: &quot;GENRES&quot;,
      &quot;type&quot;: [
        &quot;null&quot;,
        &quot;string&quot;
      ],
      &quot;categorical&quot;: true
    },
    {
      &quot;name&quot;: &quot;CREATION_TIMESTAMP&quot;,
      &quot;type&quot;: &quot;long&quot;
    },
    {
      &quot;name&quot;: &quot;DESCRIPTION&quot;,
      &quot;type&quot;: [
        &quot;null&quot;,
        &quot;string&quot;
      ],
      &quot;textual&quot;: true
    },
  ],
  &quot;version&quot;: &quot;1.0&quot;
}&lt;/code&gt;&lt;/pre&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Interactions&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;This dataset stores historical and real-time data from interactions between users and items. In Amazon Personalize, interaction is an event that you record and then import as training data. For both Domain dataset groups and Custom dataset groups, you must at minimum create an Interaction dataset.&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Required Fields&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;USER_ID (string)&lt;/li&gt;
&lt;li&gt;ITEM_ID (string)&lt;/li&gt;
&lt;li&gt;TIMESTAMP (long)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Reserved keywords&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;EVENT_TYPE (string): For Interactions datasets with one or more event types, such as both click and download, use an EVENT_TYPE field. You must define an EVENT_TYPE field as a string and can't be set as categorical.&lt;/li&gt;
&lt;li&gt;EVENT_VALUE (float,&amp;nbsp;null): For interactions datasets that include value data for events, such as the percentage of a video a user watched, use an EVENT_VALUE field with type float and optionally null.&lt;/li&gt;
&lt;li&gt;IMPRESSION (string,&amp;nbsp;null): For interaction datasets with explicit impressions data, use an IMPRESSIONS field with type String and optionally type null. Impressions are lists of items that were visible to a user when they interacted with (for example, clicked or watched) a particular item.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;RECOMMENDATION_ID (string,&amp;nbsp;null): For interactions datasets that user previous recommendations as implicit impressions data, optionally use a RECOMMENDATION_ID field with type String and optionally type null.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Contextual metadata&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;With certain recipes and recommender use cases, Amazon Personalize can use contextual metadata when identifying underlying patterns that reveal the most relevant items for your users. Contextual metadata is interaction data you collect on the user's environment at the time of an event, such as their location or device type.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Including contextual metadata allows you to provide a more personalized experience for existing users. For example, if customers shop differently when accessing your catalog from a phone compared to a computer, include contextual metadata about the user's device. Recommendations will then be more relevant based on how they are browsing.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Additionally, contextual metadata helps decrease the cold-start phase for new or unidentified users. The cold-start phase refers to the period when your recommendation engine provides less relevant recommendations due to the lack of historical information regarding that user.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For Domain dataset groups, the following recommender use cases can use contextual metadata:&lt;/p&gt;
&lt;div&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/ECOMMERCE-use-cases.html#recommended-for-you-use-case&quot;&gt;Recommended for you&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(ECOMMERCE domain)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/VIDEO_ON_DEMAND-use-cases.html#top-picks-use-case&quot;&gt;Top picks for you&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(VIDEO_ON_DEMAND domain)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For Custom dataset groups and custom solutions, recipes that use contextual metadata include the following:&lt;/p&gt;
&lt;div&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-new-item-USER_PERSONALIZATION.html&quot;&gt;User-Personalization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-search.html&quot;&gt;Personalized-Ranking&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Impressions data&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;Impressions are lists of items that were visible to a user when they interacted with (for example, clicked or watched) a particular item. Amazon Personalize uses impression data to determine what items to include in exploration.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;Exploration&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is where recommendations include new items with fewer interactions data or relevance. The more frequently an item occurs in impressions data, the less likely it is that Amazon Personalize includes the item in exploration.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;Implicit impressions&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;Implicit impressions&lt;span&gt;&amp;nbsp;&lt;/span&gt;are the recommendations, retrieved from Amazon Personalize, that you show the user. You can integrate them into your recommendation workflow by including the&lt;span&gt;&amp;nbsp;&lt;/span&gt;RecommendationId&lt;span&gt;&amp;nbsp;&lt;/span&gt;(returned by the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html&quot;&gt;GetRecommendations&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetPersonalizedRanking.html&quot;&gt;GetPersonalizedRanking&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;operations) as input for future&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html&quot;&gt;PutEvents&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;requests. Amazon Personalize derives the implicit impressions based on your recommendation data.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For example, you might have an application that provides recommendations for streaming video. Your recommendation workflow using implicit impressions might be as follows:&lt;/p&gt;
&lt;ol style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;You request video recommendations for one of your users using the Amazon Personalize&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html&quot;&gt;GetRecommendations&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;API operation.&lt;/li&gt;
&lt;li&gt;Amazon Personalize generates recommendations for the user using your model (solution version) and returns them with a&lt;span&gt;&amp;nbsp;&lt;/span&gt;recommendationId&lt;span&gt;&amp;nbsp;&lt;/span&gt;in the API response.&lt;/li&gt;
&lt;li&gt;You show the video recommendations to your user in your application.&lt;/li&gt;
&lt;li&gt;When your user interacts with (for example, clicks) a video, record the choice in a call to the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html&quot;&gt;PutEvents&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;API and include the&lt;span&gt;&amp;nbsp;&lt;/span&gt;recommendationId&lt;span&gt;&amp;nbsp;&lt;/span&gt;as a parameter. For a code, sample see&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data&quot;&gt;Recording impressions data&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Amazon Personalize uses the&lt;span&gt;&amp;nbsp;&lt;/span&gt;recommendationId&lt;span&gt;&amp;nbsp;&lt;/span&gt;to derive the impression data from the previous video recommendations and then uses the impression data to guide exploration, where future recommendations include new videos with fewer interactions data or relevance.&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;Explicit impressions&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Explicit impressions&lt;span&gt;&amp;nbsp;&lt;/span&gt;are impressions that you manually record and send to Amazon Personalize. Use explicit impressions to manipulate results from Amazon Personalize. The order of the items has no impact.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For example, you might have a shopping application that provides recommendations for shoes. If you only recommend shoes that are currently in stock, you can specify these items using explicit impressions. Your recommendation workflow using explicit impressions might be as follows:&lt;/p&gt;
&lt;div&gt;
&lt;ol style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;You request recommendations for one of your users using the Amazon Personalize&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html&quot;&gt;GetRecommendations&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;API.&lt;/li&gt;
&lt;li&gt;Amazon Personalize generates recommendations for the user using your model (solution version) and returns them in the API response.&lt;/li&gt;
&lt;li&gt;You show the user only the recommended shoes that are in stock.&lt;/li&gt;
&lt;li&gt;For real-time incremental data import, when your user interacts with (for example, clicks) a pair of shoes, you record the choice in a call to the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html&quot;&gt;PutEvents&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;API and list the recommended items that are in stock in the&lt;span&gt;&amp;nbsp;&lt;/span&gt;impression&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter. For a code, sample see&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data&quot;&gt;Recording impressions data&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For importing impressions in historical interactions data, you can list explicit impressions in your csv file and separate each item with a '|' character. See&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/data-prep-formatting.html#data-prep-including-explicit-impressions&quot;&gt;Formatting explicit impressions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Amazon Personalize uses impression data to guide exploration, where future recommendations include new shoes with fewer interactions data or relevance.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Impression feedback Example&lt;/h4&gt;
&lt;pre id=&quot;code_1657529985953&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import boto3
            
personalize_events.put_events(
     trackingId = 'event tracking id',
     userId= 'user id',
     sessionId = '1',
     eventList = [{
     'sentAt': datetime.now().timestamp(),
     'eventType' : 'click',
     'itemId' : rec_response['itemList'][0]['itemId'],        
     'recommendationId': rec_response['recommendationId'],
     'impression': [item['itemId'] for item in rec_response['itemList']],
     }]
)&lt;/code&gt;&lt;/pre&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Interaction metadata schema example&lt;/h4&gt;
&lt;pre id=&quot;code_1657527053763&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;{
  &quot;type&quot;: &quot;record&quot;,
  &quot;name&quot;: &quot;Interactions&quot;,
  &quot;namespace&quot;: &quot;com.amazonaws.personalize.schema&quot;,
  &quot;fields&quot;: [
      {
          &quot;name&quot;: &quot;USER_ID&quot;,
          &quot;type&quot;: &quot;string&quot;
      },
      {
          &quot;name&quot;: &quot;ITEM_ID&quot;,
          &quot;type&quot;: &quot;string&quot;
      },
      {
          &quot;name&quot;: &quot;EVENT_TYPE&quot;,
          &quot;type&quot;: &quot;string&quot;
      },
      {
          &quot;name&quot;: &quot;EVENT_VALUE&quot;,
          &quot;type&quot;: [
             &quot;float&quot;,
             &quot;null&quot;
          ]
      },
      {
          &quot;name&quot;: &quot;LOCATION&quot;,
          &quot;type&quot;: &quot;string&quot;,
          &quot;categorical&quot;: true
      },
      {
          &quot;name&quot;: &quot;DEVICE&quot;,
          &quot;type&quot;: [
              &quot;string&quot;,
              &quot;null&quot;
          ],
          &quot;categorical&quot;: true
      },
      {
          &quot;name&quot;: &quot;TIMESTAMP&quot;,
          &quot;type&quot;: &quot;long&quot;
      },
      {
          &quot;name&quot;: &quot;IMPRESSION&quot;,
          &quot;type&quot;: &quot;string&quot;
      }
  ],
  &quot;version&quot;: &quot;1.0&quot;
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Evaluation of a solution with metrics&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;You can evaluate the performance of your solution version through offline and online metrics.&lt;span&gt;&amp;nbsp;&lt;/span&gt;Online metrics&lt;span&gt;&amp;nbsp;&lt;/span&gt;are the empirical results you observe in your users' interactions with real-time recommendations. For example, you might record your users' click-through rate as they browse your catalog. You are responsible for generating and recording any online metrics.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Offline metrics&lt;span&gt;&amp;nbsp;&lt;/span&gt;are the metrics Amazon Personalize generates when you train a solution version. You can use offline metrics to evaluate the performance of the model before you create a campaign and provide recommendations. Offline metrics allow you to view the effects of modifying a solution's hyperparameters or compare results from models trained with the same data. For the rest of this section, the term metrics refers to&lt;span&gt;&amp;nbsp;&lt;/span&gt;offline metrics.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;To get performance metrics, Amazon Personalize splits the input interactions data into a training set and a testing set. The split depends on the type of recipe you choose:&lt;/p&gt;
&lt;div&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;For USER_SEGMENTATION recipes, the training set consists of 80% of each user's interactions data and the testing set consists of 20% of each user's interactions data.&lt;/li&gt;
&lt;li&gt;For all other recipe types, the training set consists of 90% of your users and their interaction data. The testing set consists of the remaining 10% of users and their interaction data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Amazon Personalize then creates the solution version using the training set. After training completes, Amazon Personalize gives the new solution version the oldest 90% of each user&amp;rsquo;s data from the testing set as input. Amazon Personalize then calculates metrics by comparing the recommendations the solution version generates to the actual interactions in the newest 10% of each user&amp;rsquo;s data from the testing set.&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Retrieving Metrics&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Coverage&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;An evaluation metric that tells you the proportion of unique items that Amazon Personalize might recommend using your model out of the total number of unique items in Interactions and Items datasets. To make sure Amazon Personalize recommends more of your items, use a model with a higher coverage score. Recipes that feature item exploration, such as User-Personalization, have higher coverage than those that don&amp;rsquo;t, such as popularity count.&lt;/span&gt;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Mean reciprocal rank at 25&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;An evaluation metric that assesses the relevance of a model&amp;rsquo;s highest-ranked recommendation. Amazon Personalize calculates this metric using the average accuracy of the model when ranking the most relevant recommendation out of the top 25 recommendations over all requests for recommendations.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;This metric is useful if you're interested in the single highest-ranked recommendation.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For example, searching for Dog and available answers are {dog, dogs, puppy} and results are below:&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 49.8837%; height: 169px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;rank&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;item&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;hotdog&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;dogs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;3&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;puppy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;4&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;cat&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;RR is 1/2 since the highest possible answer ranked at second position.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$RR=\frac{1}{Rank}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Additionally, searching for Cat and available answers are {cat, cats, kitty} then results are below:&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 49.8837%; height: 169px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;rank&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;item&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;car&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;mouse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;3&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;cats&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;4&lt;/td&gt;
&lt;td style=&quot;width: 50%; height: 17px; text-align: center;&quot;&gt;kitty&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;RR is&amp;nbsp; 1/3&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MRR is the mean RR&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$MRR=\frac{1}{\left|&amp;nbsp;\Omega&amp;nbsp;&amp;nbsp;\right|}\sum_{i=1}^{\left|&amp;nbsp;\Omega&amp;nbsp;&amp;nbsp;\right|}\frac{1}{Rank_{i}}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;So MRR of examples, $\frac{1}{2}\times(\frac{1}{2}+\frac{1}{3})\cong&amp;nbsp;0.417$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;MRR is simple evaluation, but only care about highest ranked relevant item.&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Normalized discounted cumulative gain (NDCG) at K (5/10/25)&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Unlike MRR, DCG considers all ranked item in metrics.&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;DCG assumptions&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Highly relevant documents are more useful, when appearing earlier in a search engine result list (have higher ranks)&lt;/li&gt;
&lt;li&gt;Highly relevant documents are more useful than marginally relevant documents, which are in turn more useful than non-relevant documents.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$DCG_{p}=\sum_{i=1}^{p}\frac{rel_{i}}{log_{2}(i+1)}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;Example&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;When search for Dog, results come out below:&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;rank&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;item&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;relevance&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;$log_{2}(i+1)$&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;$\frac{rel_{i}}{log_{2}(i+1)}$&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;hotdog&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;dogs&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;1.585&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;1.26&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;3&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;puppy&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;4&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;cat&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;2.322&lt;/td&gt;
&lt;td style=&quot;width: 20%;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;$DCG_{4}=0+1.26+0.5+0=1.76$&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;An evaluation metric that tells you about the relevance of your model&amp;rsquo;s highly ranked recommendations, where K is a sample size of 5, 10, or 25 recommendations. Amazon Personalize calculates this by assigning weight to recommendations based on their position in a ranked list, where each recommendation is discounted (given a lower weight) by a factor dependent on its position. The normalized discounted cumulative gain at K assumes that recommendations that are lower on a list are less relevant than recommendations higher on the list.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;$weighting \ factor = \frac{1}{log(1+position)}$&lt;/span&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Precision at K&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;An evaluation metric that tells you how relevant your model's recommendations are based on a sample size of K (5, 10, or 25) recommendations. Amazon Personalize calculates this metric based on the number of relevant recommendations out of the top K recommendations, divided by K, where K is 5, 10, or 25.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;This metric rewards precise recommendations of the relevant items.&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;average_rewards_at_k&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;When you create a solution version (train a model) for a solution with an optimization objective, Amazon Personalize generates an&lt;span&gt;&amp;nbsp;&lt;/span&gt;average_rewards_at_k&lt;span&gt;&amp;nbsp;&lt;/span&gt;metric. The score for&lt;span&gt;&amp;nbsp;&lt;/span&gt;average_rewards_at_k&lt;span&gt;&amp;nbsp;&lt;/span&gt;tells you how well the solution version performs in achieving your objective. To calculate this metric, Amazon Personalize calculates the rewards for each user as follows:&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;rewards_per_user = total rewards from the user's interactions with their top 25 reward-generating recommendations / total rewards from the user's interactions with recommendations&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;The final&lt;span&gt;&amp;nbsp;&lt;/span&gt;average_rewards_at_k&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the average of all&lt;span&gt;&amp;nbsp;&lt;/span&gt;rewards_per_user&lt;span&gt;&amp;nbsp;&lt;/span&gt;normalized to be a decimal value less than or equal to 1 and greater than 0. The closer the value is to 1, the more gains on average per user you can expect from recommendations.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For example, if your objective is to maximize revenue from clicks, Amazon Personalize calculates each user score by dividing total revenue generated by the items the user clicked from their top 25 most expensive recommendations by the revenue from all of the recommended items the user clicked. Amazon Personalize then returns a normalized average of all user scores. The closer the&lt;span&gt;&amp;nbsp;&lt;/span&gt;average_rewards_at_k&lt;span&gt;&amp;nbsp;&lt;/span&gt;is to 1, the more revenue on average you can expect to gain per user from recommendations.&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;hit (hit at K)&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;If you trained the solution version with a USER_SEGMENTATION recipe, the average number of users in the predicted top relevant K results that match the actual users. Actual users are who actually interacted with the items in the test set. K is in the top 1% of the most relevant user.&amp;nbsp; The higher the value the more accurate the predictions.&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;recall (recall at K)&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;background-color: #ffffff; color: #16191f;&quot;&gt;If you trained the solution version with a USER_SEGMENTATION recipe, the average percentage of predicted users in the predicted top relevant K results that match the actual users. Actual users are the users who actually interacted with the items in the test set. K is the top 1% of the most relevant users. The higher the value, the more accurate the predictions.&lt;/span&gt;&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Example&lt;/h3&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;precision_at_5&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Calculation: 2/5, result: 0.4&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Reference&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-sims.html&quot;&gt;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-sims.html&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-new-item-USER_PERSONALIZATION.html&quot;&gt;https://docs.aws.amazon.com/personalize/latest/dg/native-recipe-new-item-USER_PERSONALIZATION.html&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/1167344&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://ieeexplore.ieee.org/document/1167344&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://arxiv.org/pdf/2007.11808.pdf&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://arxiv.org/pdf/2007.11808.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://github.com/aws-samples/amazon-personalize-samples/blob/master/next_steps/core_use_cases/related_items/personalize_sims_example.ipynb&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/aws-samples/amazon-personalize-samples/blob/master/next_steps/core_use_cases/related_items/personalize_sims_example.ipynb&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://github.com/aws-samples/amazon-personalize-samples/blob/master/next_steps/core_use_cases/user_personalization/user-personalization-with-exploration.ipynb&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/aws-samples/amazon-personalize-samples/blob/master/next_steps/core_use_cases/user_personalization/user-personalization-with-exploration.ipynb&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/how-it-works-dataset-schema.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://docs.aws.amazon.com/personalize/latest/dg/how-it-works-dataset-schema.html&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/working-with-training-metrics.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://docs.aws.amazon.com/personalize/latest/dg/working-with-training-metrics.html&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/personalize/latest/dg/optimizing-solution-for-objective.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://docs.aws.amazon.com/personalize/latest/dg/optimizing-solution-for-objective.html&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=givCgC_RIFs&quot;&gt;https://www.youtube.com/watch?v=givCgC_RIFs&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>MLAI/RecommendSystem</category>
      <category>AWS Personalize</category>
      <category>recommend system</category>
      <category>Sims</category>
      <category>user-personalization</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/890</guid>
      <comments>https://demyank.tistory.com/890#entry890comment</comments>
      <pubDate>Thu, 7 Jul 2022 17:59:11 +0900</pubDate>
    </item>
    <item>
      <title>User-User Collaborative Filtering</title>
      <link>https://demyank.tistory.com/888</link>
      <description>&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 68px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;Batman&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;X-Men&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;Star Wars&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;The Notebook&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;Bridget Jones' Diary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;Alice&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;4.5&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;Bob&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;4.5&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;4&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;Carol&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;3&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; height: 17px;&quot;&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Intuitively, we see that Bob&amp;rsquo;s ratings are similar to Alice&amp;rsquo;s, thus he is likely to also like Star Wars. In math-speak, Alice&amp;rsquo;s and Bob&amp;rsquo;s ratings are highly correlated.&lt;/p&gt;
&lt;h1&gt;Average Rating&lt;/h1&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Limitations&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;It treats everyone&amp;rsquo;s rating of the movie. equally.&lt;/li&gt;
&lt;li&gt;Bob&amp;rsquo;s s(i, j) equally depends on Alice&amp;rsquo;s rating and Carol&amp;rsquo;s rating, even though he doesn&amp;rsquo;t agree with Carol&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$s(i,j)=\frac{\sum_{i'\in\Omega_{j}}r_{i'j}}{|\Omega_{j}|}$$&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;One of the Solutions&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Intuitively, I want to be small for users I don't agree with, large for users I do agree with&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$s(i,j)=\frac{\sum_{i\acute{}\in&amp;nbsp;\Omega&amp;nbsp;_{j}}&amp;nbsp;w_{ii\acute{}}r_{i\acute{}j}}{\sum_{i\acute{}\in&amp;nbsp;\Omega&amp;nbsp;_{j}}w_{ii\acute{}}}$$&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Another issue with average rating: Bias&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Your interpretation of a rating is different from mine&lt;/li&gt;
&lt;li&gt;Users can be biased to be optimistic or pessimistic&lt;/li&gt;
&lt;li&gt;E.g. optimistic: most movies are a 5, a bad movie is a 3&lt;/li&gt;
&lt;li&gt;E.g. pessimistic: most movies are 1 or 2, a good movie is a 4&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Deviation (without weighting)&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;We don&amp;rsquo;t care about your absolute rating, we care how much it deviates from your own average&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;If your average is 2.5, but you rate something a 5, it must be really great&lt;/li&gt;
&lt;li&gt;If you rate everything a 5, it&amp;rsquo;s difficult to know how those items compare&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$dev(i,j)=r(i,j)-\bar{r},&amp;nbsp;for&amp;nbsp;\&amp;nbsp;a&amp;nbsp;\&amp;nbsp;known&amp;nbsp;\&amp;nbsp;rating$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;The deviation is your rating - average rating, in other words, rating - bias.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;My predicted deviation is the average deviation for a movie&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Then my predicted rating is my own average + predicted deviation&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\hat{dev}(i,j)=\frac{\sum_{i'\in\Omega_{j}}{r(i',j)-\bar{r}_{i'}}}{|\Omega_{j}|},&amp;nbsp;for&amp;nbsp;\&amp;nbsp;a&amp;nbsp;\&amp;nbsp;prediction&amp;nbsp;\&amp;nbsp;from&amp;nbsp;\&amp;nbsp;known&amp;nbsp;\&amp;nbsp;ratings$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$s(i,j)=\bar{r}_{i}+\frac{\sum_{i'\in\Omega_{j}}{r(i',j)-\bar{r}_{i'}}}{|\Omega_{j}|}=\bar{r}_{i}+\hat{dev}(i,j)$$&lt;/p&gt;
&lt;h1&gt;Combine (Weighting Rating + Deviation)&lt;/h1&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Combine the idea of deviations with the idea of weighting to get our final formula&lt;/li&gt;
&lt;li&gt;Note: absolute value since weights can be negative&lt;/li&gt;
&lt;li&gt;Looking at this equation, we can see that it's just linear regression.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Intuitively, I want it to be small for users I don&amp;rsquo;t agree with, large for users I do agree with&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$s(i,j)=\bar{r}_{i}+\frac{\sum_{i'\in\Omega_{j}}{w_{ii'}(r(i',j)-\bar{r}_{i'})}}{\sum_{i'\in\Omega_{j}}|w_{ii'}|}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Hot to calculate weights? Pearson Correlation Coefficient&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\rho_{xy}=\frac{\sum^N_{i=1}(x_{i}-\bar{x})(y_{i}-\bar{y})}{\sqrt{\sum^{N}_{i=1}(x_{i}-\bar{x})^2}\sqrt{\sum^{N}_{i=1}(y_{i}-\bar{y})^2}}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Problem: Our matrix is sparse&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Solution: Just use the data we have&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$w_{ii'}=\frac{\sum_{j\in\psi_{ii'}}(r_{ij}-\bar{r}_{i})(r_{i'j}-\bar{r}_{i'})}{\sqrt{\sum_{j\in\psi_{ii'}}(r_{ij}-\bar{r}_{i})^2}\sqrt{\sum_{j\in\psi_{ii'}}(r_{i'j}-\bar{r}_{i'})^2}}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\psi_{i}=set \ of \ movies \ that \ user \ i \ has \ rated$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\psi_{ii'}=set \ of \ movies \ both \ user \ i \ and \ i' \&amp;nbsp;&amp;nbsp;have \ rated$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$\psi_{ii'}=\psi_{i}\cap\psi_{i'}$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;What if 2 users have zero movies in common, or just a few?&lt;/li&gt;
&lt;li&gt;If zero, don&amp;rsquo;t consider i&amp;rsquo; in user i&amp;rsquo;s calculation - it can&amp;rsquo;t be calculated&lt;/li&gt;
&lt;li&gt;If few (e.g. &amp;lt; 5) then don&amp;rsquo;t use the weight, since not enough data to be accurate&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Cosine Similarity&lt;/h1&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Pearson correlation is &amp;ldquo;old-school statistics&amp;rdquo;&lt;/li&gt;
&lt;li&gt;These days, when you want to compare two vectors, it seems more fashionable to use the cosine similarity&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$cos\theta=\frac{x^Ty}{|x||y|}=\frac{\sum^N_{i=1}x_iy_i}{\sqrt{\sum^N_{i=1}x^2_i}\sqrt{\sum^N_{i=1}y^2_i}}$$&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Cosine Similarity vs. Pearson Correlation&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;They are the same except Pearson is centered&lt;/li&gt;
&lt;li&gt;We want to center them anyway because we&amp;rsquo;re working with deviations not absolute ratings&lt;/li&gt;
&lt;li&gt;If working with deviations rather than average, the cosine similarity is equivalent to the Pearson Correlation&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Problem&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;What if 2 users have 0 movies in common, or just a few?&lt;/li&gt;
&lt;li&gt;If 0, don't consider i' in user i's calculation - it can't be calculated&lt;/li&gt;
&lt;li&gt;If few (e.g. &amp;lt; 5) then don't use the weight, since not enough data to be accurate&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Neighborhood&lt;/h1&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;In practice, don&amp;rsquo;t sum over all users who rated movie j (takes too long)&lt;/li&gt;
&lt;li&gt;It can help to precompute weights beforehand&lt;/li&gt;
&lt;li&gt;Non-trivial: instead of summing over all users, take the ones with the highest weight (called &lt;b&gt;&lt;i&gt;neighbors&lt;/i&gt;&lt;/b&gt;)
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;E.g. use K nearest neighbors, K = 25 up to 50&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;Is it useful to keep a negative weight? Yes&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;A strong correlation is very negative, but no correlation is 0&lt;/li&gt;
&lt;li&gt;Thus, you might want to keep neighbors sorted on absolute correlation&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Big Data&lt;/h1&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Suppose we have 100k = 100,000 users&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$Then\&amp;nbsp;we\&amp;nbsp;need\&amp;nbsp;10^{10}&amp;nbsp;\&amp;nbsp;weights$$&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;10 billion&lt;/li&gt;
&lt;li&gt;32-bit float = 4 bytes&lt;/li&gt;
&lt;li&gt;~ 40 GB
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Most modern computers have 4~32 GB RAM, 128 GB on the high end&lt;/li&gt;
&lt;li&gt;We are reaching the limit of capacity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Not just size, but the time required to calculate&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$O(N^2)\&amp;nbsp;is&amp;nbsp;\&amp;nbsp;slow$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Possible Issues&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;N users, M items then R is NxM&lt;/li&gt;
&lt;li&gt;How long does it take to calculate the similarity between 2 users, w(i, i')? O(M)&lt;/li&gt;
&lt;li&gt;For a single rating prediction, we have to find the weights against all other users&lt;/li&gt;
&lt;li&gt;Even if we just keep the top K neighbors, we still need to calculate them all, since they must be sorted to find the top K&lt;/li&gt;
&lt;li&gt;O(N) users, O(M) calculations each time -&amp;gt; O(NM)&lt;/li&gt;
&lt;li&gt;If you're a company building a recommendation engine, you need to make recommendations for all N users&lt;/li&gt;
&lt;li&gt;We need w(i,i') for i...N and i'=1...N -&amp;gt; $O(N^{2})$&lt;/li&gt;
&lt;li&gt;Including the time to calculate each correlation -&amp;gt; $O(N^{2}M)$&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Computation Complexity Scenario&lt;/h1&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Work on a subset of data&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Take top n users and top m movies (n &amp;lt; N, m &amp;lt; M)&lt;/li&gt;
&lt;li&gt;Top user = user who has rated the most movies&lt;/li&gt;
&lt;li&gt;Top movie = movie that has been rated the most times&lt;/li&gt;
&lt;li&gt;Yield a more dense matrix&lt;/li&gt;
&lt;li&gt;Experiment to determine a workable value for n and m&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Recommendation for a single user&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Calculate weights between this use and all others: O(MN)&lt;/li&gt;
&lt;li&gt;Calculate scores s(i, j) for all items: also O(MN)
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;M items&lt;/li&gt;
&lt;li&gt;Sum over N terms for each item&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Sort the scores: O(MlogM)&lt;/li&gt;
&lt;li&gt;Total: O(MN) + O(MlogM)&lt;/li&gt;
&lt;li&gt;This is theoretical - practically, you can make things faster
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Precomputing user-user weights, &lt;i&gt;&lt;b&gt;but not real-time&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;For the score, only sum using users similar to me - if top K, then O(MK)&lt;/li&gt;
&lt;li&gt;Sorting - if keep only L items, then O(MlogL)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Precomputing&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Precompute recommendations using (possibly) big data technologies as offline jobs&lt;/li&gt;
&lt;li&gt;You don&amp;rsquo;t want to do an O(MlogM) sort in real-time - even O(M) would be bad&lt;/li&gt;
&lt;li&gt;Use a &amp;ldquo;cronjob&amp;rdquo; to run your task every day at some time, e.g. 3 am&lt;/li&gt;
&lt;li&gt;Your API can simply retrieve items already stored in a database&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Desired Output&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Since we are doing regression, we want MSE&lt;/li&gt;
&lt;li&gt;Outline
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Split data into train and test&lt;/li&gt;
&lt;li&gt;Calculate weights using a train set&lt;/li&gt;
&lt;li&gt;Make a predict function, e.g. score &amp;larr; predict(i, j)&lt;/li&gt;
&lt;li&gt;Output MSE for train and test sets&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>MLAI/RecommendSystem</category>
      <category>CF</category>
      <category>Collaborative filtering</category>
      <category>recommend system</category>
      <category>user to user</category>
      <category>user-user</category>
      <category>User-User Collaborative Filtering</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/888</guid>
      <comments>https://demyank.tistory.com/888#entry888comment</comments>
      <pubDate>Thu, 7 Jul 2022 17:41:30 +0900</pubDate>
    </item>
    <item>
      <title>Association Analysis</title>
      <link>https://demyank.tistory.com/885</link>
      <description>&lt;h1&gt;Definition&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;As a role-based model, it is an algorithm that finds out how an item relates to another item. This association exists in two forms.&lt;/p&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;How often are they purchased together? (Frequent)&lt;/li&gt;
&lt;li&gt;If someone bought item A, will he also buy item B?&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;It is also expressed as a shopping Market basket analysis because it is similar to looking at which products are contained in one shopping basket.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Ex) Famous anecdote is that when purchasing beer at Walmart, there is a high tendency to buy diapers together, so he also set up a strategy to display the two together.&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Minsup&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$s(X)=\frac{\sigma(X)}{N}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;An itemset &lt;i&gt;&lt;b&gt;X&lt;/b&gt;&lt;/i&gt; is called frequent if $s(X)$ is greater than some user-defined threshold, &lt;i&gt;minsup&lt;/i&gt;.&lt;/p&gt;
&lt;h1&gt;Association Rule&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Frequent Itemset Generation, whose objective is to find all the itemsets that satisfy the &lt;i&gt;minsup&lt;/i&gt; threshold.&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;An association rule is an implication expression of the form X&amp;rarr;Y, where X and Y are disjoint itemsets (X&amp;cap;Y=&amp;empty;).&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;The strength of an association rule can be measured in terms of its&amp;nbsp;&lt;b&gt;support&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;confidence&lt;/b&gt;. A rule that has very low support may occur simply by chance. Confidence measures the reliability of the inference made by a rule.&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Support&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;For the rule A &amp;rarr; B,&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$support(A)=P(A,&amp;nbsp;B)$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;OR&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$\sigma(X)&amp;nbsp;\&amp;nbsp;is&amp;nbsp;\&amp;nbsp;the&amp;nbsp;\&amp;nbsp;support&amp;nbsp;\&amp;nbsp;count&amp;nbsp;\&amp;nbsp;of&amp;nbsp;\&amp;nbsp;X&amp;nbsp;\\&amp;nbsp;N&amp;nbsp;\&amp;nbsp;is&amp;nbsp;\&amp;nbsp;the&amp;nbsp;\&amp;nbsp;count&amp;nbsp;\&amp;nbsp;of&amp;nbsp;\&amp;nbsp;the&amp;nbsp;\&amp;nbsp;transactions&amp;nbsp;\&amp;nbsp;set&amp;nbsp;\&amp;nbsp;T&amp;nbsp;\\&amp;nbsp;s(X&amp;nbsp;\rightarrow&amp;nbsp;\&amp;nbsp;Y)=\frac{\sigma(X\cup&amp;nbsp;Y)}{N}$$&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;Confidence&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$confidence(A&amp;nbsp;\rightarrow&amp;nbsp;B)=\frac{P(A,B)}{P(A)}$$&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Lift&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Measure how frequently events occur at the same time or independent&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$lift(A\rightarrow&amp;nbsp;B)=\frac{P(A,B)}{P(A)\times&amp;nbsp;P(B)&amp;nbsp;}$$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;$$lift(A, B)\left\{\begin{matrix}&lt;br /&gt;=&amp;nbsp;1,&amp;nbsp;if&amp;nbsp;\&amp;nbsp;A&amp;nbsp;\&amp;nbsp;and&amp;nbsp;\&amp;nbsp;B&amp;nbsp;\&amp;nbsp;are&amp;nbsp;\&amp;nbsp;independent&amp;nbsp;\\&lt;br /&gt;&amp;gt;&amp;nbsp;1,&amp;nbsp;if&amp;nbsp;\&amp;nbsp;A&amp;nbsp;\&amp;nbsp;and&amp;nbsp;\&amp;nbsp;B&amp;nbsp;\&amp;nbsp;are&amp;nbsp;\&amp;nbsp;positively&amp;nbsp;\&amp;nbsp;related&amp;nbsp;\\&lt;br /&gt;&amp;lt;&amp;nbsp;1,&amp;nbsp;if&amp;nbsp;\&amp;nbsp;A&amp;nbsp;\&amp;nbsp;and&amp;nbsp;\&amp;nbsp;B&amp;nbsp;\&amp;nbsp;are&amp;nbsp;\&amp;nbsp;negatively&amp;nbsp;\&amp;nbsp;related&amp;nbsp;\end{matrix}\right.$$&lt;/p&gt;
&lt;h1&gt;Rule Generation&lt;/h1&gt;
&lt;blockquote data-ke-style=&quot;style1&quot;&gt;&lt;span style=&quot;font-family: 'Noto Serif KR';&quot;&gt;Rule generation, whose objective is to extract all the high confidence rules from the frequent itemsets found in the Frequent Itemset Generation. These rules are called strong rules.&lt;/span&gt;&lt;/blockquote&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;Extract all rules from the itemsets&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;375&quot; data-origin-height=&quot;358&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sSGjf/btrGJ8iIYDv/EqJsrVtzdJyOL1O8GJnC9K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sSGjf/btrGJ8iIYDv/EqJsrVtzdJyOL1O8GJnC9K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sSGjf/btrGJ8iIYDv/EqJsrVtzdJyOL1O8GJnC9K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsSGjf%2FbtrGJ8iIYDv%2FEqJsrVtzdJyOL1O8GJnC9K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;375&quot; height=&quot;358&quot; data-origin-width=&quot;375&quot; data-origin-height=&quot;358&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Problem&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;388&quot; data-origin-height=&quot;275&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dP4von/btrGJ15crfd/i0OEOvskdKIravdqOUE4r0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dP4von/btrGJ15crfd/i0OEOvskdKIravdqOUE4r0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dP4von/btrGJ15crfd/i0OEOvskdKIravdqOUE4r0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdP4von%2FbtrGJ15crfd%2Fi0OEOvskdKIravdqOUE4r0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;388&quot; height=&quot;275&quot; data-origin-width=&quot;388&quot; data-origin-height=&quot;275&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;The number of rules increases exponentially as items increase&lt;/p&gt;
&lt;h1&gt;Example&lt;/h1&gt;
&lt;table style=&quot;border-collapse: collapse; width: 63.7209%; height: 102px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.7907%; height: 17px; text-align: center;&quot;&gt;TID&lt;/td&gt;
&lt;td style=&quot;width: 87.2093%; text-align: center; height: 17px;&quot;&gt;Items&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.7907%; height: 17px; text-align: center;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;width: 87.2093%; height: 17px;&quot;&gt;{Bread, Milk}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.7907%; height: 17px; text-align: center;&quot;&gt;2&lt;/td&gt;
&lt;td style=&quot;width: 87.2093%; height: 17px;&quot;&gt;{Bread, Diapers, Beer, Eggs}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.7907%; height: 17px; text-align: center;&quot;&gt;3&lt;/td&gt;
&lt;td style=&quot;width: 87.2093%; height: 17px;&quot;&gt;{Milk, Diapers, Beer, Cola}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.7907%; height: 17px; text-align: center;&quot;&gt;4&lt;/td&gt;
&lt;td style=&quot;width: 87.2093%; height: 17px;&quot;&gt;{Bread, Milk, Diapers, Beer}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.7907%; height: 17px; text-align: center;&quot;&gt;5&lt;/td&gt;
&lt;td style=&quot;width: 87.2093%; height: 17px;&quot;&gt;{Bread, Milk, Diapers, Cola}&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;{Beer, Diaspers, Milk} Support = $\frac{\sigma(X \cup Y)}{N}$ = $\frac{2}{5}$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;{Milk, Diapers} -&amp;gt; {Beer} Confidence = $\frac{\sigma(X \cup Y)}{\sigma (X)}$ = $\frac{2}{3}$&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Reference&lt;/h1&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://chih-ling-hsu.github.io/2017/03/25/Data-Mining-Association-Analysis&quot;&gt;https://chih-ling-hsu.github.io/2017/03/25/Data-Mining-Association-Analysis&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://livebook.manning.com/book/machine-learning-in-action/chapter-11/33&quot;&gt;https://livebook.manning.com/book/machine-learning-in-action/chapter-11/33&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=43gb7WK56Sk&quot;&gt;https://www.youtube.com/watch?v=43gb7WK56Sk&lt;/a&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://www-users.cse.umn.edu/~kumar001/dmbook/ch5_association_analysis.pdf&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www-users.cse.umn.edu/~kumar001/dmbook/ch5_association_analysis.pdf&lt;/a&gt;&lt;/p&gt;</description>
      <category>MLAI/RecommendSystem</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/885</guid>
      <comments>https://demyank.tistory.com/885#entry885comment</comments>
      <pubDate>Thu, 7 Jul 2022 17:31:12 +0900</pubDate>
    </item>
    <item>
      <title>AWS MSK</title>
      <link>https://demyank.tistory.com/883</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;Overview&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1129&quot; data-origin-height=&quot;581&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/enCLjn/btrGgKig1G9/N1CSLJJIuyJpXNErVi6ck1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/enCLjn/btrGgKig1G9/N1CSLJJIuyJpXNErVi6ck1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/enCLjn/btrGgKig1G9/N1CSLJJIuyJpXNErVi6ck1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FenCLjn%2FbtrGgKig1G9%2FN1CSLJJIuyJpXNErVi6ck1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1129&quot; height=&quot;581&quot; data-origin-width=&quot;1129&quot; data-origin-height=&quot;581&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Alternative to Kinesis (Kafka vs Kinesis next lecture)&lt;/li&gt;
&lt;li&gt;Fully managed Apache Kafka on AWS
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Allow you to create, update, delete clusters&lt;/li&gt;
&lt;li&gt;MSK create &amp;amp; manages Kafka brokers nodes &amp;amp; Zookeeper nodes for you&lt;/li&gt;
&lt;li&gt;Deploy the MSK cluster in your VPC, multi-AZ (up to 3 for HA)&lt;/li&gt;
&lt;li&gt;Automatic recovery from common Apache Kafka failures&lt;/li&gt;
&lt;li&gt;Data is stored on EBS volumes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You can build producers and consumers for your clusters
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Default message size of 1 MB&lt;/li&gt;
&lt;li&gt;Possibilities of sending large message (ex: 10 MB) into Kafka after custom configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Configuration&lt;/h1&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;601&quot; data-origin-height=&quot;631&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bLt9I4/btrGfzaYbqq/FKO6lAob8dZ3GtZhnIBNvK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bLt9I4/btrGfzaYbqq/FKO6lAob8dZ3GtZhnIBNvK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bLt9I4/btrGfzaYbqq/FKO6lAob8dZ3GtZhnIBNvK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbLt9I4%2FbtrGfzaYbqq%2FFKO6lAob8dZ3GtZhnIBNvK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;601&quot; height=&quot;631&quot; data-origin-width=&quot;601&quot; data-origin-height=&quot;631&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Choose the number of AZ (3 - recommended, or 2)&lt;/li&gt;
&lt;li&gt;Choose the VPC &amp;amp; Subnets&lt;/li&gt;
&lt;li&gt;The broker instance type (ex: kafka.m5.large)&lt;/li&gt;
&lt;li&gt;The number of brokers per AZ (can add brokers later)&lt;/li&gt;
&lt;li&gt;Size of your EBS volumes (1 GB - 16 TB)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Security&lt;/h1&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;342&quot; data-origin-height=&quot;539&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/QV2GC/btrGfAgEHzl/nFOz06zCGVcplC2ssWUD00/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/QV2GC/btrGfAgEHzl/nFOz06zCGVcplC2ssWUD00/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/QV2GC/btrGfAgEHzl/nFOz06zCGVcplC2ssWUD00/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FQV2GC%2FbtrGfAgEHzl%2FnFOz06zCGVcplC2ssWUD00%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;342&quot; height=&quot;539&quot; data-origin-width=&quot;342&quot; data-origin-height=&quot;539&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Encryption&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Optional in-flight using TLS between the brokers&lt;/li&gt;
&lt;li&gt;Optional in-flight with TLS between the clients and brokers&lt;/li&gt;
&lt;li&gt;At rest for your EBS volumes using KMS&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Network Security&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Authorize specific security groups for your Apache Kafka clients&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Authentication &amp;amp; Authorization (important)&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Define who can read/write to which topics&lt;/li&gt;
&lt;li&gt;MutualTLS (AuthN) + Kafka ACLs (AuthZ)&lt;/li&gt;
&lt;li&gt;SASL/SCRAM (AuthN) + Kafka ACLs (AuthZ)&lt;/li&gt;
&lt;li&gt;IAM Access Control (AuthN + AuthZ)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Monitoring&lt;/h1&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;CloudWatch Metrics&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Basic monitoring (cluster and broker metrics)&lt;/li&gt;
&lt;li&gt;Enhanced monitoring (++enhanced broker metrics)&lt;/li&gt;
&lt;li&gt;Topic-level monitoring (++enhanced topic-level metrics)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Prometheus (Open-Source Monitoring)&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Opens a port on the broker to export cluster, broker and topic-level metrics&lt;/li&gt;
&lt;li&gt;Setup the JMX Exporter (metrics) or Node Exporter (CPU and disk metrics)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Broker Log Delivery&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Delivery to CloudWatch Logs&lt;/li&gt;
&lt;li&gt;Delivery to Amazon S3&lt;/li&gt;
&lt;li&gt;Delivery to Kinesis Data Streams&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;MSK Connect&lt;/h1&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;469&quot; data-origin-height=&quot;100&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/rfptW/btrGf2DKCvg/pKjFqkK1XottHBAAPNMHIK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/rfptW/btrGf2DKCvg/pKjFqkK1XottHBAAPNMHIK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/rfptW/btrGf2DKCvg/pKjFqkK1XottHBAAPNMHIK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FrfptW%2FbtrGf2DKCvg%2FpKjFqkK1XottHBAAPNMHIK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;469&quot; height=&quot;100&quot; data-origin-width=&quot;469&quot; data-origin-height=&quot;100&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Managed Kafka Connect workers on AWS&lt;/li&gt;
&lt;li&gt;Auto-scaling capabilities for workers&lt;/li&gt;
&lt;li&gt;You can deploy any Kafka Connect connectors to MSK Connect as a plugin
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;S3, RedShift, OpenSearch, Debezium, and etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Example pricing: Pay $ 0.11 per worker per hour&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;MSK Serverless&lt;/h1&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Run Apache Kafka on MSK without managing the capacity&lt;/li&gt;
&lt;li&gt;MSK automatically provisions resources and scales compute &amp;amp; storage&lt;/li&gt;
&lt;li&gt;You just define your topics and your partitions and you&amp;rsquo;re good to go&lt;/li&gt;
&lt;li&gt;Security: IAM Access Control for all clusters&lt;/li&gt;
&lt;li&gt;Example Pricing:
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;$0.75 per cluster per hour = $558 monthly per cluster&lt;/li&gt;
&lt;li&gt;$0.0015 per partition per hour = $1.08 monthly per partition&lt;/li&gt;
&lt;li&gt;$0.10 per GB of storage each month&lt;/li&gt;
&lt;li&gt;$0.10 per GB in&lt;/li&gt;
&lt;li&gt;$0.10 per GB out&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Kinesis Data Streams vs Amazon MSK&lt;/h1&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 170px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px; width: 21.7442%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 30.9302%;&quot;&gt;Kinesis Data Streams&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 47.2093%;&quot;&gt;Amazon MSK&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px; width: 21.7442%;&quot;&gt;Message Size Limit&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 30.9302%;&quot;&gt;1 MB message size limit&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 47.2093%;&quot;&gt;1 MB default, configure for higher (ex: 10MB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px; width: 21.7442%;&quot;&gt;Distribution&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 30.9302%;&quot;&gt;Data Streams with Shards&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 47.2093%;&quot;&gt;Kafka Topics with Partitions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px; width: 21.7442%;&quot;&gt;Sizing&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 30.9302%;&quot;&gt;Shard Splitting &amp;amp; Merging&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 47.2093%;&quot;&gt;Can only add partitions to a topic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px; width: 21.7442%;&quot;&gt;In-flight Security&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 30.9302%;&quot;&gt;TLS In-flight encryption&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 47.2093%;&quot;&gt;PLAINTEXT or TLS In-flight Encryption&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px; width: 21.7442%;&quot;&gt;Rest Security&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 30.9302%;&quot;&gt;KMS At-rest encryption&lt;/td&gt;
&lt;td style=&quot;height: 17px; width: 47.2093%;&quot;&gt;KMS At-rest encryption&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 35px;&quot;&gt;
&lt;td style=&quot;height: 35px; width: 21.7442%;&quot;&gt;Auth&lt;/td&gt;
&lt;td style=&quot;height: 35px; width: 30.9302%;&quot;&gt;IAM policies for AuthN/AuthZ&lt;/td&gt;
&lt;td style=&quot;height: 35px; width: 47.2093%;&quot;&gt;Mutual TLS (AuthN) + Kafka ACLs (AuthZ)&lt;br /&gt;SASL/SCRAM (AuthN) + Kafka ACLs (AuthZ)&lt;br /&gt;IAM Access Control (AuthN + AuthZ)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;</description>
      <category>Data Engineering</category>
      <category>Kafka</category>
      <category>MSK</category>
      <category>STREAM</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/883</guid>
      <comments>https://demyank.tistory.com/883#entry883comment</comments>
      <pubDate>Fri, 1 Jul 2022 20:05:05 +0900</pubDate>
    </item>
    <item>
      <title>Collection Introduction</title>
      <link>https://demyank.tistory.com/882</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;Real Time - Immediate actions&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Kinesis Data Streams (KDS)&lt;/li&gt;
&lt;li&gt;Simple Queue Service (SQS)&lt;/li&gt;
&lt;li&gt;Internet of Things (IoT)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Near-real time - Reactive actions&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Kinesis Data Firehose (KDF)&lt;/li&gt;
&lt;li&gt;Database Migration Service (DMS)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;Batch - Historical Analysis&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Snowball&lt;/li&gt;
&lt;li&gt;Data Pipeline&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>Data Engineering</category>
      <category>batch</category>
      <category>Data Collection</category>
      <category>kinesis</category>
      <category>Near-real time</category>
      <category>real-time</category>
      <category>snowball</category>
      <category>sqs</category>
      <author>데먕</author>
      <guid isPermaLink="true">https://demyank.tistory.com/882</guid>
      <comments>https://demyank.tistory.com/882#entry882comment</comments>
      <pubDate>Wed, 29 Jun 2022 19:37:47 +0900</pubDate>
    </item>
  </channel>
</rss>