1

我在 Revolution R(Package RevoScaleR)中使用 rxLogit 函数来拟合具有许多分类变量(例如 STATE-IL、FL、OH、CA、TX ..)和几个数值变量的数据的逻辑回归模型。当我尝试使用 rxPredict 函数对数据进行评分时,出现错误

INTERNAL ERROR: In rxPredict, the number of parameters does not match the number of  variables: 16 vs. 45.

我理解的一件事是,因为评分数据只有更少的类别(比如 STATE-IL 的数据)。因此提供给模型的参数数量少于模型中的变量。

我写的代码是:

winlossmodel <- rxLogit(Flag ~ price+quantity+product_group+state+mode_of_transportation+cluster, data = training_data)

winlosspredict <- rxPredict(winlossmodel, data=scoring_data,type="response",checkFactorLevels=FALSE)

这里价格和数量是连续变量。State、product_group、mode_of_transportation 和 cluster 是分类变量。我的 training_data 包含所有州的数据,但 score_data 仅包含少数州的数据。这是导致错误吗?

4

0 回答 0