{"id":23188,"library":"xgbse","title":"XGBoost Survival Embeddings","description":"xgbse improves XGBoost for survival analysis by providing debiased estimators and embedding-based feature extraction. Current version 0.3.3 supports Python >=3.9 and is released infrequently (last updated early 2024).","status":"active","version":"0.3.3","language":"python","source_language":"en","source_url":"https://github.com/loft-br/xgboost-survival-embeddings","tags":["survival-analysis","xgboost","embedding","kaplan-meier"],"install":[{"cmd":"pip install xgbse","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Core dependency for model training","package":"xgboost","optional":false},{"reason":"Used for evaluation metrics like concordance index","package":"lifelines","optional":false},{"reason":"Numerical computations","package":"numpy","optional":false},{"reason":"Data handling","package":"pandas","optional":false},{"reason":"Utility functions","package":"scikit-learn","optional":false}],"imports":[{"note":"Top-level import changed; models are directly under xgbse in recent versions.","wrong":"from xgbse.models import XGBSEKaplanNeighbors","symbol":"XGBSEKaplanNeighbors","correct":"from xgbse import XGBSEKaplanNeighbors"}],"quickstart":{"code":"import pandas as pd\nfrom xgbse import XGBSEKaplanNeighbors\nfrom xgbse.metrics import concordance_index\n\n# sample data\ndf = pd.DataFrame({\n    'duration': [5, 8, 3, 6],\n    'event': [1, 1, 1, 0],\n    'feature1': [0.5, 0.2, 0.9, 0.4]\n})\nX = df[['feature1']]\ny = df[['duration', 'event']]\n\nmodel = XGBSEKaplanNeighbors()\nmodel.fit(X, y)\npreds = model.predict(X)\nprint(concordance_index(y['duration'], y['event'], preds))","lang":"python","description":"Basic survival model with XGBSEKaplanNeighbors and concordance index evaluation."},"warnings":[{"fix":"Use 'from xgbse import XGBSEKaplanNeighbors' instead of 'from xgbse.models import XGBSEKaplanNeighbors'","message":"API change in v0.3.x: model classes moved from xgbse.models to top-level xgbse. Old imports break.","severity":"breaking","affected_versions":"v0.2.x -> v0.3.x"},{"fix":"Replace 'compute_ci' with 'concordance_index'.","message":"The function 'xgbse.metrics.compute_ci' is deprecated and will be removed in v0.4. Use 'concordance_index' from the same module.","severity":"deprecated","affected_versions":"v0.3.x"},{"fix":"Pass y = df[['duration', 'event']] explicitly, not just multiple columns.","message":"If you pass a pandas DataFrame with columns named 'duration' and 'event', xgbse expects them to be in that order. If your DataFrame has additional columns, ensure the target is correctly specified.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Correct usage: model = XGBSEKaplanNeighbors(n_neighbors=100)","cause":"XGBSEKaplanNeighbors expects 'n_neighbors' during init, but if you pass it as a positional argument or misspell it, you get this error.","error":"TypeError: __init__() got an unexpected keyword argument 'n_neighbors'"},{"fix":"Use 'from xgbse import XGBSEKaplanNeighbors'","cause":"Starting from v0.3.x, models are no longer in xgbse.models but directly in xgbse.","error":"ImportError: cannot import name 'XGBSEKaplanNeighbors' from 'xgbse.models'"},{"fix":"Run 'pip install xgbse' to install.","cause":"Library not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'xgbse'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}