더 많은 차원으로 그리기

Julia로 시작하는 데이터 시각화

Gustavo Vieira Suñe

Data Analyst

왜 더 많은 차원인가?

  • 숨은 패턴과 추세 파악
  • 여러 변수 관계 동시 분석
  • 군집 식별
  • 명확하고 몰입감 있는 표현
  • 특징 공학
Julia로 시작하는 데이터 시각화

군집이 유지될까?

피보험자의 보험료 대 나이를 보여주는 산점도. 세 개의 뚜렷한 군집이 보입니다.

  • 자녀 수와 무관하게 이 군집이 존재할까요?
Julia로 시작하는 데이터 시각화

슬라이스 그리기

theme(:bright)

# Filter data
no_children = filter(
    row -> row.Children == 0, insurance)

# Plot a slice @df no_children scatter( :Age, :Charges, group=:Smoker, markersize=4, alpha=0.5, legend_title="Smoker") xlabel!("Age") ylabel!("Insurance Premium (USD)")

자녀가 없는 피보험자의 보험료 대 나이를 보여주는 산점도. 세 개의 뚜렷한 군집이 보입니다.

Julia로 시작하는 데이터 시각화

다른 차원 사용

theme(:bright)
@df insurance scatter(
    # Pass three columns
    :Children,
    :Age,
    :Charges,

group=:Smoker, markersize=4, alpha=0.5, legend_title="Smoker" ) # Axis labels xlabel!("Number of Children") ylabel!("Age") zlabel!("Insurance Premium (USD)")

피보험자의 보험료 대 나이와 자녀 수를 보여주는 3차원 산점도. 자녀 수가 달라도 동일한 군집 구조가 보입니다.

Julia로 시작하는 데이터 시각화

축 순서

theme(:bright)
@df insurance scatter(

# Swap :Age and :Children :Age, :Children, :Charges, group=:Smoker, markersize=4, alpha=0.5, legend_title="Smoker" ) # Axis labels xlabel!("Number of Children") ylabel!("Age") zlabel!("Insurance Premium (USD)")

Julia로 시작하는 데이터 시각화

다른 범주로 그룹화

흡연 여부로 색을 입힌, 보험 청구액 대 체질량지수 산점도.

  • 흡연 여부와 성별로 동시에 그룹화할 수 있을까요?
Julia로 시작하는 데이터 시각화

범주형 차원 추가

theme(:vibrant)

@df insurance scatter(
    :BMI,

# Pass categorical column :Sex,
:Charges, group=:Smoker, markersize=2, legend_title="Smoker", color=[:blueviolet :goldenrod1]) xlabel!("BMI") zlabel!("Insurance Premium (USD)")

흡연 여부로 색을 입힌, 보험 청구액 대 체질량지수와 성별의 3차원 산점도.

Julia로 시작하는 데이터 시각화

점 밀도 시각화

흡연 여부로 색을 입힌, 보험 청구액 대 체질량지수 산점도.

  • 점 밀도를 더 명확히 볼 수 있을까요?
Julia로 시작하는 데이터 시각화

2차원 히스토그램

# 2d histogram
@df insurance histogram2d(

:BMI, :Charges,
# Fill color scheme fillcolor=:acton,
# Fill empty bins show_empty_bins=true,
) xlabel!("Age") ylabel!("Insurance Premium (USD)")

보험 청구액과 체질량지수 분포를 보여주는 2차원 히스토그램.

Julia로 시작하는 데이터 시각화

연습해 봅시다!

Julia로 시작하는 데이터 시각화

Preparing Video For Download...