Skip to content

First-practice/lg-kaggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

LG 제품 에러 예측 프로젝트

LG 제품의 에러 로그 데이터를 분석하여 문제(고장) 발생 여부를 예측하는 이진 분류 Kaggle 대회 프로젝트입니다.

📋 프로젝트 개요

목표: 제품의 에러 로그 및 품질 데이터를 기반으로 문제 발생 여부를 예측 (이진 분류)

데이터 구성:

  • train_err_data.csv: 학습 데이터의 에러 로그 (user_id, model_nm, fwver, errtype, errcode 등)
  • test_err_data.csv: 테스트 데이터의 에러 로그
  • train_problem_data.csv: 학습 데이터의 문제 발생 정보 (target)
  • train_quality_data.csv: 학습 데이터의 품질 지표 (quality_0 ~ quality_12)
  • test_quality_data.csv: 테스트 데이터의 품질 지표

🗂️ 프로젝트 구조

lg-kaggle/
├── notebooks/
│   ├── 1_preprocessing/          # 데이터 전처리
│   │   ├── errtype_preprocessing.ipynb
│   │   ├── errcode_preprocessing.ipynb
│   │   ├── train_quality_preprocessing.ipynb
│   │   ├── test_quality_preprocessing.ipynb
│   │   └── target_generation.ipynb
│   │
│   ├── 2_eda/                    # 탐색적 데이터 분석
│   │   └── errcode_analysis.ipynb
│   │
│   ├── 3_modeling/               # 모델링
│   │   └── main_pipeline.ipynb
│   │
│   └── archive/                  # 구버전 노트북 보관
│
├── data/
│   └── processed/                # 전처리된 데이터
│       ├── err_group_ID_train.csv
│       └── err_group_ID_test.csv
│
└── README.md

🔄 워크플로우

1️⃣ 데이터 전처리 단계

Errtype 전처리 (errtype_preprocessing.ipynb)

  • user_id + model_nm + fwver 기준으로 그룹화
  • 각 그룹별 errtype 빈도 계산 (One-Hot Encoding)
  • 41개 errtype 변수 생성
  • time_min, time_max 추가 (시간 범위 정의)

Errcode 전처리 (errcode_preprocessing.ipynb)

  • 상위 30개 errcode 선별 (빈도 기준)
  • 나머지 errcode는 'other'로 통합
  • 그룹별 errcode 빈도 계산 (One-Hot Encoding)
  • 30개 errcode 변수 생성

Quality 전처리 (train/test_quality_preprocessing.ipynb)

  • quality_0 ~ quality_12 변수 처리
  • 방법 1: -1 값을 0으로 치환 후 그룹별 중앙값(median) 계산
  • 방법 2: -1 개수를 별도 변수로 카운트 (quality_X_minus)
  • user_id + fwver 기준 집계

Target 생성 (target_generation.ipynb)

  • time_min ~ time_max 범위 내 problem 발생 시 target=1
  • 그 외 target=0 (이진 분류)
  • user_id별 중복 제거

2️⃣ 탐색적 데이터 분석 (EDA)

Errcode 경향 분석 (errcode_analysis.ipynb)

  • Train vs Test의 errcode 분포 비교
  • 특정 errcode ('connectionterminated by local host')의 차이 분석
  • 시각화를 통한 패턴 파악

3️⃣ 모델링

Main Pipeline (main_pipeline.ipynb)

  • 전처리된 데이터 통합
  • Feature Engineering
  • LGBMClassifier 모델링
  • 예측 및 제출 파일 생성

🔑 주요 Feature Engineering

  1. Errtype 빈도 변수: 41개 errtype의 발생 빈도
  2. Errcode Top30 변수: 상위 30개 errcode의 발생 빈도
  3. Quality 변수: 13개 품질 지표 (중앙값 및 결측(-1) 개수)
  4. 시간 범위 변수: time_min, time_max
  5. 그룹 변수: user_id, model_nm, fwver 조합

🛠️ 사용 기술

  • 언어: Python
  • 주요 라이브러리:
    • pandas, numpy: 데이터 처리
    • scikit-learn: 전처리 및 모델 평가
    • LightGBM: 분류 모델
    • matplotlib, seaborn: 시각화

📊 모델

  • 알고리즘: LGBMClassifier (Light Gradient Boosting Machine)
  • Task: Binary Classification
  • 평가 지표: (대회 기준에 따름 - AUC, Accuracy 등)

🚀 실행 방법

1. 전처리 실행 (순서대로)

# 1. Errtype 전처리
jupyter notebook notebooks/1_preprocessing/errtype_preprocessing.ipynb

# 2. Errcode 전처리
jupyter notebook notebooks/1_preprocessing/errcode_preprocessing.ipynb

# 3. Quality 전처리
jupyter notebook notebooks/1_preprocessing/train_quality_preprocessing.ipynb
jupyter notebook notebooks/1_preprocessing/test_quality_preprocessing.ipynb

# 4. Target 생성
jupyter notebook notebooks/1_preprocessing/target_generation.ipynb

2. 모델 학습 및 예측

jupyter notebook notebooks/3_modeling/main_pipeline.ipynb

📝 참고사항

  • fwver와 model_nm: 1:1 매핑 관계 확인됨
  • Errcode 경향: Train과 Test에서 일부 errcode의 분포 차이 존재
  • Quality 변수: -1은 결측값으로 추정, 두 가지 방식으로 처리 (중앙값 대체 vs 개수 카운트)
  • 시간 범위: time_min ~ time_max 사이에 problem이 발생하면 target=1

📂 Archive

notebooks/archive/ 폴더에는 프로젝트 개발 과정의 구버전 노트북들이 보관되어 있습니다:

  • Main Project.ipynb (초기 버전)
  • Main Project_1.0.ipynb
  • Main Project_1.1.ipynb
  • 01_16.ipynb (실험용)
  • Untitled8.ipynb (실험용)

Last Updated: 2025-11-10

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors