엘라스틱넷으로 감정 사전 만들기
엘라스틱넷 회귀분석
set.seed(12345)
res.elastic <- cv.glmnet(X, Y, family = "binomial", alpha = .5,
nfolds = 4, type.measure="class")
엘라스틱넷 회귀분석 결과 그래프
plot(res.elastic)
plot(res.elastic$glmnet.fit, xvar = "lambda")
엘라스틱넷 회귀분석 결과 및 회귀계수 정렬하기
coef.elastic <- coef(res.elastic, s = "lambda.min")[,1]
pos.elastic <- coef.elastic[coef.elastic > 0]
neg.elastic <- coef.elastic[coef.elastic < 0]
pos.elastic <- sort(pos.elastic, decreasing = T)
neg.elastic <- sort(neg.elastic, decreasing = F)