【问题标题】:should I log transform my model for Linear Regression analysis我应该记录转换我的模型以进行线性回归分析吗
【发布时间】:2020-09-25 11:31:59
【问题描述】:

我有一个波士顿房屋数据集,具有以下特征

<class 'pandas.core.frame.DataFrame'>
Int64Index: 414 entries, 1 to 414
Data columns (total 6 columns):
 #   Column                                  Non-Null Count  Dtype  
---  ------                                  --------------  -----  
 0   X2 house age                            414 non-null    float64
 1   X3 distance to the nearest MRT station  414 non-null    float64
 2   X4 number of convenience stores         414 non-null    int64  
 3   X5 latitude                             414 non-null    float64
 4   X6 longitude                            414 non-null    float64
 5   Y house price of unit area              414 non-null    float64
dtypes: float64(5), int64(1)

标准差是:

X2 house age                                11.392485
X3 distance to the nearest MRT station    1262.109595
X4 number of convenience stores              2.945562
X5 latitude                                  0.012410
X6 longitude                                 0.015347
Y house price of unit area                  13.606488
dtype: float64

我试图计算价格的偏差,得到的值为 0.599

我对数据进行log转换得到-0.7064的值

我遇到的问题是,我应该继续使用数据集转换日志还是不需要转换它,我什么时候应该在我的数据分析中考虑日志转换?

【问题讨论】:

  • 想要达到什么目的?是否进行对数转换是一个见仁见智的问题,取决于您的模型应该做什么
  • @Roim 我正在尝试创建一个简单的线性回归模型,其中包含 5 个预测变量来预测价格值(响应)
  • 然后两者都做,看看哪个模型使用交叉验证做得更好

标签: pandas data-science linear-regression


【解决方案1】:

是否使用对数转换完全取决于哪种方式更适合您的数据。只需计算模型的性能(对数转换和非对数转换),看看哪个模型的性能指标最好。

【讨论】:

    猜你喜欢
    • 2021-03-21
    • 1970-01-01
    • 1970-01-01
    • 2017-05-27
    • 2018-02-27
    • 2015-04-06
    • 2020-08-28
    • 1970-01-01
    • 2021-02-13
    相关资源
    最近更新 更多