Validation

check_xgb_model_type

Check xgb_model type.

check_xgb_model_learner

Check that xgb_model is built with tree learners.

check_xgb_params

Check values of xgboost model parameters.

check_data

Check that input data X is a numpy array.

check_interaction_order

Check that interaction_order is 1 or 2.

check_interaction_list

Check that interaction_list is a numpy array of integer pairs.

check_depth_variable

Check that depth_variable is None or positive integer.

sample_data

Sample data from an analytical model.

eta_main

Compute main effect for the analytical example.

eta_order2

Compute interactions for the analytical example.

treehfd.validation.check_xgb_model_type(xgb_model: XGBModel) None

Check xgb_model type.

Check that xgb_model is a xgboost model for regression or classification, respectively of type xgboost.sklearn.XGBRegressor or xgboost.sklearn.XGBClassifier, built with the scikit-learn interface of the xgboost package.

treehfd.validation.check_xgb_model_learner(config: dict) None

Check that xgb_model is built with tree learners.

treehfd.validation.check_xgb_params(max_depth: int, n_estimators: int, num_parallel_tree: int, num_target: int) None

Check values of xgboost model parameters.

treehfd.validation.check_data(X: ndarray, name: str, num_feature: int) None

Check that input data X is a numpy array.

treehfd.validation.check_interaction_order(interaction_order: int) None

Check that interaction_order is 1 or 2.

treehfd.validation.check_interaction_list(interaction_list: ndarray | None) None

Check that interaction_list is a numpy array of integer pairs.

treehfd.validation.check_depth_variable(depth_variable: int | None) None

Check that depth_variable is None or positive integer.

treehfd.validation.sample_data(nsample: int) tuple

Sample data from an analytical model.

Data is sampled from a specific example with Gaussian inputs and a regression function defined from a mix of linear an sinusoidal functions with second-order interactions.

treehfd.validation.eta_main(x: ndarray, rho: float) ndarray

Compute main effect for the analytical example.

treehfd.validation.eta_order2(x: ndarray, z: ndarray, rho: float) ndarray

Compute interactions for the analytical example.