2016-04-27 71 views
0

我現在正試圖在R中編寫我的第一個代碼用於機器學習。我收到了一個錯誤:在半監督算法中的R代碼中的錯誤

could not find function "rpartXse"" 

儘管已成功安裝其包DMwR。另外一個錯誤信息

Error in Species ~ Species ~ idx <- sample(150, 100) : object 'Species' not found 

雖然我已經安裝了軟件包SPECIES

+0

您是否在安裝後激活軟件包? 'library(x)'或'require(x)'其中'x'是包名稱。 –

回答

0

你的庫名應該是DMwR,而不是DWmR(剛纔編輯的問題加以糾正),它應該只是罰款。

library(DMwR) 
data(iris) 
tree <- rpartXse(Species ~ ., iris) 
tree 

n= 150 

node), split, n, loss, yval, (yprob) 
     * denotes terminal node 

1) root 150 100 setosa (0.33333333 0.33333333 0.33333333) 
    2) Petal.Length< 2.45 50 0 setosa (1.00000000 0.00000000 0.00000000) * 
    3) Petal.Length>=2.45 100 50 versicolor (0.00000000 0.50000000 0.50000000) 
    6) Petal.Width< 1.75 54 5 versicolor (0.00000000 0.90740741 0.09259259) * 
    7) Petal.Width>=1.75 46 1 virginica (0.00000000 0.02173913 0.97826087) *