简体   繁体   English

如何使用随机森林 model 反向计算给定因变量的预测变量?

[英]How to reversely calculate predictors for given dependent variable with a random forest model?

Given a random forest model y ~ x1 + x2 , is there a possibility to hand the model a value for y and get possible results of x1 and x2 back?给定一个随机森林 model y ~ x1 + x2 ,是否有可能将 model 的值传递给y并获得x1x2的可能结果?

To give a short random example:举一个简短的随机示例:

require(randomForest)
mydf <- data.frame(y =  c(1, 5, 6, 8, -1, -4), x1 = c(2, 8, 7, 10, 3, 0), x2 = c(18, 24, 26, 30, 15, 12))
myrf <- randomForest(y ~ ., data = mydf)

Is there a way to reverse calculate the predictors with the random forest model?有没有办法用随机森林 model 反向计算预测变量?

No. Such functionality does not exist, and I cannot see why it would exist.不。这样的功能不存在,我不明白它为什么会存在。 You are trying to do something Random Forest is not designed to do.您正在尝试做一些随机森林并非旨在做的事情。 But if you wanted to, and I don't think you should, you could generate an ND space, in this case for x1 and x2, which has all predictions and then subset the regions that are sufficiently close to the value of y.但是,如果您愿意,而且我认为您不应该这样做,您可以生成一个 ND 空间,在本例中为 x1 和 x2,它包含所有预测,然后对足够接近 y 值的区域进行子集化。

Long story short: no in most cases.长话短说:在大多数情况下不会。

Without going too much into the details, a random forest is more or less the average between several decision trees.无需过多介绍细节,随机森林或多或少是几棵决策树之间的平均值。 In most cases, it's not possible to reverse a decision tree.在大多数情况下,不可能反转决策树。 For instance in the following:例如以下:

在此处输入图像描述

If the prediction is 4.5, your original data could be any value inferior to 10.5 (eg Alcohol level=0 and Alcohol level=3 would have 4.5 as predicted value).如果预测值为 4.5,则您的原始数据可能是低于 10.5 的任何值(例如,酒精水平 = 0 和酒精水平 = 3 将具有 4.5 作为预测值)。

The only way you would be able to reverse a tree would be if you happen to create a bijection between the cartesian product of your input data and your predicted value;如果您碰巧在输入数据的笛卡尔积和预测值之间创建双射,那么您能够反转树的唯一方法是; but that would be quite seldom (and it would probably overfit)但这很少见(而且可能会过拟合)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何计算随机森林 model 的 Brier 分数? - How to calculate the Brier score for a random forest model? 如何在 R 中找到哪些预测变量对高度相关? 给定 3 个预测变量 X1、X2、X3,因变量为 Y - How to find which pairs of predictors are highly correlated in R ? Given are 3 predictors X1, X2, X3 and dependent variable is Y 如何计算 R 中随机森林回归模型的置信度 - how to calculate the confidence level for random forest regression model in R 如何计算随机森林的OOB? - How to calculate the OOB of random forest? 预测变量中不允许出现随机森林错误NA - random forest error NA not permitted in predictors Tidymodels 包:使用 ggplot() 可视化随机森林模型以显示最重要的预测变量 - Tidymodels Package: Visualising a random forest model using ggplot() to show the most important predictors 具有分类因变量的随机森林 - Random forest with categorical dependent variables 如何在具有多个预测变量的混合模型中绘制随机截距和斜率? - How to plot random intercept and slope in a mixed model with multiple predictors? 如何可视化R中的随机森林model output? - How to visualize random forest model output in R? 如何绘制随机森林模型的决策边界 - How to plot a decision boundary of random forest model
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM