머신러닝(Machine Learning) 입문: 타이타닉 생존자 예측 문제로 배우는 ML 기초
머신러닝 소개 머신러닝, ML 엔지니어가 하는 일 머신러닝(Machine Learning)은 인공지능(AI)의 한 분야로, 컴퓨터가 데이터로부터 스스로 학습하여 패턴을 인식하고 예측을 수행할 수 있게 해주는 기술입니다. 전통적인 프로그래밍 방식은 규칙을 직접 코딩하지만, 머신러닝은 데이터로부터 규칙을 스스로 학습합니다. 이를 통해 복잡한 패턴 인식, 예측, 의사결정 등이 가능해집니다. 메일에서 스팸 메일을 찾아내는 간단한 일에서부터, 의료 분야에서는 질병 예측과 진단, 금융 분야에서는 사기 탐지, 그리고 자율주행 자동차 같은 것들이 머신러닝을 통해 이루어집니다. 머신러닝은 크게 정답이 포함된 데이타로 학습하는 지도학습, 데이타의 패턴을 스스로 찾아내는 비지도학습, 환경과 상호작용하며 보상을 최대화 하는 강화학습. 이렇게 3가지 유형으로 나눌 수 있습니다. 머신러닝 모델은 이런 학습과정을 거쳐 만들어진 규칙입니다. 입력 데이터를 받아 출력을 생성하는 함수와 같은 것입니다. 예를 들어, 스펨 메일 필터링 모델은 입력 메일의 특징을 분석하여 스펨 메일인지 아닌지를 예측하는 알고리즘입니다 머신러닝 모델을 개발하고 배포하는 ML 엔지니어는 데이터를 수집하고 분석하며, 머신러닝 모델을 만들고, 모델을 배포하여 실제 업무에 적용합니다. 데이타의 양이 커서, 데이타에 노이즈나 결측치가 있어서 어려움을 격기도 하고, A하드웨어에서 만든 모델이 B하드웨어에서 제대로 작동안하는 문제를 해결하기도 합니다. 이 글에서는 ML 엔지니어의 기본 업무인 데이터 분석과 모델 구축 과정을 타이타닉 생존자 예측 문제를 예로 들어 설명하겠습니다. 이를 통해 ML 엔지니어의 실제 업무와 그 과정에서 겪는 다양한 도전 과제들을 이해할 수 있을 것입니다. 타이타닉 문제로 시작하기 타이타닉 문제는 1912년 타이타닉 호 침몰 사고 당시의 실제 데이터를 기반으로 승객의 나이, 성별, 탑승 티켓 등급 등의 데이타로 해당 승객이 생존했는지 여부를 예측하는 것입니다. 데이터 규모가 크지 않아(12개의 컬럼, 891건의 데이터) 초보자도 다루기 쉬우며, 이진 분류(생존/비생존) 문제라 평가가 용이합니다. 또한 숫자, 범주형 등 다양한 유형의 데이터와 결측치(누락된 데이타)를 포함하고 있어, 데이터 전처리 과정을 연습할 수 있습니다. 이 문제는 기계학습 파이프라인의 전체 과정을 경험할 수 있는 대표적인 예제입니다. 일단 손으로 풀어보고, 그 다음 실제 머신러닝 모델을 만들어보도록 하겠습니다. 손(Excel)으로 하는 머신러닝 타이타닉 문제의 데이터 파일은 kaggle 에서 다운로드 받으실 수 있습니다. 회원 가입 후 파일을 다운로드 하시면 되고, train.csv 모델 훈련용으로 사용하는 데이터 파일입니다. test.csv 모델의 검증용으로 사용하는 데이터 파일입니다. gender_submission.csv kaggle 에 업로드 해 만들어진 모델을 평가하기 위한 파일입니다. 모델 구축 후 모델의 결과를 이 파일에 저장하고 업로드하면 만들어진 모델의 성능을 확인할 수 있습니다. 데이터 살펴보기 파일을 엑셀에서 열어보면 위와 같은 데이터가 있고, 각 컬럼의 의미는 아래와 같습니다. PassengerId: 승객 ID Pclass: 티켓 클래스 Name: 이름
- 김재우