資料探勘 - 查詢語言



資料探勘查詢語言 (DMQL) 由 Han、Fu、Wang 等人針對 DBMiner 資料探勘系統提出。資料探勘查詢語言實際上是基於結構化查詢語言 (SQL)。可以設計資料探勘查詢語言來支援臨時和互動式資料探勘。此 DMQL 提供用於指定原語的命令。DMQL 也可以與資料庫和資料倉庫一起使用。DMQL 可用於定義資料探勘任務。特別是,我們檢查如何在 DMQL 中定義資料倉庫和資料集市。

任務相關資料規範的語法

以下是用於指定任務相關資料的 DMQL 語法:

use database database_name

or 

use data warehouse data_warehouse_name
in relevance to att_or_dim_list
from relation(s)/cube(s) [where condition]
order by order_list
group by grouping_list

指定知識型別的語法

在這裡,我們將討論描述、區分、關聯、分類和預測的語法。

描述

描述的語法為:

mine characteristics [as pattern_name]
   analyze  {measure(s) }

analyze 子句指定聚合度量,例如 count、sum 或 count%。

例如:

Description describing customer purchasing habits.
mine characteristics as customerPurchasing
analyze count%

區分

區分的語法為:

mine comparison [as {pattern_name]}
For {target_class } where  {t arget_condition } 
{versus  {contrast_class_i }
where {contrast_condition_i}}  
analyze  {measure(s) }

例如,使用者可以將大額消費者定義為平均購買價格為 100 美元或以上的客戶;將預算消費者定義為平均購買價格低於 100 美元的客戶。可以根據 DMQL 指定對來自每個類別的客戶的判別描述的挖掘,如下所示:

mine comparison as purchaseGroups
for bigSpenders where avg(I.price) ≥$100
versus budgetSpenders where avg(I.price)< $100
analyze count

關聯

關聯的語法為:

mine associations [ as {pattern_name} ]
{matching {metapattern} }

例如:

mine associations as buyingHabits
matching P(X:customer,W) ^ Q(X,Y) ≥ buys(X,Z)

其中 X 是客戶關係的鍵;P 和 Q 是謂詞變數;W、Y 和 Z 是物件變數。

分類

分類的語法為:

mine classification [as pattern_name]
analyze classifying_attribute_or_dimension

例如,要挖掘模式,對客戶信用評級進行分類,其中類由屬性 credit_rating 確定,並且挖掘分類被確定為 classifyCustomerCreditRating。

analyze credit_rating

預測

預測的語法為:

mine prediction [as pattern_name]
analyze prediction_attribute_or_dimension
{set {attribute_or_dimension_i= value_i}}

概念層次結構規範的語法

要指定概念層次結構,請使用以下語法:

use hierarchy <hierarchy> for <attribute_or_dimension>

我們使用不同的語法來定義不同型別的層次結構,例如:

-schema hierarchies
define hierarchy time_hierarchy on date as [date,month quarter,year]
-
set-grouping hierarchies
define hierarchy age_hierarchy for age on customer as
level1: {young, middle_aged, senior} < level0: all
level2: {20, ..., 39} < level1: young
level3: {40, ..., 59} < level1: middle_aged
level4: {60, ..., 89} < level1: senior

-operation-derived hierarchies
define hierarchy age_hierarchy  for age  on customer  as
{age_category(1), ..., age_category(5)} 
:= cluster(default, age, 5) < all(age)

-rule-based hierarchies
define hierarchy profit_margin_hierarchy  on item  as
level_1: low_profit_margin < level_0:  all

if (price - cost)< $50
   level_1:  medium-profit_margin < level_0:  all
   
if ((price - cost) > $50)  and ((price - cost) ≤ $250)) 
   level_1:  high_profit_margin < level_0:  all

興趣度量規範的語法

使用者可以使用以下語句指定興趣度量和閾值:

with <interest_measure_name>  threshold = threshold_value

例如:

with support threshold = 0.05
with confidence threshold = 0.7

模式表示和視覺化規範的語法

我們有一個語法,允許使用者以一種或多種形式指定發現模式的顯示。

display as <result_form>

例如:

display as table

DMQL 的完整規範

作為一家公司的市場經理,您希望描述可以購買價格不低於 100 美元的商品的客戶的購買習慣;關於客戶的年齡、購買的商品型別以及購買商品的地點。您想知道具有該特徵的客戶的百分比。特別是,您只對在加拿大購買並使用美國運通訊用卡支付的商品感興趣。您希望以表格形式檢視結果描述。

use database AllElectronics_db
use hierarchy location_hierarchy for B.address
mine characteristics as customerPurchasing
analyze count%
in relevance to C.age,I.type,I.place_made
from customer C, item I, purchase P, items_sold S,  branch B
where I.item_ID = S.item_ID and P.cust_ID = C.cust_ID and
P.method_paid = "AmEx" and B.address = "Canada" and I.price ≥ 100
with noise threshold = 5%
display as table

資料探勘語言標準化

標準化資料探勘語言將服務於以下目的:

  • 有助於系統地開發資料探勘解決方案。

  • 提高多個數據挖掘系統和功能之間的互操作性。

  • 促進教育和快速學習。

  • 促進資料探勘系統在工業和社會中的應用。

廣告

© . All rights reserved.