R 언어:SMOTE 사용 중 오류 발생

1369 단어 R 언어
오류 1,"length of'dimnames'[2]array extent 와 같 지 않 음"
나의 원래 코드:
balanceData 

오류 원인 은 tibble 데이터 구 조 를 DMwR:SMOTE()에 전 송 했 기 때 문 입 니 다.as.data.frame()을 사용 하여 데 이 터 를 un-tible 화하 면 됩 니 다.수 정 된 코드 는 다음 과 같 습 니 다.
balanceData 

참고 자료:
https://stackoverflow.com/questions/38616260/smote-length-of-dimnames-2-not-equal-to-array-extent
오류 2、"T 에 오류 가 있 습 니 다[,]:subscript out of bounds 추가:경고 메시지:1:In FUN(newX[,i],...):  no non-missing arguments to max; returning -Inf 2: In FUN(newX[, i], ...) :   no non-missing arguments to max; returning -Inf 3: In FUN(newX[, i], ...) :   no non-missing arguments to max; returning -Inf 4: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf 5: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf 6: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf”
 str(as.data.frame(selecData)를 사용 하면 볼 수 있 습 니 다.
'data.frame':	141 obs. of  4 variables:
 $ status         : num  0 1 0 0 0 0 0 0 0 0 ...

status 는 num 형 입 니 다.Factor 형 으로 바 꿔 야 합 니 다.SMOTE()를 사용 하기 전에 먼저:
selecData$status = as.factor(selecData$status)

참고 자료:
https://arulvelkumar.wordpress.com/2017/04/30/smote-function-in-r-error-in-ti-subscript-out-of-bounds/

좋은 웹페이지 즐겨찾기