[英]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
并获得x1
和x2
的可能结果?
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.