日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

標簽傳播聚類

標簽傳播算法LPA(Label Propagation Algorithm)是基于圖的半監督學習方法,其基本思路是節點的標簽(community)依賴其相鄰節點的標簽信息,影響程度由節點相似度決定,并通過傳播迭代更新達到穩定。標簽傳播聚類組件能夠輸出圖中所有節點均收斂時各節點對應的組。

算法說明

  • 圖聚類是根據圖的拓撲結構,進行子圖的劃分,使得子圖內部節點的連接較多,子圖之間的連接較少。

  • 在用一個唯一的標簽初始化每個節點之后,該算法會重復地將一個節點的標簽社群化為該節點的相鄰節點中出現頻率最高的標簽。當每個節點的標簽在其相鄰節點中出現得最頻繁時,算法就會停止。

配置組件

方法一:可視化方式

在Designer工作流頁面添加標簽傳播聚類組件,并在界面右側配置相關參數:

參數類型

參數

描述

字段設置

頂點表:選擇頂點列

頂點表的點所在列。

頂點表:選擇權值列

頂點表的點的權重所在列。

邊表:選擇源頂點列

邊表的起點所在列。

邊表:選擇目標頂點列

邊表的終點所在列。

邊表:選擇權值列

邊表邊的權重所在列。

參數設置

最大迭代次數

最大迭代次數,默認值為30。

執行調優

進程數

作業并行執行的節點數。數字越大并行度越高,但是框架通訊開銷會增大。

進程內存

單個作業可使用的最大內存量,單位:MB,默認值為4096。

如果實際使用內存超過該值,會拋出OutOfMemory異常。

方法二:PAI命令方式

使用PAI命令配置標簽傳播聚類組件參數。您可以使用SQL腳本組件進行PAI命令調用,詳情請參見場景4:在SQL腳本組件中執行PAI命令

PAI -name LabelPropagationClustering
    -project algo_public
    -DinputEdgeTableName=LabelPropagationClustering_func_test_edge
    -DfromVertexCol=flow_out_id
    -DtoVertexCol=flow_in_id
    -DinputVertexTableName=LabelPropagationClustering_func_test_node
    -DvertexCol=node
    -DoutputTableName=LabelPropagationClustering_func_test_result
    -DhasEdgeWeight=true
    -DedgeWeightCol=edge_weight
    -DhasVertexWeight=true
    -DvertexWeightCol=node_weight
    -DrandSelect=true
    -DmaxIter=100;

參數

是否必選

默認值

描述

inputEdgeTableName

輸入邊表名。

inputEdgeTablePartitions

全表讀入

輸入邊表的分區。

fromVertexCol

輸入邊表的起點所在列。

toVertexCol

輸入邊表的終點所在列。

inputVertexTableName

輸入頂點表名稱。

inputVertexTablePartitions

全表讀入

輸入頂點表的分區。

vertexCol

輸入頂點表的點所在列。

outputTableName

輸出表名。

outputTablePartitions

輸出表的分區。

lifecycle

輸出表的生命周期。

workerNum

未設置

作業并行執行的節點數。數字越大并行度越高,但是框架通訊開銷會增大。

workerMem

4096

單個作業可使用的最大內存量,單位:MB,默認值為4096。

如果實際使用內存超過該值,會拋出OutOfMemory異常。

splitSize

64

數據切分的大小,單位:MB。

hasEdgeWeight

false

輸入邊表的邊是否有權重。

edgeWeightCol

輸入邊表邊的權重所在列。

hasVertexWeight

false

輸入頂點表的點是否有權重。

vertexWeightCol

輸入頂點表的點的權重所在列。

randSelect

false

是否隨機選擇最大標簽。

maxIter

30

最大迭代次數。

使用示例

  1. 添加SQL腳本組件,輸入以下SQL語句生成訓練數據。

    drop table if exists LabelPropagationClustering_func_test_edge;
    create table LabelPropagationClustering_func_test_edge as
    select * from
    (
        select '1' as flow_out_id,'2' as flow_in_id,0.7 as edge_weight
        union all
        select '1' as flow_out_id,'3' as flow_in_id,0.7 as edge_weight
        union all
        select '1' as flow_out_id,'4' as flow_in_id,0.6 as edge_weight
        union all
        select '2' as flow_out_id,'3' as flow_in_id,0.7 as edge_weight
        union all
        select '2' as flow_out_id,'4' as flow_in_id,0.6 as edge_weight
        union all
        select '3' as flow_out_id,'4' as flow_in_id,0.6 as edge_weight
        union all
        select '4' as flow_out_id,'6' as flow_in_id,0.3 as edge_weight
        union all
        select '5' as flow_out_id,'6' as flow_in_id,0.6 as edge_weight
        union all
        select '5' as flow_out_id,'7' as flow_in_id,0.7 as edge_weight
        union all
        select '5' as flow_out_id,'8' as flow_in_id,0.7 as edge_weight
        union all
        select '6' as flow_out_id,'7' as flow_in_id,0.6 as edge_weight
        union all
        select '6' as flow_out_id,'8' as flow_in_id,0.6 as edge_weight
        union all
        select '7' as flow_out_id,'8' as flow_in_id,0.7 as edge_weight
    )tmp
    ;
    drop table if exists LabelPropagationClustering_func_test_node;
    create table LabelPropagationClustering_func_test_node as
    select * from
    (
        select '1' as node,0.7 as node_weight
        union all
        select '2' as node,0.7 as node_weight
        union all
        select '3' as node,0.7 as node_weight
        union all
        select '4' as node,0.5 as node_weight
        union all
        select '5' as node,0.7 as node_weight
        union all
        select '6' as node,0.5 as node_weight
        union all
        select '7' as node,0.7 as node_weight
        union all
        select '8' as node,0.7 as node_weight
    )tmp;

    對應的數據結構圖:

    image

  2. 添加SQL腳本組件,輸入以下PAI命令進行訓練。

    drop table if exists ${o1};
    PAI -name LabelPropagationClustering
        -project algo_public
        -DinputEdgeTableName=LabelPropagationClustering_func_test_edge
        -DfromVertexCol=flow_out_id
        -DtoVertexCol=flow_in_id
        -DinputVertexTableName=LabelPropagationClustering_func_test_node
        -DvertexCol=node
        -DoutputTableName=${o1}
        -DhasEdgeWeight=true
        -DedgeWeightCol=edge_weight
        -DhasVertexWeight=true
        -DvertexWeightCol=node_weight
        -DrandSelect=true
        -DmaxIter=100;
  3. 右擊上一步的組件,選擇查看數據 > SQL腳本的輸出,查看訓練結果。

    | node | group_id |
    | ---- | -------- |
    | 1    | 3        |
    | 3    | 3        |
    | 5    | 7        |
    | 7    | 7        |
    | 2    | 3        |
    | 4    | 3        |
    | 6    | 7        |
    | 8    | 7        |