华为云AI开发平台ModelArts离散化_云淘科技

概述

根据用户输入的桶的个数,按照分位数分桶,将用户指定的某个数值列离散化。

输入

参数

子参数

参数说明

inputs

dataframe

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

输出

数据集

参数说明

参数

子参数

参数说明

input_col

输入的列名

output_col

离散化后输出的列名,默认为”quantile_discretizer_result”

num_buckets

桶的个数,默认为2

handle_invalid

处理无效值的策略,支持skip、keep、error,默认为skip

relative_error

相对错误值,取值范围是[0, 1],默认为0.001

样例

inputs = {
    "dataframe": None  # @input {"label":"dataframe","type":"DataFrame"}
}
params = {
    "inputs": inputs,
    "b_output_action": True,
    "outer_pipeline_stages": None,
    "input_col": "",  # @param {"label":"input_col","type":"string","required":"true","helpTip":""}
    "output_col": "quantile_discretizer_result",  # @param {"label":"output_col","type":"string","required":"true","helpTip":""}
    "num_buckets": 2,  # @param {"label":"num_buckets","type":"integer","required":"true","range":"(0,2147483647]","helpTip": ""}
    "handle_invalid": "skip",  # @param {"label":"handle_invalid","type":"enum","options":"skip,keep,error","required":"true","helpTip":""}
    "relative_error": 0.001  # @param {"label":"relative_error","type":"number","required":"true","range":"[0,1]","helpTip":""}
}
quantile_discretizer____id___ = MLSQuantileDiscretizer(**params)
quantile_discretizer____id___.run()
# @output {"label":"dataframe","name":"quantile_discretizer____id___.get_outputs()['output_port_1']","type":"DataFrame"}

父主题: 特征工程

同意关联代理商云淘科技,购买华为云产品更优惠(QQ 78315851)

内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家