2022/07 6

Feature Importance

Feature Importance and Permutation Feature Importance reference : Feature selection : feature importance vs permutation importance Permutation feature importance(sklearn.org) The Mathematics of Decision Trees, Random Forest and Feature Importance in Scikit-learn and Spark 머신러닝의 해석 2편 - 1. 트리 기반 모델의 Feature Importance 속성 랜덤 포레스트에서의 변수 중요도(Variable Importance) 3가지 Feature Importance(변수 중요도) - 트리 기..

sklearn - classification_report()

sklearn.metrics.classification_report reference : scikit-learn.org, sklearn.metrics.classification_report, document scikit-learn.org,sklearn.metrics.f1_score, document stackoverflow, How to interpret classification report of scikit-learn?,LaSul Answered Accuracy(정확도), Recall(재현율), Precision(정밀도), 그리고 F1 Score, eunsukimme Document : sklearn.metrix.classification_report(y_true, y_pred, *, Labels=N..

pandas - corr()

df.corr(method='s') reference document : pandas.DataFrame.corr 비선형 상관관계 : 스피어만 상관계수, 켄달타우 pandas 데이터프레임 객체에 대해 corr()함수를 사용할 수 있다. corr()은 누락값을 제외하고 전체(dataframe) 컬럼들 간의 상관도를 계산한다. 계산에 사용되는 상관계수의 default값은 pearson 상관계수로, 모든 변수가 연속형이고 정규분포를 띄는 경우 사용할 수 있다. 만약 정규분포를 따르지 않는 변수가 포함되어 있다면 보편적으로 spearman 상관계수를 사용한다. spearman 상관계수는 비모수적 방법 (모수를 특정 분포로 가정하여 접근하는 방법론) 으로써 값에 순위를 매기고 순위에 대해 상관계수를 구하는 방식이다..

Kolmogorov Smirnov

Kolmogorov Smirnov reference document : scipy.stats.kstest Youtube : 파이썬을 활용한 통계분석 - (33)콜모고로프-스미르노프 검정(Kolmogorov-Smirnov Test) 많은 통계 분석 기법의 경우 표본이 정규분포를 따른다라는 가정을 전제로 한다. 따라서 데이터를 다룰 때 각 컬럼이 정규분포를 띄지 않는 것을 확인했다면 반드시 정규화를 수행해야 한다. 또한, 정규화를 수행한 뒤 정규성 검사를 통해 정규성 조건의 충족 여부를 통계적으로 검증해야 하는데, 이 때 보편적으로 사용하는 기법 중 하나가 Kolmogorov Smirnov Test이다. Kolmogorov Smirnov Test는 정규분포 뿐만 아니라 특정 분포를 따르는지 판단할 수 있는 ..

statsmodels - ols

OLS - Regression reference 선형회귀분석 및 OLS document : Ordinary Least Squares Python 기초 통계 - 회귀분석 실시하기 회귀분석은 파이썬에서 제공하는 대표적인 통계 분석 패키지 statsmodels를 불러와 간단히 사용할 수 있다. import statsmodels.api as sm model = sm.OLS(y, X) # y : 종속 변수(시리즈), X : 독립 변수 집합(데이터프레임) result = model.fit() result.summary() 혹은, 함수 식 표현을 활용할 수도 있다. import statsmodels.api as sm model = sm.OLS.from_formula('y ~ x1+x2+x3', data=df) res..

범주형/연속형 변수 조합에 따른 가설 검정 방법

1. 단일변수 1-1. 연속형 정규성 검정 One Sample T-Test(일표본 평균검정) # One Sample T-Test : ## 귀무가설 H0 - 특정 값은 집단의 평균과 다르지 않다. (H0확률 = p-value, 0.05 미만이면 기각) ## 연구가설 H1 - 특정 값은 집단의 평균과 다르다. stats.ttest_1samp(Series, value) # 집단의 평균(Series) vs 검증하고자 하는 값(value) 1-2. 범주형 비율 검정(ex. 연구가설 H1-집단 내 남녀 비율은 차이가 있다) 2. 다변수 2-1. 범주형 'X' & 연속형(정규분포) 'Y' Two Sample T-Test(이표본 평균검정), 등분산 검정(Levene Test) 등분산 검정 결과에 따라(이분산, 등분산)..

1