修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

搜索
    中文

      皮尔森相关系数

      ✓ 文件回写 ✕ 属性回写 ✓ 直接返回 ✓ 流式返回 ✕ 统计值

      概述

      皮尔森相关系数(Pearson Correlation Coefficient)是衡量两个可定量的变量之间线性关系强度和方向的最常用方法。在图中,节点可由它们的 N 个数值属性(特征)来量化。

      皮尔森相关系数(r)的定义为两个变量 X = (x1, x2, ..., xn) 和 Y = (y1, y2, ..., yn) 之间的协方差和两者标准差乘积的比值:

      皮尔森相关系数的取值范围是 [-1,1]:

      皮尔森相关系数
      关系类型
      解释
      0 < r ≤ 1 正相关 一个变量值变大,另一个变量值也会变大
      r = 0 没有线性相关性 (但可能存在其他相关性)
      -1 ≤ r < 0 负相关 一个变量值变大,另一个变量值反而会变小

      特殊说明

      • 两个节点的皮尔森相关系数理论上不依赖它们之间的连通性。

      语法

      • 命令:algo(similarity)
      • 参数:
      名称
      类型
      规范
      默认
      可选
      描述
      ids / uuids []_id / []_uuid / / 待计算的第一组节点的 ID / UUID
      ids2 / uuids2 []_id / []_uuid / / 待计算的第二组节点的 ID / UUID
      type string pearson cosine 相似度衡量指标;计算皮尔森相关系数时,保持此项为 pearson
      node_schema_property []@<schema>?.<property> 数值类型,需 LTE / 指定至少两个点属性来量化表示节点
      limit int >=-1 -1 返回的结果条数,-1 返回所有结果
      top_limit int >=-1 -1 在选拔模式下,限制 ids/uuids 中每个节点返回的最大结果条数,-1 返回所有相似度大于 0 的结果;在配对模式下,此参数无效

      本算法有两种计算模式:

      1. 配对:同时配置 ids/uuidsids2/uuids2 时,将 ids/uuids 中的每个节点分别与 ids2/uuids2 中的每个节点配对(忽略相同节点),逐对计算相似度。
      2. 选拔:仅配置 ids/uuids 时,对于其中的每个节点,计算其与图中其他所有节点的相似度,返回所有或限定个数的与其相似度大于 0 的结果,并按相似度降序排列。

      示例

      示例图包含 4 个产品(忽略边),每个产品包含 price、weight、width 和 height 属性:

      文件回写

      配置项 回写内容
      filename node1,node2,similarity
      algo(similarity).params({
        uuids: [1], 
        uuids2: [2,3,4],
        node_schema_property: ['price', 'weight', 'width', 'height'],
        type: 'pearson'
      }).write({
        file:{ 
          filename: 'pearson'
        }
      })
      

      结果:文件 pearson

      product1,product2,0.998785
      product1,product3,0.474384
      product1,product4,0.210494
      
      algo(similarity).params({
        uuids: [1,2,3,4],
        node_schema_property: ['price', 'weight', 'width', 'height'],
        type: 'pearson'
      }).write({
        file:{ 
          filename: 'list'
        }
      })
      

      结果:文件 list

      product1,product2,0.998785
      product1,product3,0.474384
      product1,product4,0.210494
      product2,product1,0.998785
      product2,product3,0.507838
      product2,product4,0.253573
      product3,product2,0.507838
      product3,product1,0.474384
      product3,product4,0.474021
      product4,product3,0.474021
      product4,product2,0.253573
      product4,product1,0.210494
      

      直接返回

      别名序号
      类型
      描述
      列名
      0 []perNodePair 各点对及相似度 node1, node2, similarity
      algo(similarity).params({
        uuids: [1,2], 
        uuids2: [2,3,4],
        node_schema_property: ['price', 'weight', 'width', 'height'],
        type: 'pearson'
      }) as p
      return p
      

      结果:p

      node1 node2 similarity
      1 2 0.998785121601255
      1 3 0.474383803132863
      1 4 0.210494150169583
      2 3 0.50783775659896
      2 4 0.253573071269506
      algo(similarity).params({
        uuids: [1,2],
        type: 'pearson',
        node_schema_property: ['price', 'weight', 'width', 'height'],
        top_limit: 1
      }) as top
      return top
      

      结果:top

      node1 node2 similarity
      1 2 0.998785121601255
      2 1 0.998785121601255

      流式返回

      别名序号
      类型
      描述
      列名
      0 []perNodePair 各点对及相似度 node1, node2, similarity
      algo(similarity).params({
        uuids: [3], 
        uuids2: [1,2,4],
        node_schema_property: ['@product.price', '@product.weight', '@product.width'],
        type: 'pearson'
      }).stream() as p
      where p.similarity > 0
      return p
      

      结果:p

      node1 node2 similarity
      3 1 0.167101674410905
      3 2 0.181677473801374
      algo(similarity).params({
        uuids: [1,3],
        node_schema_property: ['price', 'weight', 'width', 'height'],
        type: 'pearson',
        top_limit: 1
      }).stream() as top
      return top
      

      结果:top

      node1 node2 similarity
      1 2 0.998785121601255
      3 2 0.50783775659896
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写