{"id":24579,"library":"shap-hypetune","title":"shap-hypetune","description":"A Python package for simultaneous hyperparameters tuning and feature selection for gradient boosting models (LightGBM, XGBoost, CatBoost, Random Forest). Current version: 0.2.7. Release cadence: occasional, last release Jun 2023.","status":"active","version":"0.2.7","language":"python","source_language":"en","source_url":"https://github.com/cerlymarco/shap-hypetune","tags":["feature-selection","hyperparameter-tuning","gradient-boosting","shap","machine-learning"],"install":[{"cmd":"pip install shap-hypetune","lang":"bash","label":"Default"}],"dependencies":[{"reason":"Core numerical dependency","package":"numpy","optional":false},{"reason":"Data structure for input features","package":"pandas","optional":false},{"reason":"Base estimator and compatibility","package":"scikit-learn","optional":false},{"reason":"SHAP importance for feature selection","package":"shap","optional":false},{"reason":"One of the supported gradient boosting engines","package":"lightgbm","optional":true},{"reason":"One of the supported gradient boosting engines","package":"xgboost","optional":true},{"reason":"One of the supported gradient boosting engines","package":"catboost","optional":true},{"reason":"Alternative tuning method (used with hyperopt=True)","package":"hyperopt","optional":true}],"imports":[{"note":"RFA was added in v0.2.4 but the class is actually named BoostingRFA; importing just 'RFA' fails","wrong":"from shap_hypetune import RFA","symbol":"BoostingRFA","correct":"from shap_hypetune import BoostingRFA"},{"note":"Top-level import works; no submodule needed","wrong":"from shap_hypetune.rfe import BoostingRFE","symbol":"BoostingRFE","correct":"from shap_hypetune import BoostingRFE"},{"note":"","wrong":"","symbol":"BoostingRFECV","correct":"from shap_hypetune import BoostingRFECV"},{"note":"Top-level import is correct; submodule not directly exposed","wrong":"from shap_hypetune.selector import BoostingSelector","symbol":"BoostingSelector","correct":"from shap_hypetune import BoostingSelector"}],"quickstart":{"code":"import pandas as pd\nfrom sklearn.datasets import make_classification\nfrom sklearn.model_selection import train_test_split\nfrom shap_hypetune import BoostingRFA\n\nX, y = make_classification(n_samples=100, n_features=20, random_state=0)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)\n\nmodel = BoostingRFA(estimator='lgbm', n_iter=5, early_stopping_rounds=10, random_state=0)\nmodel.fit(X_train, y_train)\nprint('Train accuracy:', model.score(X_train, y_train))\nprint('Selected features:', model.get_support())\n","lang":"python","description":"Basic usage: perform recursive feature addition with hyperparameter tuning using LightGBM. Note: estimator can be 'lgbm', 'xgb', 'catboost', or 'rf' (Random Forest, added in v0.2.4)."},"warnings":[{"fix":"Upgrade to v0.2.7 or cast numpy types explicitly.","message":"In v0.2.7, numpy types np.bool, np.int, np.float were replaced by native Python types. If you rely on exact numpy dtypes in model outputs, upgrade numpy to >=1.20 and check your custom callbacks.","severity":"breaking","affected_versions":"<=0.2.6"},{"fix":"Use at least 10-20 iterations for tuning; increase if using hyperopt=True.","message":"The 'n_iter' parameter controls both tuning and feature selection iterations; setting it too low may result in poor convergence. In BoostingRFA and BoostingRFE, n_iter is the total number of trials (if hyperopt=True) or grid points (if grid=True).","severity":"gotcha","affected_versions":"all"},{"fix":"Use only LightGBM, XGBoost, CatBoost, or Random Forest as the base estimator, or ensure custom estimator has the attribute.","message":"Feature selection methods (RFA, RFE) require a fitted model with feature importance; if you pass a custom estimator that does not provide 'feature_importances_', it will raise an error.","severity":"gotcha","affected_versions":"all"},{"fix":"Stick to string names for now; if you need a custom estimator, test thoroughly.","message":"Usage of 'estimator' parameter as a string (e.g., 'lgbm') is stable, but passing a scikit-learn estimator object is experimental and may break in future versions.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"pip install shap-hypetune","cause":"Library not installed or wrong Python environment.","error":"ModuleNotFoundError: No module named 'shap_hypetune'"},{"fix":"Upgrade to shap-hypetune>=0.2.6: pip install --upgrade shap-hypetune","cause":"Using version older than 0.2.6 where get_support() was added.","error":"AttributeError: 'BoostingRFA' object has no attribute 'get_support'"},{"fix":"Use one of the supported strings: 'lgbm', 'xgb', 'catboost', 'rf' (for Random Forest).","cause":"Passed an estimator string that is not recognized or a custom object incorrectly formatted.","error":"ValueError: The estimator should be a string among 'lgbm', 'xgb', 'catboost', 'rf'"},{"fix":"Use: from shap_hypetune import BoostingRFA","cause":"Trying to import the old alias 'RFA' which was renamed to 'BoostingRFA'.","error":"ImportError: cannot import name 'RFA' from 'shap_hypetune'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}