DataScience
article thumbnail
728x90

 

basic1.csv
0.00MB

1. 주어진 데이터에서 20세 이상의 데이터 추출한 후, 'f1'컬럼을 결측치를 최빈값으로 채운 후,  f1 컬럼의 여-존슨과 박스콕스 변환 값을 구하고, 두 값의 차이를 절대값으로 구한다음 모두 더해 소수점 둘째 자리까지 출력(반올림)하시오

<r />
library(dplyr) library(caret) df=read.csv('../input/bigdatacertificationkr/basic1.csv') df1<-df%>%filter(age>=20) %>%mutate(pre_f1=ifelse(is.na(f1),as.numeric(names(which.max(table(f1)))),f1)) yeo<-preProcess(df1,c("YeoJohnson","scale","center")) bxcx<-preProcess(df1,c("BoxCox","scale","center")) tr_y<-(predict(yeo,df1))$pre_f1 tr_b<-(predict(bxcx,df1))$pre_f1 round(sum(abs(tr_y-tr_b)),2) #정답 : 0.6

 

2. 암기

preProcess(전체데이터프레임,method)

                    method=("BoxCox", "YeoJohnson", "expoTrans", "center", "scale", "range")

profile

DataScience

@Ninestar

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!