<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Warisa P. on Medium]]></title>
        <description><![CDATA[Stories by Warisa P. on Medium]]></description>
        <link>https://medium.com/@psicecream?source=rss-171a34a5eb20------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Y6MuFFIdrtkomulc8mDzxQ.jpeg</url>
            <title>Stories by Warisa P. on Medium</title>
            <link>https://medium.com/@psicecream?source=rss-171a34a5eb20------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 17:08:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@psicecream/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[[Book Review] แมวยิ้มง่ายใช่ว่าแตกสลายไม่เป็น : ใบพัด นบน้อม]]></title>
            <link>https://medium.com/@psicecream/book-review-%E0%B9%81%E0%B8%A1%E0%B8%A7%E0%B8%A2%E0%B8%B4%E0%B9%89%E0%B8%A1%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%83%E0%B8%8A%E0%B9%88%E0%B8%A7%E0%B9%88%E0%B8%B2%E0%B9%81%E0%B8%95%E0%B8%81%E0%B8%AA%E0%B8%A5%E0%B8%B2%E0%B8%A2%E0%B9%84%E0%B8%A1%E0%B9%88%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99-%E0%B9%83%E0%B8%9A%E0%B8%9E%E0%B8%B1%E0%B8%94-%E0%B8%99%E0%B8%9A%E0%B8%99%E0%B9%89%E0%B8%AD%E0%B8%A1-861fffc49860?source=rss-171a34a5eb20------2</link>
            <guid isPermaLink="false">https://medium.com/p/861fffc49860</guid>
            <category><![CDATA[cats]]></category>
            <category><![CDATA[book-review]]></category>
            <category><![CDATA[book-recommendations]]></category>
            <category><![CDATA[energy-healing]]></category>
            <dc:creator><![CDATA[Warisa P.]]></dc:creator>
            <pubDate>Sat, 08 Oct 2022 02:21:15 GMT</pubDate>
            <atom:updated>2022-10-08T02:21:15.098Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Book Review] แมวยิ้มง่ายใช่ว่าแตกสลายไม่เป็น : ใบพัด นบน้อม</h3><p>หนังสือเล่มนี้ เพียงแค่เห็นหน้าปก และคำโปรยด้านหลัง <br><em>“ขอให้คุณได้เจอคนที่แอปพริชิเอทในตัวคุณ” </em>เพียงเท่านี้ก็ทำให้หยิบขึ้นมาลองอ่านดูได้อย่างไม่ยาก เป็นหนังสือเล่มไม่หนามาก อ่านไปเรื่อย ๆ เพลิน ๆ เผลอแปปเดียวก็จบ แต่บอกได้เลยว่าเนื้อหาทำฮีลใจมั่ก ๆ เลย ถึงจะไม่ใช่ทาสแมว ก็อ่านได้ <br>✿ ╮ (╯▽╰) ╭</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CURZ1P1N3ex_-z47AOEbpA.jpeg" /></figure><p>หากเราจะทำตัวเป็นเหมือนแมวบ้างในบางครั้ง ก็คงไม่เป็นไร</p><blockquote>แมวไม่สนว่าเราเก่ง ไม่เก่ง ในโลกที่ใจร้าย แมวเป็นผู้ฟังที่ดี <br>ปลอบโดยไม่ปลอบ และไม่ตัดสิน</blockquote><p>ทุกวันนี้เราอยู่ในที่ที่ดูดพลังงานออกไปจนหมด อายุยี่สิบกว่า ๆ แต่ burn out หมดไฟ ใช้ชีวิตอย่างรีบ ๆ จนพลังชีวิตใกล้จะหมด เหมือนขโมยเวลาอนาคตมาใช้ <br>- โอ้โห ตรงเลยแฮะ !</p><blockquote>แมวไม่มีวันจันทร์ ไม่ได้เฝ้ารอวันศุกร์ ทุกวันคือวันแมว</blockquote><blockquote>แมวไม่นึกถึงอดีต ไม่กังวลกับอนาคตที่ยังมาไม่ถึง</blockquote><blockquote>ง่วงก็นอนตอนนี้ ก็นอนเดี๋ยวนี้</blockquote><p>การอยู่เฉย ๆ == ขี้เกียจ</p><ul><li>ความขี้เกียจที่หลายคนต้องใช้ความกล้า เพราะยังรู้สึกผิดถ้าต้องอยู่เฉย ๆ<br>แต่แมวไม่ “อยู่เฉย ๆ ก็คืออยู่เฉย ๆ”</li><li>“แค่กินกับนอนก็วุ่นจะแย่อยู่แล้วต้องให้แมวทำอะไรอีก” <br>- อ่านประโยคนี้แล้วก็ขำในใจ</li><li>คนเราไม่ต้องเข็มแข็งตลอด อย่าใจร้ายกับตัวเองนัก<br>เพราะการแสดงความอ่อนแอคือการแสดงความเข็มแข็งอย่างหนึ่ง</li></ul><p>หากถามว่าทำบุญกับแมวจะได้อะไร ก็ขอตอบว่า</p><p>“<strong>แมวจะส่งให้เธอสุขใจ ๆ”</strong></p><p>ขณะที่คนเลี้ยงแมว แมวก็เลี้ยงคนไปด้วย</p><p>เราต่างเคยเป็นเด็กน้อย ที่ชอบคิดว่าคนอื่นจะคิดกับเรายังไง พอโตมาจะรู้ว่า ไม่มีใครสนใจเราขนาดนั้น ทุกคนต่างมีปัญหาและวิถีชีวิตของตัวเองทั้งนั้น</p><blockquote>หากวันไหนที่รู้สึกว่าชีวิตฉิบหายแล้ว ก็ยังมีพรุ่งนี้ให้ฉิบหายได้อีก<br>อย่าเสียเวลากับความทุกข์เก่า ๆ นาน</blockquote><p>แปลกมาก คืออ่านประโยคนี้ แต่ทำให้มีกำลังใจขึ้นมาทันที 55555 ชอบมาก</p><blockquote>อย่าใช้ชีวิตเหมือนมือถือแบตเสื่อม</blockquote><blockquote>ต้องชาร์จแล้วชาร์จอีก</blockquote><p>สุดท้าย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwAebpUpIwsVzZeX68WK0w.jpeg" /></figure><p>พออ่านจบแล้ว ก็ไปหาแมวเล่นด้วยดีกว่า หนังสือเล่มนี้เหมาะกับวัยเราม๊ากก เบา ๆ เพลิน ๆ แต่อ่านแล้วแฮปปี้ เพิ่มพลังใจขึ้นมาเลย</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=861fffc49860" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[มาสร้าง Line Notify เชื่อมกับ Google Form ให้ช่วย Countdown ผู้ตอบแบบสอบถามออนไลน์กัน]]></title>
            <link>https://medium.com/@psicecream/%E0%B8%A1%E0%B8%B2%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87-line-notify-%E0%B8%8A%E0%B9%88%E0%B8%A7%E0%B8%A2-countdown-%E0%B8%9C%E0%B8%B9%E0%B9%89%E0%B8%95%E0%B8%AD%E0%B8%9A%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%AA%E0%B8%AD%E0%B8%9A%E0%B8%96%E0%B8%B2%E0%B8%A1-is-%E0%B8%81%E0%B8%B1%E0%B8%99-db4f05779a67?source=rss-171a34a5eb20------2</link>
            <guid isPermaLink="false">https://medium.com/p/db4f05779a67</guid>
            <category><![CDATA[questionnaire]]></category>
            <category><![CDATA[google-forms]]></category>
            <category><![CDATA[alert-message]]></category>
            <category><![CDATA[line-notify]]></category>
            <category><![CDATA[งานวิจัย]]></category>
            <dc:creator><![CDATA[Warisa P.]]></dc:creator>
            <pubDate>Sat, 14 Aug 2021 19:40:20 GMT</pubDate>
            <atom:updated>2021-08-15T04:13:44.512Z</atom:updated>
            <content:encoded><![CDATA[<p>หากคุณเป็นนักศึกษา ป.โท ที่กำลังทำวิจัยหรือผู้ที่กำลังว้าวุ่นใจกับการนับจำนวนผู้ตอบแบบสอบถามออนไลน์แล้วละก็…</p><p>เราขอเสนอการเชื่อมต่อ Google Form เข้ากับ Line Notify แล้วให้ alert message มาที่ Line เราโดยตรง เพื่อนับจำนวนผู้ตอบแบบสอบถาม หรือจะใช้ plan ในการหาผู้ตอบแบบสอบถามต่อไปก็ได้</p><p>หากยังไม่เห็นภาพ จะลองแสดงให้ดู ณ บัดนี้…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*yiGxJuCNjmrnxVS3HJyuvQ.jpeg" /><figcaption>เริ่มนับถอยหลัง…</figcaption></figure><ol><li>เริ่มจากไปที่ <a href="https://notify-bot.line.me/en/">https://notify-bot.line.me/en/</a> Login Line ให้เรียบร้อย แล้วกดที่ <strong>My page</strong> ตรงมุมบนขวา</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dC_FMvRsXkSu04obka5mFA.png" /><figcaption>User Profile menu</figcaption></figure><p>เลื่อนลงไปด้านล่าง เพื่อไปทำการสร้าง Generate Token มา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1H4hauged0Ox-iNdYhuPEw.png" /><figcaption>For Generate Token</figcaption></figure><p>พิมพ์ชื่อที่จะแสดงในการส่ง Notification และเลือกว่าจะให้ส่งไปที่กลุ่มไหน หรือส่งแบบ 1-on-1</p><p>เราเลือก 1-on-1 chat แล้วกด Generate token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjtEd-P8Sgh4Ao6EihM4bA.png" /><figcaption>ใส่ชื่อที่จะแสดง แล้วเลือกกลุ่มที่จะให้ส่ง noti</figcaption></figure><h3>Copy Token ไว้ อย่าให้หาย !</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mSdclWxqXAOjM9Yk8luwKg.png" /><figcaption>&lt;linetoken&gt;</figcaption></figure><p>2. ทำการสร้าง Google Form ที่จะทำการตอบแบบสอบถามขึ้นมา แล้วไปที่<br>เมนู Option จุดจุดจุด แล้วเลือกโปรแกรมแก้ไขสคริปต์</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDTrwED3H7GDTCMYUsmREw.png" /><figcaption>นี่คือ form ที่สมมติขึ้นมา</figcaption></figure><p>จะได้หน้าตาแบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opWH-xA__rylzwQEg3t7xQ.png" /><figcaption>myFunction()</figcaption></figure><p>3. เริ่มเขียน function ใน Google Form</p><p>สิ่งที่เราต้องการคือ เมื่อมีคน submit แบบสอบถามใน Google Form จะแจ้งเตือนไปในไลน์ และมีการนับ countdown ว่าเหลืออีกกี่คน</p><p>ตัวอย่างเช่น เราต้องการผู้ตอบแบบสอบถามจำนวน 450 คน<br>จะให้แสดงว่า</p><pre>Line Noti : ตอบเป็นคนที่ X</pre><pre>เหลืออีก X คน</pre><p>function ของเราจะประมาณนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ER1KAjGMWEjdG_wUwwenaQ.png" /><figcaption>After create myFunction</figcaption></figure><pre>function myFunction() {</pre><pre>//For GoogleForm</pre><pre>var form = FormApp.openById(&#39;&lt;<strong>googleForm key</strong>&gt;&#39;);</pre><pre>//For SpreadSheet</pre><pre>var ss = SpreadsheetApp.openById(&#39;&lt;<strong>spreadSheet key&gt;</strong>&#39;);<br></pre><pre>var sheet = ss.getSheetByName(&#39;การตอบแบบฟอร์ม 1&#39;);</pre><pre>var numRows = sheet.getDataRange().getLastRow();</pre><pre>var count = (numRows-1);</pre><pre>var remain = 450-count; </pre><pre>var msg = {</pre><pre>&quot;message&quot;: &#39;\n&#39;+&#39;มีผู้ตอบกลับใหม่ คนที่ &#39;+count+&#39;\n&#39;+&#39;เหลืออีก &#39;+remain</pre><pre>};</pre><pre>sendLineNotify(msg);</pre><pre>}<br></pre><pre>function sendLineNotify(message) {</pre><pre>var token = [&quot;&lt;<strong>lineToken</strong>&gt;&quot;];</pre><pre>var options = {</pre><pre>&quot;method&quot;: &quot;post&quot;,</pre><pre>&quot;payload&quot;: message,</pre><pre>&quot;headers&quot;: {</pre><pre>&quot;Authorization&quot;: &quot;Bearer &quot; + token }</pre><pre>}</pre><pre>UrlFetchApp.fetch(&quot;https://notify-api.line.me/api/notify&quot;, options);</pre><pre>}</pre><p>ในการเชื่อมต่อ Line Notify กับ Google Form และ Spread Sheet ก็คือ <br>Google Form ID และ Spread Sheet ID</p><p>เราต้องเพิ่ม key 3 อย่างนี้ใน script ด้วย</p><ul><li>Google Form ID = &lt;<strong>googleForm key</strong>&gt;</li><li>Spread Sheet ID =&lt;<strong>spreadSheet key&gt;</strong></li><li>Line Token = &lt;<strong>lineToken</strong>&gt; ที่เราเคย copy ไว้ตั้งแต่ตอน Generate Token</li></ul><p>ให้ไป copy <strong>googleForm key </strong>มาจาก url ของ Google Form แล้วไปใส่ใน script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGk8XhbvYVDZsJw0sPvdaw.png" /><figcaption>Copy Google Form key</figcaption></figure><p>จากนั้นไปเปิด Spread Sheet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GPSG97nL98Ik4DfEE5U3w.png" /><figcaption>Create Spread Sheet from Google Form</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KyB87CYM8FKB_jMcoXf3iw.png" /><figcaption>Create Spread Sheet</figcaption></figure><p>จากนั้นไป copy <strong>spreadSheet</strong> <strong>key </strong>มาจาก url ของ <strong>Spread Sheet <br></strong>แล้วไปใส่ใน script ด้วยเหมือนกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05_d9t2hPRdDtfc-hNbAOg.png" /><figcaption>Copy Spread Sheet key</figcaption></figure><p>4. เมื่อใส่ key ทั้ง 3 ที่ ใน script เรียบร้อยแล้ว ให้กด Save (บันทึกโครงการ)<br>เลือก function -&gt; myFunction()แล้วลอง Run Script (เรียกใช้)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-FFMhkRPYEGqLyJpiaMlg.png" /><figcaption>ต้องตรวจสอบสิทธิ์ก่อน</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1H9PM3u2lwlNGcnN-0vIfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y0r9upOUhVcpEMCGTA9YFw.png" /><figcaption>กดตรง ขั้นสูง แล้วเลือก &gt;&gt; ไปที่ โครงการไม่มีชื่อ</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9wtQPyt1aYHDpXDT05iSA.png" /><figcaption>อนุญาตใดใดก่อน</figcaption></figure><p>5. แล้วมากำหนดการส่ง Line Noti โดยเลือกเมนูด้านซ้ายรูปนาฬิกา (ทริกเกอร์)</p><p>กดเพิ่มทริกเกอร์</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w8Bt3lxOYtbZZ1yO6DpAxw.png" /><figcaption>Set up Trigger</figcaption></figure><p>เราอยากให้ส่ง Noti มาตอนที่มีคน submit Google Form ก็จะ Set up ตามนี้เลย</p><p>เลือกประเภทเหตุการณ์ เป็น <strong>เมื่อส่งฟอร์ม</strong> จากนั้นกดบันทึก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3yzkt4TRf4IcxWxrJ8roEQ.png" /><figcaption>Submit Form</figcaption></figure><p>ก็จะมีทริกเกอร์เพิ่มขึ้นมาแล้ว เป็นอันเสร็จสิ้นนนนนนน ✨ 🥳 🙌 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mz6tRX04gHycZgArnJ_eaA.png" /><figcaption>Trigger</figcaption></figure><p>เสร็จแล้วก็ลอง submit Form ได้เล้ยยยยย GO GO !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFcdDc3r__3tB0mLrzhIBA.gif" /><figcaption>เรียบร้อย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8QkTh5tRNOK418IClzY7A.png" /><figcaption>Hello Test Test</figcaption></figure><p><strong>นอกจากนี้ </strong>ยังสามารถเขียน function เพิ่มเติมให้ดึงข้อมูลจาก response ล่าสุดมาแสดงด้วยก็ได้ หรือจะให้ส่งข้อความตาม schedule ทุกวันหรือตามเวลาที่กำหนด หรือจะส่ง Line Sticker เพิ่มเติมก็สามารถทำได้เช่นกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yve9EkckOj0L6GNn6H1_jA.png" /><figcaption>send Line Sticker</figcaption></figure><p>สามารถไปดู doc ในการเขียน script เพิ่มเติม ได้ที่นี่ :</p><ul><li><a href="https://notify-bot.line.me/doc/en/">LINE Notify</a></li><li><a href="https://developers.line.biz/en/docs/messaging-api/">https://developers.line.biz/</a></li><li><a href="https://developers.google.com/apps-script/reference/spreadsheet/sheet">Class Sheet | Apps Script | Google for Developers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db4f05779a67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[มือใหม่หัดทำ Data Mining ด้วย Apriori algorithm บน Python]]></title>
            <link>https://medium.com/@psicecream/%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B9%83%E0%B8%AB%E0%B8%A1%E0%B9%88%E0%B8%AB%E0%B8%B1%E0%B8%94%E0%B8%97%E0%B8%B3-data-mining-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-apriori-algorithm-%E0%B8%9A%E0%B8%99-python-3b650f48e675?source=rss-171a34a5eb20------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b650f48e675</guid>
            <category><![CDATA[apriori]]></category>
            <category><![CDATA[association-rule]]></category>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Warisa P.]]></dc:creator>
            <pubDate>Sun, 05 Jul 2020 17:23:28 GMT</pubDate>
            <atom:updated>2020-07-05T19:05:05.727Z</atom:updated>
            <content:encoded><![CDATA[<p>มาลอง Market Basket Analysis (วิเคราะห์ตะกร้าตลาด) โดยใช้ Python ในการ implement อัลกอริทึม Apriori กันนน <strong>✧ (´･ᴗ･ ` ) °</strong></p><blockquote>หนึ่งในเทคนิคของการทำ Data Mining คือ Association Rules เป็นการหาความสัมพันธ์ของข้อมูล และอัลกอริทึมของ Association Rules ที่นำมาใช้ในวันนี้คือ Apriori algorithm</blockquote><p>Apriori algorithm เป็นรูปแบบของ Itemset ที่มักเกิดร่วมกัน (Frequent itemsets) อาจจะเขียนอยู่ในรูป</p><pre>IF A -&gt; THEN B </pre><p>คือ ถ้าซื้อสินค้า A มักจะซื้อสินค้า B ด้วย เป็นการนำ Frequent itemsets มาสร้างเป็นกฎความสัมพันธ์ของข้อมูล (Association Rules) หรืออาจจะเรียกว่า Market Basket Analysis ใช้ในการจับคู่สินค้าเพื่อเสนอขายสินค้า จัด Promotion ทำ Cross sell ,Up sell เป็นต้น โดย Association Rules จะกำหนดเงื่อนไขว่า Frequent itemsets นั้นต้องมีค่าสนับสนุนที่ยอมรับได้ (Minimum Support) มากกว่าที่กำหนด</p><p>Association Rules ในบทความนี้จะพิจารณาจาก 3 ค่าด้วยกันดังนี้</p><ul><li>Support -&gt; ค่าสนับสนุนของ Frequent itemsets หากค่า minimum support ต่ำกว่าที่กำหนดก็จะตัด Itemset นั้นทิ้ง</li></ul><pre><strong>Support(A,B)</strong> = Frequent(A,B)/Transaction ทั้งหมด </pre><ul><li>Confidence -&gt; ค่าความเชื่อมั่นของความสัมพันธ์ของ Itemset หากเกิด A มักจะเกิด B กี่ % หากค่า Confidence = 100% แสดงว่า ลูกค้าที่ซื้อสินค้า A ก็จะซื้อสินค้า B ด้วยทุกครั้ง</li></ul><pre><strong>Confidence(A,B)</strong> = Support(A,B)/Support(A)</pre><ul><li>Lift -&gt; ค่า Lift บอกถึง Strength ของกฎ แสดงถึงความขึ้นต่อกันของ Itemset</li></ul><pre><strong>Lift(A,B)</strong> = Support(A,B)/Support(A) x Support(B)</pre><p>หากค่า Lift &gt; 1 แสดงว่า A ขึ้นต่อ B <br>หากค่า Lift &lt; 1 แสดงว่า A ไม่ขึ้นต่อ B ( A และ B เป็นอิสระต่อกัน)</p><h3><strong>More the Lift more is the strength</strong></h3><p>ต่อไปมาเริ่ม Implement กันเลยจ้าาา</p><ol><li>เราใช้ Spyder IDE <a href="https://www.spyder-ide.org/">https://www.spyder-ide.org/</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-UtLlGygppJahY-HQDe7Q.png" /></figure><p>Dataset -&gt; ใช้ Open data จาก <a href="https://www.kaggle.com/roshansharma/market-basket-optimization">www.kaggle.com</a></p><p><a href="https://www.kaggle.com/roshansharma/market-basket-optimization">Market Basket Optimization</a></p><p>ข้อมูลชุดนี้<strong> Market Basket Optimization </strong>เป็น .csv</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFsCZqnx4ezgmcbCdtVYBA.png" /><figcaption><strong>Market Basket Optimization Dataset</strong></figcaption></figure><p>2.หลังจาก install python และ lib ใดๆ เสร็จแล้ว ก็ import มาใช้</p><pre>import numpy as np<br>import pandas as pd<br>import seaborn as sns</pre><p>3. ใช้ pandas ในการอ่านข้อมูล ซึ่งเป็น .csv อยู่แล้ว</p><pre>basketData = pd.read_csv(&#39;Market_Basket_Optimisation.csv&#39;, header = None)</pre><p>4. นับจำนวน Item</p><pre>df = pd.DataFrame(columns = [&#39;Item&#39;, &#39;Count&#39;])<br>for i in range(0,basketData.shape[0]):<br>    for j in range(0, basketData.shape[1]):<br>    if basketData.loc[i,j] in df.Item.values:<br>        df.iloc[df.loc[df[&#39;Item&#39;]==basketData.loc[i,j]].index[0],1]     = df.iloc[df.loc[df[&#39;Item&#39;]==basketData.loc[i,j]].index[0],1] + 1<br>    elif basketData.loc[i,j] is np.nan:<br>          continue<br>    else:<br>         df.loc[df.shape[0]] = [basketData.loc[i,j],1]<br>         df_desc = df.sort_values(by = &#39;Count&#39;,ascending = False)<br>         df_desc.head()</pre><p>5. แสดงผลเป็นกราฟแท่งให้เห็นจำนวนแต่ละ Item ด้วย lib seaborn</p><pre>ax = sns.barplot(x=&#39;Item&#39;, y=&#39;Count&#39;, data=df_desc[df_desc.Count &gt;= 30])<br>ax.set_xticklabels(ax.get_xticklabels(),rotation=90)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igTvsmeN41RBcxMlb_ESow.png" /><figcaption>แสดงจำนวน Item</figcaption></figure><p>6.ลบข้อมูลที่เป็น nan ออก</p><pre>dataset = []<br>for i in range(0, basketData.shape[0]):<br>   temp = []<br>   for j in range(0, basketData.shape[1]):<br>   if not basketData.loc[i,j] is np.nan:<br>   temp.append(basketData.loc[i,j])<br>   dataset.append(temp)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X-B4yG3zXct-34nJ5PPxag.png" /><figcaption>ข้อมูลใน dataset</figcaption></figure><p>7. ใช้ lib mlxtend ในการทำ Apriori และ Association rule</p><p>กำหนด<br>- <strong>minimum support</strong> = 0.05 <br> หาก Transaction ทั้งหมด 7501 transactions เกิดขึ้นใน 1 สัปดาห์ ในการซื้อ itemset นั้น วันละ 50 transactions x 7 วัน = 350 transactions ต่อ 1 สัปดาห์<br>ดังนั้น minimum support = 350/7501 = 0.0466 -&gt; ~ 0.05</p><p>- <strong>minimum confidence</strong> = 0.3 หรือ 30% <br>- <strong>lift</strong> &gt; 1</p><pre>from mlxtend.preprocessing import TransactionEncoder<br>te = TransactionEncoder()<br>te_ary = te.fit(dataset).transform(dataset)<br>df = pd.DataFrame(te_ary, columns=te.columns_)</pre><pre>#apriori<br>from mlxtend.frequent_patterns import apriori<br>frequent_itemsets = apriori(df, min_support=0.05, use_colnames=True)</pre><pre>#association_rules<br>from mlxtend.frequent_patterns import association_rules<br>rules = association_rules(frequent_itemsets,metric=&#39;lift&#39;, min_threshold=1)</pre><pre>rules2 = rules[ (rules[&#39;confidence&#39;] &gt; 0.3) &amp; (rules[&#39;lift&#39;] &gt; 1) ]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*giJ2L5JcS_DJHmrFLSjyOg.png" /><figcaption>ตัวแปรทั้งหมดที่สร้างไว้ สามารถ Double click เพื่อดูข้อมูลได้</figcaption></figure><p>จาก rule ที่เรากำหนด lift มีค่าต่ำสุดที่ยอมรับได้ min_threshold = 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*884wPaKfiSgHy4B54MwYzA.png" /><figcaption>From rule</figcaption></figure><p>กำหนด condition เพิ่มขึ้น minimum confidence = 0.3 และ lift &gt; 1 ทำให้ filter เหลือแค่ 2 กฎ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4UCcaRkv8HhJX1vX7qgcg.png" /><figcaption>From rules2</figcaption></figure><h3>บทสรุปก่อนจะสลบ</h3><p>จากการกำหนด Condition ตามบทความนี้ ก็สามารถเรียงลำดับจากค่า Lift ที่มากสุดคือ 1.44 แสดงว่า การซื้อ Spaghetti มีความขึ้นต่อกันกับการซื้อ Mineral water จาก Associations rule ที่เรากำหนดทำให้เหลืออยู่ 2 กฎ คือ</p><ol><li>ถ้าลูกค้าซื้อ <strong>Spaghetti</strong> ก็มักจะซื้อ <strong>Mineral water</strong></li><li>ถ้าลูกค้าซื้อ <strong>Chocolate</strong> ก็มักจะซื้อ <strong>Mineral water</strong></li></ol><p>และถ้ามีการกำหนด Condition อื่นๆก็อาจจะมีกฎเพิ่มขึ้นหรือลดลงตามไปด้วย</p><p><strong>References :</strong></p><p><a href="https://www.kaggle.com/roshansharma/market-basket-optimization">https://www.kaggle.com/roshansharma/market-basket-optimization</a></p><p><a href="http://www2.it.kmutnb.ac.th/teacher/FileDL/MissKanchana711256111164.pdf">http://www2.it.kmutnb.ac.th/teacher/FileDL/MissKanchana711256111164.pdf</a></p><p><a href="https://www.edureka.co/blog/apriori-algorithm/#apriori-algorithm">https://www.edureka.co/blog/apriori-algorithm/#apriori-algorithm</a></p><p><a href="https://medium.com/@sumedh0803/extracting-association-rules-from-grocery-store-data-ad776ae2d34e">https://medium.com/@sumedh0803/extracting-association-rules-from-grocery-store-data-ad776ae2d34e</a></p><p><a href="http://rasbt.github.io/mlxtend/user_guide/frequent_patterns/association_rules/">http://rasbt.github.io/mlxtend/user_guide/frequent_patterns/association_rules/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b650f48e675" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Market Basket Analysis with Tableau แบบฉบับมือใหม่]]></title>
            <link>https://medium.com/@psicecream/basic-market-basket-analysis-with-tableau-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B9%83%E0%B8%AB%E0%B8%A1%E0%B9%88-3fbadd56735a?source=rss-171a34a5eb20------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fbadd56735a</guid>
            <category><![CDATA[market-basket-analysis]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Warisa P.]]></dc:creator>
            <pubDate>Fri, 03 Jul 2020 16:20:47 GMT</pubDate>
            <atom:updated>2020-07-05T10:52:52.492Z</atom:updated>
            <content:encoded><![CDATA[<p>สวัสดีจ้าา ~<strong>(◕‿◕✿)</strong></p><p>บทความนี้จะมาลองทำ Data Visualization เพื่อทำ Market Basket Analysis ด้วย Tableau แบบมือใหม่ลองทำ Data Analytic ให้ดูกัน</p><p><strong>Market Basket Analysis </strong>คือ การวิเคราะห์ข้อมูลตะกร้าตลาด? หรือก็คือการวิเคราะห์พฤติกรรมของลูกค้าในการซื้อสินค้า ดูความสัมพันธ์ของสินค้าที่ลูกค้ามักจะซื้อร่วมกัน เช่น ลูกค้าซื้อนม ก็มักจะซื้อแซนวิชด้วย เป็นต้น เพื่อนำไปเสนอในการจัด Promotion หรือเพิ่มยอดขายของสินค้า</p><p>Tableau คือ Software ที่นิยมใช้ในการวิเคราะห์ข้อมูล หรือ Data Analytic โดยจะนำข้อมูลมาแสดงเป็นภาพ เช่น Map, Chart ,Graph รูปแบบต่างๆ รวมถึงการสร้าง Dashboard ให้สามารถใช้ในการตัดสินใจและวิเคราะห์ข้อมูลในง่ายขึ้น</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ewShhxQY_hiDB05URNjoqA.png" /></figure><p><strong>ถ้าพร้อมแล้วก็เริ่มกันเลย</strong></p><ol><li>เริ่มต้นจากการ Download Software Tableau <a href="https://www.tableau.com/products">https://www.tableau.com/products</a> มาก่อน เนื่องจากเป็นโปรแกรมที่มี license เราเลย Download แบบ free 14-day trial มาใช้</li><li>เลือกข้อมูลที่เราสนใจ เราใช้เป็น Open data จากเว็บ <a href="https://www.kaggle.com/">https://www.kaggle.com/</a> เป็นเว็บที่มี Dataset ค่อนข้างหลากหลาย สามารถนำมาทำ Data Analytic หรือ Data Mining ได้ ข้อมูลที่เราเลือกมาเป็นข้อมูลการซื้อสินค้าใน Supermarket จาก <strong><em>Market Basket Optimization</em></strong></li></ol><p><a href="https://www.kaggle.com/roshansharma/market-basket-optimization">Market Basket Optimization</a></p><p>ข้อมูลจะเป็น .csv มีข้อมูล 7501 rows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MN9wP3O3-AQNTDswCAIpkg.png" /><figcaption>หน้าตาข้อมูลจะเป็น Item เรียงต่อกันเลยในแต่ละ Row</figcaption></figure><p>3. นำมาทำการ Clean ข้อมูลใน Excel โดยนำ Itemset ที่ซื้อชิ้นเดียวออก เพราะเราจะดูการซื้อสินค้าร่วมกัน จะเหลือประมาณ 5700 rows ซึ่งเราได้สุ่ม Dataset มา 2000 rows จากนั้นนำแปลงเป็น Structure ใหม่ ให้สามารถนำไปใช้กับ Tableau ได้ เพิ่ม Coloums TransactionID และ Item ขึ้นมา Save เป็น .csv</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*NywQtcwAQi3ol2Wa2xFIsg.png" /></figure><p>4. นำข้อมูลที่เตรียมไว้มา Import ใน Tableau เลือกประเภท Text File เพราะเป็น .csv</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6DQQuNFg8QCkBicHQSwgIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcwZyb4HktyssftIWwuboA.png" /><figcaption>Import Data ที่เตรียมไว้</figcaption></figure><p>5. นำ Data มา Join กัน เชื่อมด้วย TransactionID และ Item (&lt;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RtoU_0Ncfd8ad1_7Ueg4Ew.png" /><figcaption>Join table</figcaption></figure><p>6. เพิ่ม Sheet แล้วลาก Field ที่สนใจไปที่ Columns และ Rows จากนั้นลาก TansactionID มาที่ Label เพื่อแสดง Labels และ Color ในการแสดงสี ในช่อง Marks set เป็นแบบ Count Distinct ในเห็นจำนวน TransactionID อย่าลืมให้แสดงข้อมูลแบบ Square</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*10HZb1ZcCGwNNx3oZUP63w.png" /><figcaption>Click New Worksheet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mi86HiVgQieNw4W6eswJJg.png" /><figcaption>Frequent Itemset</figcaption></figure><p>พบว่ามีการซื้อ Spaghetti และ Mineral water มากที่สุด 347 Transaction มีการไล่สีจากสีเข้มไปสีอ่อน แสดงถึงจำนวน Transaction จากมากไปน้อย</p><p>สีเข้ม -&gt; จำนวน Transaction มาก<br>สีอ่อน -&gt; จำนวน Transaction น้อย</p><p>7. เพิ่ม Sheet เพื่อดูจำนวนการซื้อสินค้า ลาก Field Item มาที่ Columns และ Count Distinct TransactionID มาที่ Rows จะแสดงจำนวนการซื้อสินค้า พบว่ามีการซื้อ Mineral water มากที่สุด 903 transactions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vGa6DGouzqyK7MowUlD3eQ.png" /><figcaption>Count of TransactionID</figcaption></figure><p>8. เพิ่ม Sheet ดูข้อมูลแบบ Bubble โดยสร้าง Parameter เพิ่ม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrgfvUj2EZhvr3xqasbMXg.gif" /><figcaption>Create Parameter ItemDetail</figcaption></figure><p>9. สร้าง Calculated Field เพื่อให้แสดงสินค้าอื่นใน Transaction เดียวกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0nBBjfYunmu4EG2tEJ-Og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYbtK2XqhyCPAiojv1UQFA.png" /></figure><pre>IF ([Item (2000Sample Market Basket.csv1)] &lt;&gt; [ItemDetail]) <br>THEN [Item (2000Sample Market Basket.csv1)] ELSE ‘N/A’ END</pre><p>ลาก Field Other ItemDetail มาที่ Color และ Label จากนั้นลาก TransactionID มาที่ Size เลือกเป็น Count Distinct ใน Masks จะได้ Bubble chart ตามรูป</p><p>Tada ! 🤩🤩 <strong>╮ (╯▽╰) ╭</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nDUARHzvnn8-rJRcpTw4Nw.png" /><figcaption>Bubble chart</figcaption></figure><p>ลบ N/A ออก โดยการ Click Exclude</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DkndZSl5H1uIDR7VhSpqCw.png" /><figcaption>Delete N/A</figcaption></figure><p>Click ขวาที่ ItemDetail แล้วเลือก Show Parameter เพื่อ Show Dropdown list ทางขวามือ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwkO7u4F_DA2ofGBbARFlA.png" /><figcaption>Show ItemDetail parameter</figcaption></figure><p>สามารถสลับ ItemDetail ได้ตรง Dropdown list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HtXsS5rSWWMIZyZDs3tceg.gif" /><figcaption>Change ItemDetail</figcaption></figure><p><strong><em>Conclusion</em></strong></p><p>เพียงเท่านี้ก็สามารถดูข้อมูลการซื้อสินค้าอย่างคร่าวๆ ได้แล้ว เป็นไงบ้าง ไม่ยากใช่มั้ยล้าา เราก็ทราบแล้วว่าจากตัวอย่างข้อมูล 2000 rows สินค้าที่ซื้อมากสุดคือ น้ำแร่นั่นเอง ( <strong>Mineral water ) </strong>และสินค้าซื้อคู่กันมากที่สุดคือ <strong>Mineral water และ Spaghetti</strong> รองลงมาคือ <strong>Mineral water และ Chocolate</strong></p><p>ขอบคุณที่อ่านจนจบ หากมีข้อเสนอแนะเพิ่มเติมหรือมีข้อมูลใดผิดพลาด<br>บอกได้เลยค่ะ ขออภัยในความมือใหม่หัด Analyse Data <strong>(｡•́︿•̀｡) .</strong></p><p><strong>References</strong> :</p><p><a href="https://www.kaggle.com/roshansharma/market-basket-optimization">Market Basket Optimization</a></p><p><a href="https://www.youtube.com/watch?v=zP7IQqcGTT4">https://www.youtube.com/watch?v=zP7IQqcGTT4</a></p><p><a href="https://www.youtube.com/watch?v=IXZyPbahDWs">https://www.youtube.com/watch?v=IXZyPbahDWs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fbadd56735a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>