我应该标准化/标准化回归模型中的目标数据/因变量吗?

机器算法验证 回归 机器学习 正常化 标准化
2022-03-19 16:48:25

在对解释变量进行标准化后,解释变量和目标数据之间的幅度差异约为 3 个数量级。我想知道目标数据的转换是否仍然会给出有效的结果。

非常感谢各位!

2个回答

缩放或归零不会改变回归或分类结果。唯一的缺点是失去了可解释性。

以下是 R 中的工作示例,显示缩放或归零的任何组合都会产生相同的回归线。

系数可以不同,这没关系。以下是按顺序在以下模型中计算的系数。

  (Intercept)         disp
1    29.59985  -0.04121512
2    20.09062  -0.04121512
3    26.66946 -16.52314159
4    26.66946 -16.52314159

没有归零或缩放

# orginal data
df <- mtcars
png("mtcars_original.png")
plot(df$disp, df$mpg, main="MPG VS Displacment")
abline(lm(mpg ~ disp, df), col = 2)
dev.off()

MPG VS 排量

归零

# zeroed displacement
df <- mtcars
df$disp <- df$disp - mean(df$disp)
png("mtcars_zeroed.png")
plot(df$disp, df$mpg, main="MPG VS Zeroed  Displacement")
abline(lm(mpg ~ disp, df), col = 2)
dev.off()

MPG VS 零排量

缩放

# scaled displacment
df <- mtcars
df$disp <- (df$disp - min(df$disp)) / ( max(df$disp) -  min(df$disp))
png("mtcars_scaled.png")
plot(df$disp, df$mpg, main="MPG VS Scaled Displacment")
abline(lm(mpg ~ disp, df), col = 2)
dev.off()

MPG VS 比例位移

归零和缩放

# zeroed & scaled displacment
df <- mtcars
dt$disp <- df$disp - mean(df$disp)
df$disp <- (df$disp - min(df$disp)) / ( max(df$disp) -  min(df$disp))
png("mtcars_zeroed_scaled.png")
plot(df$disp, df$mpg, main="MPG VS Scaled & Zeroed Displacment")
abline(lm(mpg ~ disp, df), col = 2)
dev.off()

MPG VS 缩放和归零位移

它会。您的测量值是坐标。对于解释变量上的每个值,您都对目标变量进行了坐标测量。如果您不更改其中任何一个的顺序,则关系保持不变。正确的?