更新时间:2022-01-27 GMT+08:00
分享

最小二乘法

概述

ALS(交替最小二乘)是一种求解矩阵分解问题的最优化方法。

“交替最小二乘”节点用于推荐,它通过矩阵分解手段快速实现用户对物品评分的预测。

输入

参数

子参数

参数说明

inputs

dataframe

inputs为字典类型,dataframe为pyspark中的DataFrame类型对象

输出

spark pipeline类型的模型

参数说明

参数

子参数

参数说明

user_col

-

用户id所在的列名

item_col

-

项目id所在的列名

rating_col

-

评分所在的列名

recommend_nums

-

推荐物品的个数,默认为10

prediction_col

-

预测列列名,默认为"prediction"

cold_start_strategy

-

冷启动策略,默认为"nan"

alpha

-

矩阵分解的正则化系数,默认为1.0

implicit_prefs

-

是否使用隐含偏好,默认为Flase

max_iter

-

最大迭代次数,默认为50

non_negative

-

是否使用非负限制,默认为False

rank

-

因子分解的秩,默认为10

reg_param

-

正则化系数,默认为0.0

样例

inputs = {
    "dataframe": None  # @input {"label":"dataframe","type":"DataFrame"}
}
params = {
    "inputs": inputs,
    "user_col": "",  # @param {"label":"user_col","type":"string","required":"true","helpTip":""}
    "item_col": "",  # @param {"label":"item_col","type":"string","required":"true","helpTip":""}
    "rating_col": "",  # @param {"label":"rating_col","type":"string","required":"true","helpTip":""}
    "recommend_nums": 10,  # @param {"label":"recommend_nums","type":"integer","required":"false","range":"(0,2147483647)","helpTip":""} 
    "prediction_col": "prediction",  # @param {"label":"prediction_col","type":"string","required":"false","helpTip":""} 
    "cold_start_strategy": "nan",  # @param {"label":"cold_start_strategy","type":"string","required":"false","helpTip":""} 
    "alpha": 1,  # @param {"label":"alpha","type":"number","required":"false","range":"(none,none)","helpTip":""}
    "implicit_prefs": False,  # @param {"label":"implicit_prefs","type":"boolean","required":"false","helpTip":""}
    "max_iter": 10,  # @param {"label":"max_iter","type":"integer","required":"false","range":"(0,2147483647)","helpTip":""} 
    "non_negative": False,  # @param {"label":"non_negative","type":"boolean","required":"false","helpTip":""}
    "rank": 10,  # @param {"label":"rank","type":"integer","required":"false","range":"(0,2147483647)","helpTip":""}
    "reg_param": 0.1  # @param {"label":"reg_param","type":"number","required":"false","range":"(none,none)","helpTip":""} 
}
als____id___ = MLSALS(**params)
als____id___.run()
# @output {"label":"pipeline_model","name":"als____id___.get_outputs()['output_port_1']","type":"PipelineModel"}
# @output {"label":"dataframe","name":"als____id___.get_outputs()['output_port_2']","type":"DataFrame"}

分享:

    相关文档

    相关产品

close