Monotonic Constraint는 Prediction에 영향을 주지 않는 제약조건이다.

Monotonic Constraint는 Prediction에 영향을 주지 않는 제약조건이다.
Photo by Kristīne Zāle / Unsplash
  • +1: when the feature increases, the prediction must be greater or equal;
  • 0: no monotonic constraint (default);
  • -1: when the feature increases, the prediction must be smaller or equal.
  • Python Code 예
decision_tree_with_constraints = DecisionTreeRegressor(  
max_depth=3,  
min_samples_leaf=10,  
monotonic_cst=[1,1] # this line of code adds monotonic constraints  
)  
  
decision_tree_with_constraints.fit(X_train, y_train)
catboost = CatBoostRegressor(  
silent=True   )  
  
catboost_with_constraints = CatBoostRegressor(  
silent=True,  
monotone_constraints={"square feet": 1, "overall condition": 1}   )

  • We can use CatBoost to simulate what-if scenarios. For example: what happens if we change the “overall condition” of houses with a square footage of respectively 500, 1,000, 2,000, or 3,000?
  • This is also called sensitivity analysis because it measures the sensitivity of an outcome (the selling price predicted by our model) based on a change in an input variable (the house’s overall condition).

References

Read more

DataFrame은 Pandera로, 모델은 Pydantic으로 데이터를 검증한다.

DataFrame은 Pandera로, 모델은 Pydantic으로 데이터를 검증한다.

Pandera: 데이터프레임 검증에 최적화된 도구 주요 장점 * Pandas와 통합: Pandas 데이터프레임에 대해 스키마 기반 검증을 수행합니다. * 유연한 검증 조건: 열 데이터 타입, 값 범위, Null 여부 등 다양한 검증 조건을 정의할 수 있습니다. * 명확한 오류 메시지: 스키마 불일치에 대한 명확한 오류 메시지를 제공합니다. 단점 * 대용량 데이터 검증에서는 속도가 느릴 수

Tobit Regression은 Censored Data에 적합한 Regression이다.

Tobit Regression은 Censored Data에 적합한 Regression이다.

Tobit Regression * Tobit 회귀(Tobit Regression)는 종속 변수가 특정 값에서 절단(Censored)된 상황에서 데이터를 분석하기 위해 사용되는 통계 기법입니다. * James Tobin이 처음 제안한 이 모델은 경제학과 사회과학 분야에서 자주 사용되며, 일반 선형 회귀로는 설명할 수 없는 상황에서 효과적으로 적용할 수 있습니다. Tobit Regression 수식 1. 관측된 종속 변수