2013-11-21 6 views
1

R에서 ROCR 패키지를 사용합니다. "예측 (예측, 레이블) : 예측 형식이 잘못되었습니다."ROCR 패키지가있는 R에서 예측 형식이 잘못되었습니다.

해결 방법을 알려주십시오.

install.packages("ROCR", dependencies=TRUE) 
install.packages("vcd", dependencies=TRUE) 
library(ROCR) 
library(vcd) 
library(boot) 

setwd("/Users/Documents/R") 

presence <- read.csv("sampleAverages.csv") 
background <- read.csv("amplePredictions.csv") 
pp <- presence$Logistic.prediction    # get the column of predictions 
testpp <- pp[presence$Test.or.train=="test"]  # select only test points 
trainpp <- pp[presence$Test.or.train=="train"] # select only train points 
bb <- background$logistic 

combined <- c(testpp, bb)         # combine into a single  vector 
label <- c(rep(1,length(testpp)),rep(0,length(bb))) # labels: 1=present, 0=random 
pred <- prediction(combined, label)     # labeled predictions 
perf <- performance(pred, "tpr", "fpr")    # True/false positives, for ROC curve 
plot(perf, colorize=TRUE)         # Show the ROC curve 
performance(pred, "auc")@y.values[[1]]   # Calculate the AUC 
+0

이 데이터없이 실행하지 않을 결합. –

+0

어디서 오류가 있습니까? 데이터없이 많은 일을해야했습니다. ROCR 비 네트에는 단계별 예제 (http://rocr.bioinf.mpi-sb.mpg.de/ROCR.pdf)를 통한 좋은 단계가 있습니다. –

답변

0

는 데이터의 잘못된 클래스를 가지고 있기 때문에 될 수있다 : 여기

는 코드입니다. 이 [, 2] 또는 레이블 [, 2]

0

과 같이 예측 된 데이터를 하나의 열로 수정 해보십시오. 동일한 개체가 아닌 두 개체 (레이블 및 결합 된 개체)의 클래스를 확인하십시오. 당신은 다음 dimRid <와 다른 차원으로 하나의 서브 세트를 할 수 있습니다 - [1]

관련 문제