[R] 데이터 표준화(정규화)

: ) YOUNG·2022년 6월 10일
1

빅분기

목록 보기
14/20

Min-Max Scaling

최소값을 0, 최대값을 1로 만드는 방법
괄호 주의


normal = function(x) {
	return ( (x - min(x) ) / ( max(x) - min(x) )  )
}

library(caret)
model <- preProcess(data = x, method = c("range"))

train <- predict(model, data)

Standardization / Z-score

평균이0, 표준편차(분산)를 1로 만드는 방법


normal = function(x) {
	return ( ( (x - mean(x) / (sd(x)) )
}

library(caret)
model <- preProcess(data = x, method = c("center", "scale))
train <- predict(model, data)

0개의 댓글