2015-08-21 30 views
0

我在運行派對包時遇到問題。我確定它使用sessionInfo()加載,我可以看到party_1.0-20是一個附件包。當我嘗試運行我在互聯網上找到類似的例子:In R:派對包錯誤

cf <- cforest(dist ~ speed, data = cars) 

我得到這個錯誤:

Error in initialize(value, ...) : cannot use object of class 「integer」 in new(): class 「ExpectCovarInfluence」 does not extend that class

我試圖與其他數據集,但得到了同樣的錯誤。

+0

我得到一個錯誤,但不是一個 – rawr

+0

什麼的R版本你在跑嗎?我能夠成功運行R 3.2。此外,它看起來像cforest會遇到少數預測指標的問題 - 我需要至少5個預測指標才能讓它在沒有警告的情況下運行。 – Tchotchke

+0

'輸(汽車)',如果它不是很大。如果它很大,那麼嘗試對其中的一小部分進行子集化將有助於保留問題,這是一個可重現的例子。 –

回答

0

這裏:http://www.inside-r.org/packages/cran/party/docs/cforest他們提到「隨機預選變量數mtry,默認情況下由於技術原因固定爲值5。

這似乎用這個例子是這樣的:

library(party) 

dt = data.frame(mtcars) 

cforest(disp ~ wt, data = dt) 

# Random Forest using Conditional Inference Trees 
# 
# Number of trees: 500 
# 
# Response: disp 
# Input: wt 
# Number of observations: 32 
# 
# There were 50 or more warnings (use warnings() to see the first 50) #### see the warnings!! 


cforest(disp ~ wt+mpg+cyl+vs+gear, data = dt) 

# Random Forest using Conditional Inference Trees 
# 
# Number of trees: 500 
# 
# Response: disp 
# Inputs: wt, mpg, cyl, vs, gear 
# Number of observations: 32 

也許這將是更好的開始使用這樣的: http://www.inside-r.org/packages/cran/randomForest/docs/randomForest

+0

隨機森林包裝工作正常!但是我想使用一個只能在派對包中使用的條件重要性函數......我嘗試了建議的代碼「cforest(disp_wt + mpg + cyl + vs + gear,data = dt)」,但我仍然得到相同的錯誤。 – user3804227