r中如何求变量的对数转换
In Simple terms, log transform squashes or compresses range of large numbers and expands the range of small numbers. So if x is larger, then slower the log(x) increments.
用简单的术语来说,对数变换可以挤压或压缩大数范围,并扩大小数范围。 因此,如果x较大,则log(x)的增量会变慢。
If you closely look at the plot above, which actually talks about log transformation on values ranging from 1 to 1000. As we can see from the plot, log has transformed values from [1,1000] into [0,7] range.
如果仔细看一下上面的图,它实际上是关于从1到1000的值的对数转换。从图中可以看出,对数已将值从[1,1000]转换为[0,7]范围。
Note that how x values from 200 to 1000 get compressed into just ~5 and 7. So the larger the x, slower the log(x) increments.
请注意,如何将200到1000之间的x值压缩为仅〜5和7。因此,x越大,log(x)的增量越慢。
Log is only defined when x>0. Log 0 is undefined. It’s not a real number, let’s say Log (base 10) 0=x, so 10^x=0, if you try to solve this, you will see that no value of x raised to the power of 10 gives you zero. 10⁰ is also 1.
仅在x> 0时定义对数。 日志0未定义。 它不是一个实数 ,比方说对数(以10为底)0 = x,所以10 ^ x = 0,如果尝试解决这个问题,您会发现x的任何数值都不提高到10的幂。 10⁰也是1。
Log transform is also known as variance stabilizing transform, which is useful when dealing with heavy tailed distributions. Log transform can make highly skewed distributions less skewed. So log transform reduces or removes skewness in data.
对数变换也称为方差稳定变换,在处理重尾分布时很有用。 对数变换可以使高度偏斜的分布减少偏斜。 因此,对数变换可以减少或消除数据的偏斜。
使用对数变换作为特征工程技术: (Using Log transform as feature engineering technique:)
To reduce or remove skewness in our data distribution and make it more normal (A.K.A Gaussian distribution) we can use log transformation on our input