ROC Curve와 AUC
·
AI/데이터 분석과 모델 학습
ROC Curve는 이진 분류 모델의 임계값(threshold)을 변화시켜가며 모델의 민감도/재현율(TPR : True Positive Rate)와 오탐률(FPR : False Positive Rate)를 시각화한 그래프. AUC는 ROC 곡선 아래 영역의 넓이를 의미 ROC : Receiver Operating CharacteristicAUC : Area Under the Curve AUC가 1에 가까울수록 좋은 모델.
[데이터 분석] Pandas Cheeting Sheet : 데이터(DataFrame) 전처리
·
AI/데이터 분석과 모델 학습
필자가 전처리하다가 함수 몰라서 구글링 했으면 여기에 추가함 DataFrame 입출력 # CSV 파일 읽기 df = pd.read_csv('file.csv') # Excel 파일 읽기 df = pd.read_excel('file.xlsx') # CSV 파일로 저장 df.to_csv('output.csv', index=False) # index를 False로 설정하여 인덱스를 저장하지 않음 # Excel 파일로 저장 df.to_excel('example.xlsx', index=False) # index=False를 설정하여 인덱스를 저장하지 않습니다. 열 순서 바꾸기 # 예제 DataFrame 생성 data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30,..
5. 데이터 전처리의 모든 것 : 결측치 처리 (확인, 제거, 대체)
·
AI/데이터 분석과 모델 학습
import pandas as pd # 예제 DataFrame 생성 data = {'A': [1, 2, None, 4], 'B': [5, None, 7, 8], 'C': [9, 10, 11, 12]} df = pd.DataFrame(data) # 결측치가 있는 행 제거 df_cleaned_rows = df.dropna(axis=0) # 결측치가 있는 열 제거 df_cleaned_cols = df.dropna(axis=1) # 결측치가 있는 행 제거 결과 출력, 결과1 print("원본 데이터:\n", df) print("\n결측치가 제거된 데이터:\n", df_cleaned_rows) # 결측치가 있는 행 제거 결과 출력, 결과2 print("원본 데이터:\n", df) print("\n결측치가 제거된 ..
5. 데이터 전처리의 모든 것 : DataFrame 파일 입출력
·
AI/데이터 분석과 모델 학습
1. 파일 입출력 Pandas는 다양한 형식의 파일을 읽고, 쓸 수 있습니다. 대표적인 파일 형식으로는 CSV, Excel, JSON, SQL 등이 있습니다. (Pandas 공식 User Guide 2.2 기준) Format Type Data 형태 불러오는 함수 (읽기) 내보내기 함수 (쓰기) text CSV read_csv to_csv text Fixed-Width Text File read_fwf text JSON read_json to_json text HTML read_html to_html text LaTeX Styler.to_latex text XML read_xml to_xml text Local clipboard read_clipboard to_clipboard binary MS Excel..