我们正在考虑开始使用kxen来构建客户数据的逻辑回归模型。到目前为止,我们一直使用SAS和R studio,我很难清楚地理解Kxen中使用的K2R包的逻辑。
1)如果我想在sql中建立评分函数,如何从Kxen - (beta, intercept)
获得回归系数?
得到以下sql代码(附带代码的一部分):
SELECT $key, $target_variable, CAST( (CASE
WHEN $target_variable <= -1.32354053933e0 THEN 0.0e0
WHEN $target_variable <= -3.245405264555e-1 THEN 0.0e0
WHEN $target_variable <= -3.235405393301e-1 THEN ( 2.283134417281e-3*$target_variable+7.409696685844e-4 )
WHEN $target_variable <= -2.673812457267e-1 THEN ( 4.065409082516e-5*$target_variable+1.543635190092e-5 )
WHEN $target_variable <= -"2.673250302176e-1 THEN ( 4.057282329758e1*"$target_variable"+1.084841700789e1 )
..... [more code here]
ELSE 0.0e0
END) AS FLOAT )
AS PROBA0
into [table_name]
FROM
(
SELECT $key, ( 2.191922889118e-2 + CAST( (CASE
WHEN ( "predictor1" IS NULL OR "predictor1" = '' ) THEN -6.39011247354e-3
WHEN "predictor1" <= -2.432307283e0 THEN -1.541583426389e-1
WHEN "predictor1" <= 9.41313103e-1 THEN ( 9.932069236689e-2*"predictor1"+8.742010175092e-2 )
WHEN "predictor1" <= 1.696595422e0 THEN ( 4.169961790129e-2*"predictor1""+2.454336172985e-1 )
WHEN "predictor1" >= 1.696595402e0 THEN 3.16180997712e-1
ELSE -6.39011247354e-3
END) AS FLOAT)+
CAST( (CASE
WHEN ( "predictor2" IS NULL OR "predictor2" = '' ) THEN 3.937894402762e-3
WHEN "predictor2" <= -9.99550198e-1 THEN -2.797353866946e-2
WHEN "predictor2" <= -1.27770581e-1 THEN ( 2.918798485695e-2*"predictor2""+1.201317665409e-3 )
WHEN "predictor2" <= 3.78487285e-1 THEN ( 2.547969219572e-2*"predictor2"+6.997428207111e-3 )
...... [more code here]
) AS $target_varialbe FROM [table_name]
) TMPTABLE0
预测变量在WOE变换后都被输入并定义为连续变量。
2)当按订单分配订单时,订单的订单是不同的,然后按概率订购时 - ergo转换从得分到概率不是单调的功能?我的目标是为客户分配标准化分数/概率。有人可以解释一下吗?
答案 0 :(得分:1)
因为我最终能够找到答案,所以它来了: 用于稳健回归的KXEN K2R引擎与SAS或R不完全相同,因为它们使用不同的逻辑。 KXEN回归引擎基于结构风险最小化使用Vapniks定理构建,在分数计算中转换预测变量(分数未标准化),然后在不同分数区间使用逻辑方程组来获得目标变量的概率,从0到1归一化。因此无法从KXEN中提取回归系数。对概率的得分也不是严格单调的功能