### Install Hazardous Python Library Source: https://context7.com/soda-inria/hazardous/llms.txt This command installs the Hazardous Python library using pip. Ensure you have pip installed and accessible in your environment. ```bash pip install hazardous ``` -------------------------------- ### SurvivalBoost.predict_proba: Estimate Class Probabilities at Fixed Horizon (Python) Source: https://context7.com/soda-inria/hazardous/llms.txt This snippet demonstrates the use of the `predict_proba` method of the SurvivalBoost estimator. This method is designed to estimate class probabilities at a specific time horizon, allowing the SurvivalBoost model to be used as a scikit-learn compatible classifier. The example sets up synthetic data and splits it for training and testing. ```python from hazardous import SurvivalBoost from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=2, n_samples=2000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) ``` -------------------------------- ### SurvivalBoost.predict_survival_function: Estimate Event-Free Probability (Python) Source: https://context7.com/soda-inria/hazardous/llms.txt Illustrates how to use the `predict_survival_function` method of the SurvivalBoost estimator. This method estimates the probability of an individual remaining event-free up to specified time points, given their features. The example shows predicting survival functions for the entire time grid and at custom time points, printing sample results. ```python from hazardous import SurvivalBoost from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split import numpy as np X, y = make_synthetic_competing_weibull(n_samples=2000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) # Predict survival function S(t) = P(T > t | X) # Returns shape: (n_samples, n_times) survival_curves = model.predict_survival_function(X_test) # Predict at custom time points custom_times = np.array([100, 500, 1000, 2000, 3000]) survival_at_times = model.predict_survival_function(X_test, times=custom_times) print(f"Survival probabilities at t=100: {survival_at_times[:5, 0].round(3)}") print(f"Survival probabilities at t=3000: {survival_at_times[:5, 4].round(3)}") # Output: # Survival probabilities at t=100: [0.982 0.974 0.981 0.987 0.969] # Survival probabilities at t=3000: [0.203 0.312 0.187 0.256 0.298] ``` -------------------------------- ### Initialize and predict with SurvivalBoost Source: https://context7.com/soda-inria/hazardous/llms.txt Demonstrates how to initialize the SurvivalBoost model, fit it to survival data, and predict probabilities at specific time horizons. The time horizon can be set during initialization or dynamically at prediction time. ```python from hazardous import SurvivalBoost model = SurvivalBoost( n_iter=50, time_horizon=1500, show_progressbar=False, random_state=42 ) model.fit(X_train, y_train) # Predict probabilities proba = model.predict_proba(X_test) proba_at_2000 = model.predict_proba(X_test, time_horizon=2000) ``` -------------------------------- ### SurvivalBoost: Main Estimator for Survival Analysis and Competing Risks (Python) Source: https://context7.com/soda-inria/hazardous/llms.txt Demonstrates the usage of the SurvivalBoost estimator from the Hazardous library. It includes generating synthetic data, splitting it into training and testing sets, initializing and fitting the SurvivalBoost model with various parameters, and predicting cumulative incidence functions for all events. The output shows the shapes of the predicted survival curves and event-specific CIFs, along with a sample of the time grid. ```python import numpy as np from sklearn.model_selection import train_test_split from hazardous import SurvivalBoost from hazardous.data import make_synthetic_competing_weibull # Generate synthetic competing risks data X, y = make_synthetic_competing_weibull( n_events=3, # Number of competing event types n_samples=3000, # Number of individuals return_X_y=True, random_state=42 ) # y contains 'event' (0=censored, 1,2,3=event types) and 'duration' columns X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42) # Initialize and fit SurvivalBoost model = SurvivalBoost( n_iter=100, # Number of boosting iterations learning_rate=0.05, # Shrinkage factor max_leaf_nodes=31, # Max leaves per tree min_samples_leaf=50, # Min samples per leaf n_time_grid_steps=100, # Time grid resolution ipcw_strategy="alternating", # "alternating" or "kaplan-meier" show_progressbar=True, random_state=42 ) model.fit(X_train, y_train) # Predict cumulative incidence for all events # Returns shape: (n_samples, n_events + 1, n_times) # Index 0 = survival function, Index 1+ = cumulative incidence per event predicted_curves = model.predict_cumulative_incidence(X_test) print(f"Survival curves shape: {predicted_curves[:, 0, :].shape}") print(f"Event 1 CIF shape: {predicted_curves[:, 1, :].shape}") print(f"Time grid: {model.time_grid_[:5]}...") # Output: # Survival curves shape: (900, 100) # Event 1 CIF shape: (900, 100) # Time grid: [7.1 14.2 21.3 28.4 35.5]... ``` -------------------------------- ### Evaluate SurvivalBoost with score and cross-validation Source: https://context7.com/soda-inria/hazardous/llms.txt Shows how to compute the negative mean Integrated Brier Score (IBS) for model evaluation and how to integrate the model with scikit-learn's cross-validation utilities. ```python from sklearn.model_selection import cross_val_score # Returns negative mean IBS score = model.score(X_test, y_test) # Compatible with scikit-learn cross-validation cv_scores = cross_val_score( SurvivalBoost(n_iter=30, show_progressbar=False, random_state=42), X, y, cv=3 ) ``` -------------------------------- ### Load and preprocess SEER dataset Source: https://context7.com/soda-inria/hazardous/llms.txt Provides a utility to load and preprocess the SEER breast cancer dataset for survival analysis, allowing for custom event definitions and optional SurvTRACE-style preprocessing. ```python from hazardous.data import load_seer bunch = load_seer( input_path="/path/to/seer_data.txt", events_of_interest=("Breast", "Diseases of Heart"), censoring_labels=("Alive",), other_event_name="Other" ) ``` -------------------------------- ### Generate synthetic competing risks data Source: https://context7.com/soda-inria/hazardous/llms.txt Generates synthetic datasets with Weibull-distributed durations for testing and benchmarking survival models. Supports returning data as an (X, y) tuple or a scikit-learn style Bunch object. ```python from hazardous.data import make_synthetic_competing_weibull X, y = make_synthetic_competing_weibull( n_events=3, n_samples=5000, return_X_y=True, random_state=42 ) ``` -------------------------------- ### Validate survival analysis input data formats using check_y_survival Source: https://context7.com/soda-inria/hazardous/llms.txt Demonstrates how to use the check_y_survival function to process various input types including pandas DataFrames, dictionaries, and structured numpy arrays. The function extracts and standardizes the event and duration arrays required for survival analysis workflows. ```python import pandas as pd import numpy as np # Works with pandas DataFrame y_df = pd.DataFrame({ "event": [1, 0, 2, 1, 0], "duration": [100.5, 200.3, 150.2, 300.1, 250.4] }) event, duration = check_y_survival(y_df) print(f"From DataFrame - event: {event}, duration: {duration}") # Works with dictionary y_dict = { "event": np.array([1, 0, 2, 1, 0]), "duration": np.array([100.5, 200.3, 150.2, 300.1, 250.4]) } event, duration = check_y_survival(y_dict) print(f"From dict - event: {event}, duration: {duration}") # Works with structured numpy array y_recarray = np.array( [(1, 100.5), (0, 200.3), (2, 150.2), (1, 300.1), (0, 250.4)], dtype=[("event", "i4"), ("duration", "f8")] ) event, duration = check_y_survival(y_recarray) print(f"From recarray - event: {event}, duration: {duration}") ``` -------------------------------- ### Compute Integrated Brier Score (IBS) for Survival Source: https://context7.com/soda-inria/hazardous/llms.txt Computes the Integrated Brier Score by aggregating the time-dependent Brier score over the entire observation period. This provides a single scalar metric to compare different survival models against baselines like Kaplan-Meier. ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import integrated_brier_score_survival from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split from lifelines import KaplanMeierFitter X, y = make_synthetic_competing_weibull(n_events=1, n_samples=2000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) # Train SurvivalBoost model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) survival_curves_boost = model.predict_survival_function(X_test) # Compare with Kaplan-Meier baseline (marginal estimator) km = KaplanMeierFitter() km.fit(y_train["duration"], y_train["event"]) survival_km = km.survival_function_at_times(model.time_grid_).values.flatten() survival_curves_km = np.tile(survival_km, (X_test.shape[0], 1)) # Compute IBS for both models (lower is better) ibs_boost = integrated_brier_score_survival( y_train=y_train, y_test=y_test, y_pred=survival_curves_boost, times=model.time_grid_ ) ibs_km = integrated_brier_score_survival( y_train=y_train, y_test=y_test, y_pred=survival_curves_km, times=model.time_grid_ ) print(f"IBS SurvivalBoost: {ibs_boost:.4f}") print(f"IBS Kaplan-Meier: {ibs_km:.4f}") print(f"Relative improvement: {(ibs_km - ibs_boost) / ibs_km * 100:.1f}%") ``` -------------------------------- ### Compute Time-Dependent Brier Score for Survival Source: https://context7.com/soda-inria/hazardous/llms.txt Calculates the Brier score for survival function estimates to evaluate calibration and discrimination. It requires training data for IPCW estimation, test ground truth, and predicted survival probabilities. ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import brier_score_survival from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=1, n_samples=2000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) survival_curves = model.predict_survival_function(X_test) # Compute Brier score at each time point # Lower is better (0 = perfect, 0.25 = random for binary) brier_scores = brier_score_survival( y_train=y_train, # Training data for IPCW estimation y_test=y_test, # Test data ground truth y_pred=survival_curves, # Predicted survival probabilities times=model.time_grid_ # Time points matching predictions ) print(f"Brier score shape: {brier_scores.shape}") print(f"Brier score at early times: {brier_scores[:5].round(4)}") print(f"Brier score at late times: {brier_scores[-5:].round(4)}") print(f"Mean Brier score: {brier_scores.mean():.4f}") ``` -------------------------------- ### accuracy_in_time Source: https://context7.com/soda-inria/hazardous/llms.txt Computes classification accuracy at fixed time horizons. It measures the proportion of correctly predicted most-likely events at various points in time, useful for evaluating time-to-event predictions. ```APIDOC ## accuracy_in_time ### Description Computes classification accuracy at fixed time horizons, measuring the proportion of correctly predicted most-likely events. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import accuracy_in_time from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=3, n_samples=5000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) # Get predictions for all events including survival (index 0) # Shape: (n_samples, n_events + 1, n_times) y_pred = model.predict_cumulative_incidence(X_test) # Compute accuracy at different time quantiles quantiles = np.linspace(0.1, 1.0, 10) accuracy, taus = accuracy_in_time( y_test=y_test, y_pred=y_pred, # Full prediction array time_grid=model.time_grid_, quantiles=quantiles # Evaluate at these quantiles ) print("Time horizons and accuracy:") for t, acc in zip(taus, accuracy): print(f" t={t:7.1f}: accuracy={acc:.3f}") ``` ### Response #### Success Response (200) Returns a tuple containing two numpy arrays: `accuracy` (classification accuracy at each time horizon) and `taus` (the corresponding time horizons). #### Response Example ``` Time horizons and accuracy: t= 350.0: accuracy=0.892 t= 700.0: accuracy=0.834 t= 1050.0: accuracy=0.756 t= 1400.0: accuracy=0.698 t= 1750.0: accuracy=0.654 t= 2100.0: accuracy=0.623 t= 2450.0: accuracy=0.598 t= 2800.0: accuracy=0.578 t= 3150.0: accuracy=0.562 t= 3500.0: accuracy=0.551 ``` ``` -------------------------------- ### Compute Time-Dependent Concordance Index for Incidence Source: https://context7.com/soda-inria/hazardous/llms.txt Computes the time-dependent concordance index (C-index) for competing risks models, with optional Inverse Probability of Censoring Weights (IPCW) adjustment. It assesses the model's ability to discriminate between individuals who experience an event versus those who do not at specific time horizons. ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import concordance_index_incidence from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=2, n_samples=3000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) predicted_curves = model.predict_cumulative_incidence(X_test) cif_event_1 = predicted_curves[:, 1, :] # Compute C-index at specific time horizons (quantiles of time grid) taus = np.quantile(model.time_grid_, [0.25, 0.5, 0.75]) c_index = concordance_index_incidence( y_test=y_test, y_pred=cif_event_1, y_train=y_train, # For IPCW estimation time_grid=model.time_grid_, # Time points of predictions taus=taus, # Time horizons for evaluation event_of_interest=1, # Event type to evaluate ipcw_estimator="km" # "km" or None for uniform weights ) print(f"Evaluation times: {taus.round(0)}") print(f"C-index at each tau: {c_index.round(3)}") print(f"Mean C-index: {c_index.mean():.3f}") # Output: # Evaluation times: [875. 1750. 2625.] # C-index at each tau: [0.712 0.698 0.685] # Mean C-index: 0.698 # For survival (single event), use 1 - survival as incidence survival_curves = model.predict_survival_function(X_test) c_index_survival = concordance_index_incidence( y_test=y_test, y_pred=1 - survival_curves, # Convert survival to incidence y_train=y_train, time_grid=model.time_grid_, taus=taus, event_of_interest="any" # Not applicable for single event ) ``` -------------------------------- ### Compute Integrated Brier Score for Incidence Source: https://context7.com/soda-inria/hazardous/llms.txt Calculates the Integrated Brier Score (IBS) for cause-specific cumulative incidence functions. This metric evaluates the accuracy of predicted cumulative incidence over time for competing risks. It requires true event data, predicted cumulative incidence, and a time grid. ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import integrated_brier_score_incidence from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=3, n_samples=3000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) predicted_curves = model.predict_cumulative_incidence(X_test) # Compute IBS for each event type for event_id in range(1, 4): cif = predicted_curves[:, event_id, :] ibs = integrated_brier_score_incidence( y_train=y_train, y_test=y_test, y_pred=cif, times=model.time_grid_, event_of_interest=event_id ) print(f"IBS for event {event_id}: {ibs:.4f}") # Output: # IBS for event 1: 0.0812 # IBS for event 2: 0.0798 # IBS for event 3: 0.0834 ``` -------------------------------- ### Validate and Convert Survival Target Data Source: https://context7.com/soda-inria/hazardous/llms.txt A utility function to ensure the target variable `y` for survival analysis is in the correct format. It handles various input types like pandas DataFrames, dictionaries, or NumPy record arrays, converting them into standardized event and duration arrays. ```python import numpy as np import pandas as pd from hazardous.utils import check_y_survival ``` -------------------------------- ### check_y_survival Source: https://context7.com/soda-inria/hazardous/llms.txt Utility function to validate and convert target data formats (DataFrame, dict, or record array) to event and duration arrays. This function ensures the target variable `y` is in the correct format for survival analysis models. ```APIDOC ## check_y_survival ### Description Utility function to validate and convert target data formats (DataFrame, dict, or record array) to event and duration arrays. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import numpy as np import pandas as pd from hazardous.utils import check_y_survival # Example usage with a pandas DataFrame data = { 'event': [0, 1, 0, 1, 0], 'duration': [10, 25, 15, 30, 20] } df = pd.DataFrame(data) events, durations = check_y_survival(df) print("Events:", events) print("Durations:", durations) # Example usage with a numpy structured array structured_array = np.array( [(0, 10), (1, 25), (0, 15), (1, 30), (0, 20)], dtype=[('event', int), ('duration', float)] ) events_sa, durations_sa = check_y_survival(structured_array) print("Events (SA):", events_sa) print("Durations (SA):", durations_sa) ``` ### Response #### Success Response (200) Returns a tuple containing two numpy arrays: `events` (binary indicator of event occurrence) and `durations` (time until event or censoring). #### Response Example ``` Events: [0 1 0 1 0] Durations: [10. 25. 15. 30. 20.] Events (SA): [0 1 0 1 0] Durations (SA): [10. 25. 15. 30. 20.] ``` ``` -------------------------------- ### Compute Classification Accuracy Over Time Source: https://context7.com/soda-inria/hazardous/llms.txt Calculates classification accuracy at specified time horizons. It determines the proportion of samples where the most likely event (or survival) is correctly predicted at each time point. This is useful for evaluating dynamic predictive models. ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import accuracy_in_time from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=3, n_samples=5000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) # Get predictions for all events including survival (index 0) # Shape: (n_samples, n_events + 1, n_times) y_pred = model.predict_cumulative_incidence(X_test) # Compute accuracy at different time quantiles quantiles = np.linspace(0.1, 1.0, 10) accuracy, taus = accuracy_in_time( y_test=y_test, y_pred=y_pred, # Full prediction array time_grid=model.time_grid_, quantiles=quantiles # Evaluate at these quantiles ) print("Time horizons and accuracy:") for t, acc in zip(taus, accuracy): print(f" t={t:7.1f}: accuracy={acc:.3f}") # Output: # Time horizons and accuracy: # t= 350.0: accuracy=0.892 # t= 700.0: accuracy=0.834 # t= 1050.0: accuracy=0.756 # t= 1400.0: accuracy=0.698 # t= 1750.0: accuracy=0.654 # t= 2100.0: accuracy=0.623 # t= 2450.0: accuracy=0.598 # t= 2800.0: accuracy=0.578 # t= 3150.0: accuracy=0.562 # t= 3500.0: accuracy=0.551 ``` -------------------------------- ### concordance_index_incidence Source: https://context7.com/soda-inria/hazardous/llms.txt Computes the time-dependent concordance index (C-index) for competing risks models with IPCW adjustment. It assesses the model's ability to correctly rank subjects by their risk of experiencing an event at specific time points. ```APIDOC ## concordance_index_incidence ### Description Computes the time-dependent concordance index (C-index) for competing risks models with IPCW adjustment. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import concordance_index_incidence from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=2, n_samples=3000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) predicted_curves = model.predict_cumulative_incidence(X_test) cif_event_1 = predicted_curves[:, 1, :] # Compute C-index at specific time horizons (quantiles of time grid) taus = np.quantile(model.time_grid_, [0.25, 0.5, 0.75]) c_index = concordance_index_incidence( y_test=y_test, y_pred=cif_event_1, y_train=y_train, # For IPCW estimation time_grid=model.time_grid_, # Time points of predictions taus=taus, # Time horizons for evaluation event_of_interest=1, # Event type to evaluate ipcw_estimator="km" # "km" or None for uniform weights ) print(f"Evaluation times: {taus.round(0)}") print(f"C-index at each tau: {c_index.round(3)}") print(f"Mean C-index: {c_index.mean():.3f}") # For survival (single event), use 1 - survival as incidence survival_curves = model.predict_survival_function(X_test) c_index_survival = concordance_index_incidence( y_test=y_test, y_pred=1 - survival_curves, # Convert survival to incidence y_train=y_train, time_grid=model.time_grid_, taus=taus, event_of_interest="any" # Not applicable for single event ) ``` ### Response #### Success Response (200) Returns a numpy array of C-index values for each specified time horizon. #### Response Example ``` Evaluation times: [ 875. 1750. 2625.] C-index at each tau: [0.712 0.698 0.685] Mean C-index: 0.698 ``` ``` -------------------------------- ### Compute Brier Score for Competing Risks Incidence Source: https://context7.com/soda-inria/hazardous/llms.txt Evaluates the accuracy of cause-specific cumulative incidence function (CIF) predictions. It supports evaluating specific event types or the aggregate probability of 'any' event occurring. ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import brier_score_incidence from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=3, n_samples=3000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) # Get cumulative incidence for event 1 predicted_curves = model.predict_cumulative_incidence(X_test) cif_event_1 = predicted_curves[:, 1, :] # Event 1 CIF # Compute Brier score for event 1 brier_scores_event1 = brier_score_incidence( y_train=y_train, y_test=y_test, y_pred=cif_event_1, times=model.time_grid_, event_of_interest=1 # Evaluate for event type 1 ) # Compute for "any" event (all events collapsed) cif_any = 1 - predicted_curves[:, 0, :] # 1 - survival = any event incidence brier_scores_any = brier_score_incidence( y_train=y_train, y_test=y_test, y_pred=cif_any, times=model.time_grid_, event_of_interest="any" ) print(f"Mean Brier score (event 1): {brier_scores_event1.mean():.4f}") print(f"Mean Brier score (any event): {brier_scores_any.mean():.4f}") ``` -------------------------------- ### integrated_brier_score_incidence Source: https://context7.com/soda-inria/hazardous/llms.txt Computes the Integrated Brier Score for cause-specific cumulative incidence functions. This metric evaluates the accuracy of predicted cumulative incidence over time for specific events in a competing risks setting. ```APIDOC ## integrated_brier_score_incidence ### Description Computes the Integrated Brier Score for cause-specific cumulative incidence functions. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import numpy as np from hazardous import SurvivalBoost from hazardous.metrics import integrated_brier_score_incidence from hazardous.data import make_synthetic_competing_weibull from sklearn.model_selection import train_test_split X, y = make_synthetic_competing_weibull(n_events=3, n_samples=3000, return_X_y=True, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) model = SurvivalBoost(n_iter=50, show_progressbar=False, random_state=42) model.fit(X_train, y_train) predicted_curves = model.predict_cumulative_incidence(X_test) # Compute IBS for each event type for event_id in range(1, 4): cif = predicted_curves[:, event_id, :] ibs = integrated_brier_score_incidence( y_train=y_train, y_test=y_test, y_pred=cif, times=model.time_grid_, event_of_interest=event_id ) print(f"IBS for event {event_id}: {ibs:.4f}") ``` ### Response #### Success Response (200) Returns a float representing the Integrated Brier Score. #### Response Example ``` IBS for event 1: 0.0812 IBS for event 2: 0.0798 IBS for event 3: 0.0834 ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.