【问题标题】:Building prediction model using categorical data in R使用 R 中的分类数据构建预测模型
【发布时间】:2015-06-21 09:51:40
【问题描述】:

我是机器学习的新手,但是我正在尝试建立一个预测模型,我所有的训练集变量都是分类的,

PREDICTOR_1     PREDICTOR_2              PREDICTOR_3
 Found        : 5    Best Match   :2        Found, Supplier site: 5   
 No result    : 2    Found        :8        Found, Zone site    : 1   
 Part NotFound:11    Not Found WDA:8        No Data Found       :12   
    PREDICTOR_4                       PREDICTOR_5   PREDICTOR_6
 No result   :11      Found with Different length: 1   High     :10    
 Search begin: 7      No result                  :16   LOW      : 4    
                      Part Found With out Suffix : 1   No result: 4    
     PREDICTOR_7   PREDICTOR_8                PREDICTOR_9       RESULT  
 Direct_Match: 8      NO        :8      Mpn Found within PCN: 3   Found    :15  
 No result   :10      YES       :8      Mpn has no PCN      :15   Not Found: 3  
                      YES-REMOVE:2 

我尝试使用 R 的 glm() 函数,但我不断得到 ​​p>

Warning message:
glm.fit: fitted probabilities numerically 0 or 1 occurred 

1- 我想知道是否可以仅使用分类数据来训练模型
2-这个错误是什么意思

【问题讨论】:

    标签: r classification glm logistic-regression


    【解决方案1】:

    1 这可以在 glm 模型中仅使用分类数据

    2 当一个(或多个)解释变量与响应变量的相关性等于 1 或 -1 时,会发生此错误。我建议您应首先删除相关的解释变量(与其他解释变量)并删除此类解释变量与响应变量的相关性等于 1 或 -1。这可以通过 R 中的 cor 函数来完成。我建议对分类数据使用 Kendal 相关系数。试试cor( data, method = "kendall")

    【讨论】:

    • 收到此错误:cor(mydatafacotrize, method = "kendall") 中的错误:'x' must be numeric
    • 试试:cor(as.numeric(mydatafacotrize), method = "kendall")
    猜你喜欢
    • 1970-01-01
    • 2018-09-30
    • 2018-01-13
    • 2018-08-13
    • 1970-01-01
    • 2020-10-22
    • 2012-09-18
    • 2020-06-09
    • 2019-02-28
    相关资源
    最近更新 更多