hossam.my_vif_selector¶
hossam.my_vif_selector ¶
VIFSelector ¶
Bases: BaseEstimator, TransformerMixin
VIF(Variance Inflation Factor) 기반 다중공선성 제거기
fit 단계에서 결측치를 제거한 후 VIF 임계값을 초과하는 변수를 제거합니다. 반복적으로 VIF가 가장 높은 변수부터 제거합니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
VIF 임계값 (기본값: 10.0) |
10.0
|
check_cols
|
list or None
|
VIF 계산에 사용할 열 목록 (기본값: None, 모든 열 사용) |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
drop_cols_ |
list
|
제거된 열 목록 |
vif_cols_ |
list
|
VIF 계산에 사용된 열 목록 |
feature_names_in_ |
list
|
fit 시점의 입력 피처 이름 |
Example
from helpers.my_vif_selector import VIFSelector import pandas as pd X = pd.DataFrame({'a': [1, 2, 3], 'b': [2, 4, 6], 'c': [1, 1, 1]}) vif = VIFSelector(threshold=5.0) vif.fit(X) X_transformed = vif.transform(X)
get_feature_names_out ¶
get_feature_names_out(input_features=None)
drop_cols_ 를 제외한 남은 피처 이름을 반환 (set_output(transform='pandas') 지원용).