전체 글 42

Pandas) 두 칼럼 이상 이용하여 함수 apply할 때 간단히 하는 법

이렇게 써도 되는지는 몰랐다 보기 깔끔한 듯! df['col_3'] = df[['col_1','col_2']].apply(lambda x: f(*x), axis=1) 이렇게 쓸줄만 알았었음 df['col_3'] = df.apply(lambda x: f(x['col 1'], x['col 2']), axis=1) * Reference https://stackoverflow.com/questions/13331698/how-to-apply-a-function-to-two-columns-of-pandas-dataframe How to apply a function to two columns of Pandas dataframe Suppose I have a df which has columns of 'ID', 'c..

Data Science 2022.01.25

딥러닝(자연어처리) 꼭 알아야 할 추천 논문 목록

이종희 선생님께 추천받았다. 엄선 감사합니다. 1. ResNet(2015) - https://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/He_Deep_Residual_Learning_CVPR_2016_paper.pdf 2. Batch Normalization(2015) - https://arxiv.org/abs/1502.03167 3. BiLSTM(2015) - https://arxiv.org/abs/1508.01991 4. Word2Vec(2013) - https://arxiv.org/abs/1301.3781 5. FastText(2016) - https://arxiv.org/abs/1607.04606 6. Seq2Seq(2014) - htt..

Data Science 2022.01.21

220120-21)분산, 표준편차, 공분산, 상관관계, MSE, 사분위수, 이상치, 데이터정규화

* 실습코드 내용이 많아서 다시 정리할 것. * 참고자료 - 자유도 n-1 에 대한 이야기 https://m.blog.naver.com/sw4r/221021838997 왜 표본(샘플)의 분산에서는 n이 아닌 n-1로 나눌까? 아마도 통계에 아주 조금이라도 공부해본 사람이라면 이런 질문을 한번쯤은 해봤을 것으로 생각된다. 그런... blog.naver.com - 이 블로그 좋은 거 같다!

Data Science 2022.01.20

220120) 혼동행렬(Confusion Matrix) & ROC AUC Score

분류 결과 confusion matrix ROC curve (Receiver Operating Characteristic curve) : FPR과 TPR을 각각 x,y축으로 놓은 그래프. ROC curve는 X,Y가 둘다 [0,1]의 범위이고, (0,0) 에서 (1,1)을 잇는 곡선이다. - ROC 커브는 그 면적이 1에 가까울수록 (즉 왼쪽위 꼭지점에 다가갈수록) 좋은 성능이다. 그리고 이 면적은 항상 0.5~1의 범위를 갖는다.(0.5이면 랜덤에 가까운 성능, 1이면 최고의 성능) - TPR : True Positive Rate (=민감도, true accept rate) 1인 케이스에 대해 1로 잘 예측한 비율.(암환자를 진찰해서 암이라고 진단 함) - FPR : False Positive Rate..

Data Science 2022.01.20

220119) breast cancer data로 xgboost 실습

xgboost란? https://xgboost.readthedocs.io/en/stable/ XGBoost Documentation — xgboost 1.5.2 documentation xgboost.readthedocs.io document를 읽어보면 좋을 거 같다! (부스팅 방식이 뭔지도 잘 안 와닿아서 복습 필요..) 아무튼, 실습 code는 여기에 https://github.com/nojiyoon/SeSAC_code/blob/main/1%EC%9B%9419%EC%9D%BC_XGBoost_%EC%88%98%EC%97%85%EB%82%B4%EC%9A%A9.ipynb GitHub - nojiyoon/SeSAC_code: 강의 code 강의 code. Contribute to nojiyoon/SeSAC_..

Data Science 2022.01.19

구글 코랩 런타임 연결 유지 (Google Colab)

개발자 도구(F12)를 열어 콘솔에 입력 function ClickConnect(){ console.log("1분마다 코랩 연결 끊김 방지"); document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect-icon") .click(); } setInterval(ClickConnect, 1000 * 60); 안해놓으면,, 끊겨서 귀찮다.. 엥! 근데 이게 안먹혀서 다시 찾아본결과 function ClickConnect(){ console.log("Working"); document.querySelector("colab-toolbar-button").click() }setInterval(Click..

IT 2022.01.19

220118) Random Forest Classifier 성능평가

https://horangcat.tistory.com/14 220117) Iris data로 Random Forest 실습 * load_iris 데이터셋 - petal length, petal width, sepal length, sepal width에 따라 세 종류로 나눌 수 있다. 데이터 로드 from sklearn.datasets import load_iris load_iris() # 붓꽃 데이터 리턴 - dict i.. horangcat.tistory.com 여기에서 이어집니다. from sklearn.metrics import accuracy_score print('정확도:', accuracy_score(y_test, prediction1)) >> 정확도: 0.9333333333333333 fr..

Data Science 2022.01.18

Random Forest Classifier, 전에 몰랐던 것들

https://wyatt37.tistory.com/9 지니(Gini) vs 엔트로피(Entropy) 그리고 정보 이득량(Information Gain) 안녕하세요, 끙정입니다. 오늘은 Tree Based Method에서 파티션(노드)을 분할할 때 기준으로 쓰이는 두 가지 측정방법, Gini(지니)와 Entropy(엔트로피)를 알아보겠습니다. 그리고 추가로 Information Gain(정 wyatt37.tistory.com Information Gain 이 뭔지 몰랐음. - 이걸로 컬럼 중요도(feature_importances_) 계산 - 컬럼 중요도는 0~1 사이 값 가짐 - 원래 Gini 높았는데(막섞여있음) 이 컬럼 값으로 분류하니까 Gini 낮아짐(잘 분류)일 때 Information Gain ..

Data Science 2022.01.18

220117) Iris data로 Random Forest 실습

* load_iris 데이터셋 - petal length, petal width, sepal length, sepal width에 따라 세 종류로 나눌 수 있다. 데이터 로드 from sklearn.datasets import load_iris load_iris() # 붓꽃 데이터 리턴 - dict ir_dic = load_iris() X = ir_dic['data'] # 독립변수 저장 y = ir_dic.target # 종속변수 저장 Random Forest Classifier 학습 from sklearn.ensemble import RandomForestClassifier rfc = RandomForestClassifier(n_estimators=10) # 10개의 Decision Tree를 만들 객..

Data Science 2022.01.17