Exploration Data Analyis

탐색적 데이터 분석

(1) 누락/평균/표준편차/분위 등

(2) 데이터 진단

(3) 데이터 분포

(4) 아웃라이어

(5) 상관분석 및 시각화

describe(g_box)
## Warning: The `x` argument of `as_tibble.matrix()` must have column names if `.name_repair` is omitted as of tibble 2.0.0.
## Using compatibility `.name_repair`.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Warning: `cols` is now required.
## Please use `cols = c(statistic)`
diagnose(g_box)
plot_normality(g_box)

diagnose_outlier(g_box)
correlate(g_box)
plot_correlate(g_box)

Xgboost Model summary

Xgboost의 학습된 모델에 대해 요약 : 앙상블 회귀모형

수송차량의 운영기간(년) : 목적변수(Y)

수송차량의 주행거리/부대(인)/야전(인)/야전(비용)/부대(비용) : 설명변수(X)

summary(H3_bst)
##                Length Class              Mode       
## handle              1 xgb.Booster.handle externalptr
## raw            671611 -none-             raw        
## niter               1 -none-             numeric    
## evaluation_log      2 data.table         list       
## call               18 -none-             call       
## params              6 -none-             list       
## callbacks           2 -none-             list       
## feature_names       9 -none-             character  
## nfeatures           1 -none-             numeric

Model Accuracy

모델의 정확도를 3가지 기준으로 설정 R Square 값을 일반적으로 확인 함.

[R square] : https://m.blog.naver.com/tlrror9496/222055889079

MSE : 회귀 모델의 주요 손실함수,예측값과 실제값의 차이인 오차들의 제곱 평균으로 정의

RMSE : MES에 root를 씌운 값

MAE : 실제값과 예측값의 차이인 오차들의 절댓값 평균

R-squared : 분산기반 예측 성능 평가 , 다른 MAE, MSE 등과 같은 지표들는 데이터의 scale에 따라 값이 다르지만 R2은 상대적인 성능이 어느정도인지 직관적으로 판단 가능

##      RMSE  Rsquared       MAE 
## 3.0771042 0.1008936 2.0221883

Redidual

모델의 예측값과 실측값을 차이를 나타냄

잔차(Redidual) 값이 클 수록 예측값의 오차가 큼

Fit Plots

Importance Model

목적벽수인 운행기간 학습모델의 설명변수(주행거리 외) 중요도를 산출

Feature Impact Summary

설명변수의 영향도(음수 양수)를 실제 수치(크고 적음) 별로 요약

Feature Pattern, Group 2, Focus 100EA

설명변수의 영향도를 2개의 그룹으로 구분하여 패턴을 비교

그룹핑 된 결과를 토대로 비교 분석이 가능함(차후 요건에 따른 상세 분석시 활용)

## The SHAP values of the Rest 4 features were summed into variable 'rest_variables'.
## Data has N = 1556 | zoom in length is 150 at location 1100.

Interaction effect plot

각 설명 변수의 실제 값의 따른 모델 영향도 트렌드 분석

예를들어 실제 주행거리가 클 경우 운영기간이 줄어듬

## `geom_smooth()` using formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 1.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 8.2468e-031
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1.01

## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 2.5e-005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## 외부 함수 호출시 NA/NaN/Inf가 있습니다 (인자 5)

## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 1.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1.6518e-030
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1.01

## `geom_smooth()` using formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 2.5e-005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## 외부 함수 호출시 NA/NaN/Inf가 있습니다 (인자 5)

Tree plot

의사결정트리를 통해 설병 변수의 조합에 따른 영향도 확인이 가능