文档

LinUcb训练任务配置

Flink 在线学习训练任务的配置如下。

1. Hologres配置

配置项

备注

示例

endpoint

格式:host:port。

hgpostcn-cn-xxxx-cn-beijing-vpc.hologres.aliyuncs.com:80

dbname

hologres数据库名称。

db_name

tablename

存储模型参数的holo的表名。

rec.contextual_bandit_models

username

hologres的用户名。

${holo_user_name}

password

hologres的密码。

${holo_password}

insertOrUpdate

数据插入模式:是否覆盖。

true

hologres.feature.table

存储特征的hologres表名。

rec.contextual_bandit_features

hologres.arm.table

存储后续arm的hologres表名。

rec.cold_start_item_table

2. 算法配置

配置项

备注

示例

log.parser.parallelism

日志解析的worker并行度。

4

parallelism

算法并行度。

4

linucb.algo

linucb算法类型,disjoint or hybrid。

hybrid

browse.window.size

曝光事件等待其他事件的时间,单位:分钟。

8

default.window.size

其他事件在内存中等待的时间,单位:分钟。

5

new.arm.duration.hours

arm的生命周期,单位:小时。

24

new.arm.cache.minutes

新arm在内存中cache的时间,单位:分钟。

1

arm.id.column.name

arm的ID在表 hologres.arm.table

中的列名。

videoId

arm.create.time.column.name

arm的创建时间在表 hologres.arm.table

中的列名。

createTime

arm.create.time.column.type

arm的创建时间的格式,后文有详细介绍。

timestamp

备注:配置项log.parser.parallelism,vvp(UI界面)上设置的并发度不能低于该值,尽量保持一致;并且该值一般不大于data source的并发(datahub或kafka的分片数)。

3. 数据源配置

3.1 kafka

备注:要求kafka的输入为json string,标准的JSON格式对象,格式为{Key:Value, Key:Value,...}。

配置项

备注

示例

kafka.bootstrap.servers

kafka server ips。

172.0.XX.XX:9092,172.0.XX.XX:9092

kafka.topic

kafka topic。

item_bhv_log

kafka.group.id

kafka group ID。

realtime_rec

input.user.field.path

用户ID的 json path

$.userid

input.arm.field.path

arm的 json path

$.value.svid

input.event.type.field.path

事件类型的 json path

$.event_name

input.event.time.field.path

事件时间的 json path

$.gmt

input.event.time.format

事件时间的格式, 详见下文。

"yyyy-MM-dd HH:mm:ss.SSS"

input.event.reward.json

事件的reward,JSON格式。

{"exposure":0,"svplay":0.5,"svplayend":1,"share":2,"likes":1.5}

input.exposure.event.name

曝光事件的名称。

exposure

input.event.equal.filter

日志满足等式条件时才保留,{"key": "value"}。

{"from_page":"p_smartvideodetail"}

input.event.in.filter

日志满足集合条件时才保留,{"key": [...]}。

{"refer":["p_weexpage", "p_svhome", "p_svh_tab_0"]}

备注:不在配置项input.event.reward.json中配置reward的事件将会被过滤掉;曝光事件的reward建议设置为0。

备注:json path表示在JSON中的path,以$开头。更多path信息,请参见LanguageManual UDF。不同字符的含义如下:

  • $:表示根节点。

  • .或['']:表示子节点。MaxCompute支持用这两种字符解析JSON对象,当JSON的Key本身包含.时,可以用['']来替代。

  • []:[number]表示数组下标,从0开始。

  • :Wildcard for [],返回整个数组。不支持转义。

示例:假设某条日志的内容为

{
    "store": {
        "fruit": [
            {
                "weight": 8,
                "type": "apple"
            },
            {
                "weight": 9,
                "type": "pear"
            }
        ],
        "bicycle": {
            "price": 19.95,
            "color": "red"
        }
    },
    "email": "a***@example.net",
    "owner": "a**"
}

JSON path

value

$.owner

a**

$.store.bicycle.price

19.95

$.store.fruit[0]

{"weight":8,"type":"apple"}

$.store.fruit[0].type

apple

3.2 datahub

置项

备注

示例

datahub.endpoint

数据总线endpoint。

http://dh-cn-beijing-int-vpc.aliyuncs.com

datahub.project

数据总线项目名。

xxx_rec

datahub.topic

数据总线topic。

item_bhv_log

datahub.sub.id

数据总线订阅ID。

16255766364793VNMA

datahub.access.id

用户名。

datahub.access.key

密码。

datahub.start.in.ms

日志数据的开始消费时间戳(单位毫秒)。

默认值:Job启动的时间

input.user.field.path

用户ID的 value path

userid

input.arm.field.path

arm的 value path

value.svid

input.event.type.field.path

事件类型的 value path

event_name

input.event.time.field.path

事件时间的 value path

gmt

input.event.time.format

事件时间的格式,详见下文。

"yyyy-MM-dd HH:mm:ss.SSS"

input.event.reward.json

事件的reward,JSON格式。

{"exposure":0,"svplay":0.5,"svplayend":1,"share":2,"likes":1.5}

input.exposure.event.name

曝光事件的名称。

exposure

input.event.equal.filter

日志满足等式条件时才保留,{"key": "value"}。

{"from_page":"p_smartvideodetail"}

input.event.in.filter

日志满足集合条件时才保留,{"key": [...]}。

{"refer":["p_weexpage", "p_svhome", "p_svh_tab_0"]}

备注:不在配置项input.event.reward.json中配置reward的事件会被过滤掉;曝光事件的reward建议设置为0。

3.3 Value Path

单值字段:column_name

JSON字段:column_name.path

path表示JSON值的路径,其中:

  • . 表示子节点

  • [] 表示数组下标,数据格式为:key[sub1][sub2][sub3]......

示例: 假设某datahub有一 column value,其值为

{
    "svd_tab": "recommend",
    "publish_uid": 964655287,
    "totaltime": 8219,
    "exp_id": "ER4_L6#EG8****",
    "refer": ["weexpage", "html5"],
    "alogr_name": {
      "name": "U2IRecallV10",
      "type": "linucb"
    },
    "svid": "5480249",
    "n_svid": "5505132",
    "playtime": 572,
    "n_alogr_name": "SwingU2IRecallV10",
    "request_id": "03cabe99-e46c-43bf-b689-5c6b9ab083fa"
}
  • value.svid可取到值 "5480249"。

  • value.alogr_name.name 可取到值 "U2IRecallV10"。

  • value.refer[1]可取到值 "html5"。

3.4 Time Format

配置项

说明

timestamp

整型,时间戳,单位:秒。

timestamp.in.millisecond

整型,时间戳,单位:毫秒。

java SimpleDateFormat

字符串,2021-09-14 19:18:37.971 -> "yyyy-MM-dd HH:mm:ss.SSS"。

  • 本页导读 (0)
文档反馈