EP 4: การใช้งาน Azure Machine Learning and Microsoft Dynamics 365 for Finance and Operations

นำข้อมูลการขายปลีกมาหา Association Rules เพื่อนำมาวิเคราะห์ว่าลูกค้าซื้ออะไรคู่กับสินค้าอะไรบ่อย ๆ ออกโปรโมชั่นแคมเปญคู่กัน ถูกลง เพิ่มมูลค่ายอดขาย
blog cover4
ทางลัด: เลือกอ่านเฉพาะเรื่องที่อยากรู้

ในบล็อคนี้ เราจะมาลองทำ basic Data Mining ด้วย Azure Machine Learning กัน โดยฐานข้อมูลที่ใช้จะอยู่บน Azure SQL Database และข้อมูลถูก integration มาจากโปรแกรม Dynamics 365 for Finance and Operations

ตัวอย่างในบล็อคนี้ จะเป็นการนำข้อมูลการขายปลีก (Retail) มาหากฏความสัมพันธ์ (Association Rules) เพื่อนำมาวิเคราะห์ ว่าลูกค้าซื้ออะไรคู่กับสินค้าอะไรบ่อยๆ ทำให้สามารถออกโปรโมชั่นแคมเปญคู่กัน ทำให้มีราคาถูกลง เพื่อที่จะเพิ่มมูลค่ายอดขายสินค้าได้

Quick Suggest

เตรียม Azure SQL Database

ขั้นตอนแรก เราต้องเตรียมฐานข้อมูลให้เรียบร้อย โดยสามารถทำตาม link นี้ได้เลยครับ https://docs.microsoft.com/en-us/azure/azure-sql/database/design-first-database-tutorial

note* การใช้บริการ azure cloud platform นั้นมีค่าใช้จ่าย และเราต้องทำการผูกบัตรเครดิตไว้กับ azure subscription ด้วยนะ (เบื้องต้นมีให้ทดลองใช้ฟรี $200 usd สำหรับ account ใหม่)

Azure SQL Database

Bring your own database (BYOD)

Dynamics 365 for Finance and Operations ทำการตั้งค่า export data ผ่าน Data management workspace, ไปที่เมนู Configure Entity export to database

Bring your own database

ตั้งค่า connection string ของ azure sql database

				
					Data Source=,1433; Initial Catalog=; Integrated Security=False; User ID=; Password=
				
			
Bring your own database 1

กด Publish Entity store, เลือก Publish entity ที่เราต้องการนำข้อมูลส่งออกไป ทั้งนี้ระบบจะไป create staging table ใน database ให้เราอัตโนมัติ

Bring your own database 2
Bring your own database 3

ทำการนำข้อมูลส่งออก ด้วยเมนู Export เพียงแต่เลือก target เป็น entity store ที่เราตั้งค่าไว้

Bring your own database 4
Bring your own database 5

เมื่อ job run เสร็จเรียบร้อย เรากลับมาเช็คข้อมูลที่ azure sql database จะได้ดังรูป

Bring your own database 6

ขั้นตอนต่อมา เราต้อง prepare data ตามรูปแบบ input ของ model ที่ใช้ ……(เปลี่ยน item by transaction เป็น Itemsets)
ฝั่งซ้ายคือ transaction เดิม
ฝั่งขวาคือ transaction ที่ model ต้องการ

Bring your own database 7

sql select statement เราจะใช้คำสั่งประมาณนี้

				
					SELECT Main.TRANSACTIONNUMBER,
LEFT(Main.CATEGORYNAME,Len(Main.CATEGORYNAME)-1) As “Items”
FROM (SELECT DISTINCT RetailTrans2.TRANSACTIONNUMBER,
 (
     SELECT ‘I’ + RetailTrans1.CATEGORYNAME + ‘,’ AS [Text()]
     FROM [Dbo].[RetailTransactionSalesLineV2Staging] RetailTrans1
     WHERE RetailTrans1.TRANSACTIONNUMBER =
RetailTrans2.TRANSACTIONNUMBER
    And RetailTrans1.CATEGORYNAME != ‘’
     GROUP BY RetailTrans1.TRANSACTIONNUMBER,
RetailTrans1.CATEGORYNAME
     FOR XML PATH (‘’)
     ) [CATEGORYNAME]
     FROM [Dbo].[RetailTransactionSalesLineV2Staging] RetailTrans2
     WHERE RetailTrans2.CATEGORYNAME != ‘’
) [Main]
ORDER BY TRANSACTIONNUMBER
				
			
Bring your own database 8

Microsoft Azure Machine Learning Studio

Azure ML Studio เป็นเครื่องมือไว้ทำ Machine Learning มีเครื่องมือ GUI-Based ให้ใช้งาน นั่นหมายความว่าเราก็แค่ drag and drop เอา Module ที่ต้องการมาประกอบกันเพื่อทำ Machine Learning และมันก็เป็น Web Based เราสามารถใช้งานบน Web Browser ได้เลย … cr. Supanat Jintawatsakoon

ขั้นตอนแรกสร้าง Experiments

 
Bring your own database 9

เลือก Import Data จาก Azure SQL Database, setup connection และ database query

Bring your own database 10

เมื่อเราทำการ Run Experiments เราสามารถดูข้อมูลหรือผลลัพธ์การทำงานหลังจาก node นั้นๆทำงานเสร็จได้, เช็คข้อมูลว่านำเข้าตาม format ที่เราต้องการหรือไม่

Bring your own database 11
Bring your own database 12

สุดท้ายนี้ ขอขอบคุณ

ขั้นตอนการหากฏความสัมพันธ์ (Association Rules) (http://dataminingtrend.com/2014/association-rules)

Bring your own database (BYOD) from Dynamics 365 for Finance and Operations (https://us.hitachi-solutions.com/knowledge-center/bring-your-own-database-for-dynamics-365-finance-operations-part-2)

ลองเล่น Azure Machine Learning Studio (https://medium.com/@SupanatJ/c7e7d0621ef7)

ก้าวเข้าสู่ Digital Business

ดูผลิตภัณฑ์ที่เกี่ยวข้องได้ที่นี่

Search
microsoft partner of the year 2024 Quick ERP

Quick ERP รับรางวัล Partner of the Year Awards 2023 – Dynamics 365 Finance

รางวัล 3 ปีซ้อน ได้รับการยอมรับว่าเป็นบริษัทที่มีผลการดำเนินธุรกิจในระดับสูงตลอดปีที่ผ่านมา ตลอดจนมีกลยุทธ์ในการเข้าสู่ตลาดที่สมบูรณ์และไม่เหมือนใคร