본문 바로가기

분류 전체보기

(7)
[AI-7] 통계, t-test, One-way ANOVA, chi-square test 통계적 의사결정 - 어떤 사건이 우연히 발생할 확률을 묻는 것으로 시작하는 것 통계의 본질 - 분산의 마법 자료의 대표값 - 자료의 대표적인 특징 - 평균, 중간값, 최빈값, 표준편차(분산), 구간, 최소값, 최대값... 평균의 의미와 특징 - 자료의 중심값으로서 자료의 특성을 대표하는 값 - 모든 자료로부터 영향을 받는다.(아웃라이어에 취약하다.) - 분산(표준편차)의 계산 등 통계 분석의 대표적인 값으로 사용 분산 - 자료(데이터)가 평균값을 중심으로 퍼져있는 평균적인 거리 - 제곱합/자유도 = 제곱합의 평균 p-값(p-value, probability value)이란? - 확률값 - 어떤 사건이 우연히 발생할 확률 - p-값이 0.05보다 작다는 것은 어떤 사건이 우연히 발생할 확률이 5%보다 작다..
[AI-6] DataFrame에서 데이터 선택하기 DataFrame이 마냥 Python의 List와 같은 것이라고 생각했다. DataFrame을 DataFrame답게 이용하기 위해서 차이점 위주로 정리한다. DataFrame 데이터 선택 방법 - 인덱스를 명시적으로 지정해 준 경우 import pandas as pd df = pd.DataFrame([1,2,3,4,5,6,7,8,9,10],index=['a','b','c','d','e','f','g','h','i','j']) print(df[4:7]) 0 e 5 f 6 g 7 print(df['e':'h']) 0 e 5 f 6 g 7 h 8 - loc, iloc -- loc : is primarily label based -- iloc : is primarily integer position based ..
[AI-5] DataFrame Conditioning, Reshaping Conditioning # 데이터프레임 필터링 # 필터링 조건 (Condition) 설정 condition = (df['순이익률'] > 0) # 컨디션의 값이 True에 해당하는 부분의 데이터만 선택 df_subset = df[condition] # '&'와 '|' 사용하여 여러개 condition 설정 condition2 = ((df['순이익률] > 0) & (df['순이익률'] < 10)) df_subset2 = df[condition2] # 범주형(categorical) 데이터의 conditioning df_subset3 = df[df['테마'].isin(['주류'])] # 범주형(categorical) 데이터의 conditioning df_subset4 = df[(df['테마'] == '주류')]..
[AI-4] Python List Comprehensions Python List Comprehensions nums = [1, 2, 3, 4] result = [x*x for x in nums] # result == [1, 4, 9, 16] result = [x*x for x in nums if x % 2 == 0] # result = [4, 16] list(map(lambda x : x*x, nums)) # [1, 4, 9, 16] list(map(lambda x : x*x, filter(lambda x : x % 2 == 0, nums))) # [4, 16]
[AI-3] Feature Engineering, DataFrame, NaN, 문자를 숫자로 바꾸는 프로세스 Feature Engineering https://youtu.be/pYVScuY-GPk - very important process in the field of data analysis and machine learning - data scientists spend most of their time on data cleaning
[AI-2] matplotlib 한글 깨짐 현상, matplotlib 화질 설정 matplotlib 한글 깨짐 현상 import matplotlib as mpl import warnings # 폰트 변환 # Windows mpl.rc("font", family='Malgun Gothic') # MacOS # mpl.rc("font", family='AppleGothic') # 마이너스 사인 수정 mpl.rc('axes', unicode_minus=False) warnings.filterwarnings("ignore") %matplotlib inline matplotlib 화질 설정 import matplotlib as mpl # 첫번째 방법 %config InlineBackend.figure_format='retina' # 두번째 방법 from IPython.display impor..
[AI-1] Git, EDA, Markdown, 데이터셋 불러오기 Git https://youtu.be/Bd35Ze7-dIw 1. 버전 관리 2. 협업 $ cd (폴더 디렉토리) $ git init $ git add -A $ git commit -m "(작업수행 내용)" - 이제까지 박제 내역 확인 $ git logs - 박제됐던 과거의 상태로 복원 $ git reset --hard (3r8da0) - 분기 $ git branch "(브랜치명)" - 메인 브랜치에 머지 $ git merge "(브랜치명)" Github - 저장되는 공간을 제공하는 서비스 - repository를 fork -- repository는 git에서 폴더를 뜻하는 단어 -- fork는 해당 repo(폴더와 파일들)를 개인 github repo로 복사하는 것 EDA(Exploratory Data ..