Install & Compatibility
Where this runs
tested against v0.3.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 30.9s
py 3.11
✕ build_error
✓ 29.4s
py 3.12
✕ build_error
✓ 30.3s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 34.3s
1229MB installed
● package 1229MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
XGBSEKaplanNeighbors
✓ from xgbse import XGBSEKaplanNeighbors
✗ from xgbse.models import XGBSEKaplanNeighbors
Top-level import changed; models are directly under xgbse in recent versions.
Basic survival model with XGBSEKaplanNeighbors and concordance index evaluation.
import pandas as pd
from xgbse import XGBSEKaplanNeighbors
from xgbse.metrics import concordance_index
# sample data
df = pd.DataFrame({
'duration': [5, 8, 3, 6],
'event': [1, 1, 1, 0],
'feature1': [0.5, 0.2, 0.9, 0.4]
})
X = df[['feature1']]
y = df[['duration', 'event']]
model = XGBSEKaplanNeighbors()
model.fit(X, y)
preds = model.predict(X)
print(concordance_index(y['duration'], y['event'], preds))
Debug
Known issues
breakingAPI change in v0.3.x: model classes moved from xgbse.models to top-level xgbse. Old imports break.fixUse 'from xgbse import XGBSEKaplanNeighbors' instead of 'from xgbse.models import XGBSEKaplanNeighbors'
affects: v0.2.x -> v0.3.x
deprecatedThe function 'xgbse.metrics.compute_ci' is deprecated and will be removed in v0.4. Use 'concordance_index' from the same module.fixReplace 'compute_ci' with 'concordance_index'.
affects: v0.3.x
gotchaIf 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.fixPass y = df[['duration', 'event']] explicitly, not just multiple columns.
affects: all
Errors
Common errors & fixes
TypeError: __init__() got an unexpected keyword argument 'n_neighbors'
XGBSEKaplanNeighbors expects 'n_neighbors' during init, but if you pass it as a positional argument or misspell it, you get this error.
fixCorrect usage: model = XGBSEKaplanNeighbors(n_neighbors=100)
ImportError: cannot import name 'XGBSEKaplanNeighbors' from 'xgbse.models'
Starting from v0.3.x, models are no longer in xgbse.models but directly in xgbse.
fixUse 'from xgbse import XGBSEKaplanNeighbors'
ModuleNotFoundError: No module named 'xgbse'
Library not installed or installed in a different environment.
fixRun 'pip install xgbse' to install.
Upgrade
Version history
0.3.3latest on PyPI · released Oct 3, 2024
Audit
Dependencies
xgboostrequiredCore dependency for model training
lifelinesrequiredUsed for evaluation metrics like concordance index
numpyrequiredNumerical computations
pandasrequiredData handling
scikit-learnrequiredUtility functions