- 클러스터링을 사용해 보고 싶어 클러스터링을 이용할 수 있는 데이터 셋을 한번 찾아보려고 함
- 스포티파이 데이터셋 (클러스터링에 적합한 데이터 셋이 아님)
- 기상청 데이터셋 / 습도, 기온, 일조일사와 강수량 사이에 유의미한 연관 관계를 뽑아 낼 수 있을 것으로 추정
-
기상청 데이터 시각화
-
데이터 병합
- 기온, 습도, 일조일사 데이터가 다른 csv 파일에 나누어져 있어서 데이터셋을 날짜를 기준으로 머지
-
3차원 시각화
matplotlib라이브러리를 이용해 평균 습도, 총 자외선 양, 평균 온도를 3차원에 시각화
-
KMeans 클러스터링
sklearn라이브러리를 이용해 KMeans 기법으로 클러스터링 진행
-
강수량 데이터 병합
- 강수량 데이터셋을 클러스터링 값이 있는 데이터 셋에 병합
- 강수량 값이 비어있으면 0을 넣음
- 강수량 값이 0이면 0을, 0보다 크면 1을 넣어 비가 왔는지 확인하는 열을 만듬
- 강수량 데이터셋을 클러스터링 값이 있는 데이터 셋에 병합
-
결과 분석
k=3으로 설정하여 클러스터링 진행- 결과
- 0번 영역 비올 확률: 90%
- 1번 영역 비올 확률: 10%
- 2번 영역 비올 확률: 45%
- 결과
The following text was originally written in Korean and then translated into English.
- Wanted to experiment with clustering, so I started looking for a dataset that would be suitable for clustering analysis.
- Considered using the Spotify dataset but found it unsuitable for clustering.
- Decided on the meteorological dataset, anticipating the potential to extract meaningful relationships between humidity, temperature, solar radiation, and precipitation.
-
Visualization of Meteorological Data
-
Data Merging
- Since the temperature, humidity, and solar radiation data were stored in separate CSV files, merged these datasets based on dates.
-
3D Visualization
- Visualized average humidity, total UV exposure, and average temperature in 3D using the
matplotliblibrary.
- Visualized average humidity, total UV exposure, and average temperature in 3D using the
-
KMeans Clustering
- Applied KMeans clustering using the
sklearnlibrary.- Standardized the data with
StandardScaler, setting the mean to 0 and the standard deviation to 1. - Elbow Method
- Inertia
- Measured the closeness of data points to their cluster centers, calculated as the sum of squared distances from each data point to the cluster center.
- Set the
kvalue based on the sharp drop in inertia, determining thatk=3was appropriate. - Clustering with KMeans
- Standardized the data with
- Applied KMeans clustering using the
-
Merging Precipitation Data
- Merged the precipitation dataset with the clustered dataset.
- Filled empty precipitation values with 0.
- Created a new column to indicate whether it rained (1 if precipitation > 0, 0 otherwise).
- Merged the precipitation dataset with the clustered dataset.
-
Result Analysis
- Conducted clustering analysis with
k=3.- Results
- Probability of rain in Region 0: 90%
- Probability of rain in Region 1: 10%
- Probability of rain in Region 2: 45%
- Results
- Conducted clustering analysis with






