NLP 실습 - (2) BERT 모델 학습
지난 포스팅에서는 신문사 분류 모델링을 위해 직접 데이터를 수집한 과정과 함께 토큰화, 불용어처리와 같은 전처리 과정에 대해 소개하였습니다. 이번 글에서는 신문사 분류를 위해 이미 학습된 모델인 BERT를 활용한 모델링 코드 예시와 함께 성능에 대해 간단히 소개하겠습니다. 1. 데이터 전처리 모델 학습에 앞서 타겟변수에 대한 라벨 인코딩 및 학습-평가 데이터 셋 분리하는 작업이 필요합니다. 1.1. 라벨 인코딩 sklearn의 preprocessing 라이브러리를 활용하여 라벨 인코딩을 해주었습니다. import pandas as pd from sklearn import preprocessing ## Load data (토큰화, 불용어처리 완료) df = pd.read_csv('train_news.csv..
2023.02.02