机器学习算法探索病种盈亏的影响因素——决策树 \* { margin: 0; padding: 0; outline: 0; } body { font-family: "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif; line-height: 1.6; } .\_\_page\_content\_\_ { max-width: 667px; margin: 0 auto; padding: 20px; text-size-adjust: 100%; color: rgba(0, 0, 0, 0.9); padding-bottom: 64px; } .title { user-select: text; font-size: 22px; line-height: 1.4; margin-bottom: 14px; font-weight: 500; } .\_\_meta\_\_ { color: rgba(0, 0, 0, 0.3); font-size: 15px; line-height: 20px; hyphens: auto; word-break: break-word; margin-bottom: 50px; } .\_\_meta\_\_ .nick\_name { color: #576B95; } .\_\_meta\_\_ .copyright { color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0.05); padding: 0 4px; margin: 0 10px 10px 0; } blockquote.source { padding: 10px; margin: 30px 0; border-left: 5px solid #ccc; color: #333; font-style: italic; word-wrap: break-word; } blockquote.source a { cursor: pointer; text-decoration: underline; } .item\_show\_type\_0 > section { margin-top: 0; margin-bottom: 24px; } a { color: #576B95; text-decoration: none; cursor: default; } .text\_content { margin-bottom: 50px; user-select: text; font-size: 17px; white-space: pre-wrap; word-wrap: break-word; line-height: 28px; hyphens: auto; } .picture\_content .picture\_item { margin-bottom: 30px; } .picture\_content .picture\_item .picture\_item\_label { text-align: center; } img { max-width: 100%; } .pay\_subscribe\_notice { margin: 30px 0; padding: 20px; background: #fffbe6; border: 1px solid #ffe58f; border-radius: 8px; } .pay\_subscribe\_badge { display: inline-block; padding: 4px 12px; background: #faad14; color: #fff; border-radius: 4px; font-size: 14px; font-weight: 500; margin-bottom: 12px; } .pay\_subscribe\_desc { font-size: 15px; line-height: 1.8; color: rgba(0, 0, 0, 0.7); margin-bottom: 12px; } .pay\_subscribe\_hint { font-size: 13px; color: rgba(0, 0, 0, 0.4); } .\_\_bottom-bar\_\_ { display: flex; justify-content: space-between; align-items: center; position: fixed; bottom: 0; left: 0; right: 0; height: 64px; padding: 8px 20px; background: white; box-sizing: border-box; border-top: 1px solid rgba(0, 0, 0, 0.2); } .\_\_bottom-bar\_\_ .left { display: flex; align-items: center; font-size: 15px; white-space: nowrap; } .\_\_bottom-bar\_\_ .right { display: flex; } .\_\_bottom-bar\_\_ .sns\_opr\_btn { display: flex; align-items: center; user-select: none; background: transparent; border: 0; color: rgba(0, 0, 0, 0.9); font-size: 14px; } .\_\_bottom-bar\_\_ .sns\_opr\_btn:not(:last-child) { margin-right: 16px; } .\_\_bottom-bar\_\_ .sns\_opr\_btn > img { margin-right: 4px; }
机器学习算法探索病种盈亏的影响因素——决策树
原创 Hi您好 恒健知行 2025-12-11 00:00 安徽
1、机器学习
相比多元线性回归的统计建模,机器学习方法显得就十分暴力。很多统计模型都有严苛的约束条件,比如数据的正态分布、因素之间没有多重共线性等。机器学习方法的应用约束条件显得宽松很多,它是以目标导向的。经常听到算法如决策树、二叉树、支持向量机、随机森林、神经网络、深度神经网络,直到现在的大模型(Transform架构为代表的深度神经网络模型),它们“暴力”的点在于通过一部分训练集、一部分测试集,在训练集中找到最优模型,在测试集中校验模型评估模型,最后得出相对靠谱的模型用于预测。最近耳熟能详的大模型打榜也是类似,用训练好的模型再一个全新的标准数据中进行打榜竞赛。
2、数据清洗
机器学习模型的使用有几个基本的数据清洗工作,如训练数据集、测试数据集的拆分,分类变量的处理等。
2.1 分类变量处理
如果分类变量比较少,可以进行分类变量的热编码,也就是将其处理成一组由0-1组成的数据。比如性别(男,女),热编码转为(1,0)这样的数值。但如果分类值域比较多,这种处理可能导致数据量几何倍数增加,此时进行频数编码也是一种处理方式。
2.2 训练和测试数据集
训练数据集和测试数据集的拆分通常是采用抽样的方式,训练集占70%,测试数据集占30%是常见的抽样比例,当然这并不是确定的。
需要特别注意的是,由于机器学习模型较多,大部分数据要求是矩阵格式、或则有些算法有特别的格式要求(取决于算法实现的约束)。
也有些算法对数据指标比较敏感,需要对数据进行标准化统一量纲(或特征化)后再使用。这些工作都需要在数据清洗过程中完成。
2.3常规数据清洗
比如缺失值的填充、异常值的清洗,这些也是不可或缺的。
3、决策树模型应用
首先可以采用最经典的机器学习算法——“决策树”来进行病种盈亏的影响因素分析。下图是一个决策树示意图,通过决策树我们可以观察到从目标盈亏到各类影响因素的决策路径。
同时也可以绘制出各个影响因素的重要程度排序图:
4、讨论
决策树模型同样也有评估结果,上述模型再测试集上的表现:
上述数据表明该模型解释力不足:R²仅0.22,78%的变异无法解释,预测精度较差。如果继续使用决策树模型,继续优化的方向可以调整决策树参数,如增加决策树的深度、减少最小分裂样本、最小叶子节点样本或减小复杂度参数等。或者换个方法,看看其他模型效果如何?
系列文章
<4>医院运营管理之病种盈亏探索分析一 分类变量分析,比较科室、病种、患者特征、住院天数、费用结构的病种盈亏对比
恒健知行
 阅读 赞  分享 ’%3E %3Cg transform=‘translate(0 -2.349)’%3E %3Cpath d=‘M0 2.349h24v24H0z’/%3E %3Cpath fill=’%23576B95’ d=‘M16.45 7.68c-.954 0-1.94.362-2.77 1.113l-1.676 1.676-1.853-1.838a3.787 3.787 0 0 0-2.63-.971 3.785 3.785 0 0 0-2.596 1.112 3.786 3.786 0 0 0-1.113 2.687c0 .97.368 1.938 1.105 2.679l7.082 6.527 7.226-6.678a3.787 3.787 0 0 0 .962-2.618 3.785 3.785 0 0 0-1.112-2.597A3.687 3.687 0 0 0 16.45 7.68zm3.473.243a4.985 4.985 0 0 1 1.464 3.418 4.98 4.98 0 0 1-1.29 3.47l-.017.02-7.47 6.903a.9.9 0 0 1-1.22 0l-7.305-6.73-.008-.01a4.986 4.986 0 0 1-1.465-3.535c0-1.279.488-2.56 1.465-3.536A4.985 4.985 0 0 1 7.494 6.46c1.24-.029 2.49.4 3.472 1.29l.01.01L12 8.774l.851-.85.01-.01c1.046-.951 2.322-1.434 3.59-1.434 1.273 0 2.52.49 3.472 1.442z’/%3E %3C/g%3E %3C/g%3E %3C/g%3E%3C/svg%3E) 推荐 ’ fill=’%23000’ fill-opacity=’.9’/%3E%3C/svg%3E) 留言