데이터분석/Code & Tools & Script Snippet
Error in neurons[[i]] %*% weights[[i]] : requires numeric/complex matrix/vector arguments
늘근이
2018. 4. 1. 10:41
Error in neurons[[i]] %*% weights[[i]] :
requires numeric/complex matrix/vector arguments
neuralnet package는 지시변수등을 자동적으로 변환해주지 않는다.
model.matrix등으로 변환한다.
혹은 직접 아래와 같이 함수변환을 한다.
normalize <- function(x) {(x - min(x)) / (max(x)-min(x))}
normalized_train$한국 <- normalize(as.integer(train$한국))
algorithm did not converge in 1 of 1 repetition(s) within the stepmax
너무 적은 step_max때문에 그러함.
nn <- neuralnet(f , data = normalized_train, hidden = 3, stepmax = 1e+04, threshold = 0.01, act.fct = "logistic", linear.output = F)
위의 숫자를 고친다. stepmax란, 수렴의 횟수라고 보면 된다.