2017-11-08 4 views
-1

MXM 패키지의 변수 선택에 Max-min Markov blanket 알고리즘을 사용하고 있습니다. 차원 (95933 x 85)의 지속적인 가치의 행렬 mmmb manual page 내 데이터 세트 D에 따르면Max-min Markov blanket 기능 선택 : R 코드 오류

Error in unique(as.numeric(target)) : 
(list) object cannot be coerced to type 'double' 

하고 내 target[0, 1]의 벡터입니다 :

library(MXM) 

dataset = read.table('data.txt', na.string = c("", "NA"), sep = '\t', header = FALSE) 
dataset = dataset[, colSums(is.na(dataset)) == 0] 
D = as.matrix(as.data.frame(lapply(dataset, as.numeric))) 
target = read.table('class_num.txt') 
target = c(target) 

aa = mmmb(target, D, max_k = 3, threshold = 0.05, test = "testIndFisher", user_test = NULL, robust = FALSE, ncores = 2) 

나는 다음과 같은 오류가 점점 오전 : 다음은 내 코드입니다 크기는 95933입니다.

누군가가 오류를 이해하는 데 도움을 줄 수 있습니까?

답변

0

해결책을 얻으십시오 : target은 배열 대신 목록입니다. 다음 줄이 문제를 해결했습니다.

target = array(as.numeric(unlist(target))) 

감사합니다.