[TIPs](6)
-
[Machine Learning] - Tips
[Pip-Installation (Google Colab)] %%capture import sys if 'google.colab' in sys.modules: # Install packages in Colab !pip install category_encoders==2.* !pip install pandas-profiling==2.* !pip install -U scikit-learn==2.* # 필요한 pacakge이 있으면 이런 형태로 추가를 시켜주면 개별적으로 pip install 안해줘도 됨 # download 과정도 출력으로 안 뜸 [Machine Learning] A. Regression Models 1. Simple Regression # train_data, test_data 라는 data..
2021.02.14 -
[Numpy Built-in Functions]
evenly spaced values within a given interval : np.arange() np.arange(start = 0, end = 1.01, step = 0.01) # ==> returns 0 부터 1.01까지 0.01의 간격으로 다 반환 random sample from 1-D array : np.random.choice() a = [1,2,3,4,5] np.random.choice(a,size=3) # ==> 'a'라는 1-D array의 element중에서 random하게 3개 추출 concatenate arrays : np.concatenate() a = np.array([[1,2,3,4,5]]) b = np.array([[6,7,8,9,10]]) # by r..
2021.01.12 -
[Statistics] Useful Tips
[binomical distribution] # 1 나올 확률이 0.5인 사건을 500번 돌린 후 mean return np.random.binomial(n=1, p=0.5, size = 500) [t-test] coin1 = np.random.binomial(n=1, p=0.5, size = 500) coin2 = np.random.binomial(n=1, p = 0.6, size = 1000) # Two-side test # one sample t-test stats.ttest_1samp(coin1,0.5) # ==> mean == 0.5 vs mean != 0.5 # two sample t-test stats.ttest_ind(coin1,coin2) # ==> mean1 == mean2 vs mea..
2021.01.06 -
[Pandas] Useful Tips
[Slicing index of a specific column data] man_index = df[df['gender']=='man'].index.tolist() # 'gender' column 안에 'man'이라는 특정 data 전체 index를 list로 반환 [loc + groupby + count 응용] # ex1 man_survival = df.loc[man_index].groupby('survived').gender.count() # man_index 중 survived=0 과 survived=1 별로 count를 반환 # 이 때 man_survival이 list(?) 형식으로 표현되는 것 같음 # man_survival[0]은 man 중 survived=0 총 갯수 # man_surviv..
2021.01.02 -
[Visualization] - 유용한 TIP 정리
[warning 안 뜨게 하는 방법] import warnings warnings.filterwarnings("ignore") [데이터 시각화 할 때 한글 폰트 안 나온다면..?] !sudo apt-get install -y fonts-nanum !sudo fc-cache -fv !rm ~/.cache/matplotlib -rf 입력 후 엔터! 그리고 '런타임 다시 시작' 후 import matplotlib.pyplot as plt plt.rc('font', family='NanumGothic') # 기타 nanum font 써도 됨 하면 정상적으로 나오더라~ [Matplotlib] [Types] #matplotlib 정리 (수동) # errorbar plt.e..
2020.12.30 -
[Pandas Built-in Functions]
view small sample : head() & tail() # default로 처음 5개 row 출력 or head(n)로 처음 n 개 row 출력 df.head() # default로 마지막 5개 row 출력 or tail(n)로 마지막 n 개 row 출력 df.tail() view NaN : isnull() # 모든 데이터 값 중 NaN이 있으면 True, 아니면 False 반환 df.isnull() # 각 column의 NaN 개수의 합 반환 df.isnull().sum() replace NaN : fillna() # NaN값을 n으로 대체 df.fillna(n) # NaN값을 0으로 대체 df.fillna(0) : locate row : iloc[][] # specific row + spec..
2020.12.29