from typing import Any

class GBSurvLoss:
    AFT: GBSurvLoss
    CoxPH: GBSurvLoss
    Huber: GBSurvLoss
    SquaredError: GBSurvLoss

class SplitRule:
    Conservation: SplitRule
    Hellinger: SplitRule
    LogRank: SplitRule
    LogRankScore: SplitRule

class Activation:
    ReLU: Activation
    SELU: Activation
    Tanh: Activation
    def __init__(self, name: str) -> None: ...

class DistributionType:
    ExtremeValue: DistributionType
    Weibull: DistributionType
    Gaussian: DistributionType
    Logistic: DistributionType
    LogNormal: DistributionType
    LogLogistic: DistributionType

class DimType:
    Age: DimType
    Continuous: DimType
    Factor: DimType
    Year: DimType

class ReliabilityScale:
    ClogLog: ReliabilityScale
    Cumhaz: ReliabilityScale
    LogLogistic: ReliabilityScale
    Probit: ReliabilityScale
    Surv: ReliabilityScale

class GradientBoostSurvivalConfig:
    n_estimators: int
    learning_rate: float
    max_depth: int
    min_samples_split: int
    min_samples_leaf: int
    subsample: float
    max_features: int | None
    seed: int | None
    loss: GBSurvLoss
    dropout_rate: float

    def __init__(
        self,
        n_estimators: int = 100,
        learning_rate: float = 0.1,
        max_depth: int = 3,
        min_samples_split: int = 10,
        min_samples_leaf: int = 5,
        subsample: float = 1.0,
        max_features: int | None = None,
        seed: int | None = None,
        loss: GBSurvLoss | None = None,
        dropout_rate: float = 0.0,
    ) -> None: ...

class GradientBoostSurvival:
    @property
    def n_estimators(self) -> int: ...
    @property
    def learning_rate(self) -> float: ...
    @property
    def unique_times(self) -> list[float]: ...
    @property
    def feature_importance(self) -> list[float]: ...
    @property
    def baseline_hazard(self) -> list[float]: ...
    @property
    def train_loss(self) -> list[float]: ...
    @staticmethod
    def fit(
        x: list[float],
        n: int,
        p: int,
        time: list[float],
        status: list[int],
        config: GradientBoostSurvivalConfig,
    ) -> GradientBoostSurvival: ...
    def predict_risk(self, x_new: list[float], n_new: int) -> list[float]: ...
    def predict_survival(self, x_new: list[float], n_new: int) -> list[list[float]]: ...
    def predict_cumulative_hazard(self, x_new: list[float], n_new: int) -> list[list[float]]: ...
    def predict_survival_time(
        self, x_new: list[float], n_new: int, percentile: float = 0.5
    ) -> list[float | None]: ...
    def predict_median_survival_time(
        self, x_new: list[float], n_new: int
    ) -> list[float | None]: ...

class SurvivalForestConfig:
    n_trees: int
    max_depth: int | None
    min_node_size: int
    mtry: int | None
    sample_fraction: float
    seed: int | None
    oob_error: bool
    split_rule: SplitRule
    n_random_splits: int

    def __init__(
        self,
        n_trees: int = 500,
        max_depth: int | None = None,
        min_node_size: int = 15,
        mtry: int | None = None,
        sample_fraction: float = 0.632,
        seed: int | None = None,
        oob_error: bool = True,
        split_rule: SplitRule | None = None,
        n_random_splits: int = 10,
    ) -> None: ...

class SurvivalForest:
    @property
    def n_trees(self) -> int: ...
    @property
    def unique_times(self) -> list[float]: ...
    @property
    def variable_importance(self) -> list[float]: ...
    @property
    def oob_error(self) -> float | None: ...
    @staticmethod
    def fit(
        x: list[float],
        n: int,
        p: int,
        time: list[float],
        status: list[int],
        config: SurvivalForestConfig,
    ) -> SurvivalForest: ...
    def predict_risk(self, x_new: list[float], n_new: int) -> list[float]: ...
    def predict_survival(self, x_new: list[float], n_new: int) -> list[list[float]]: ...
    def predict_cumulative_hazard(self, x_new: list[float], n_new: int) -> list[list[float]]: ...
    def predict_survival_time(
        self, x_new: list[float], n_new: int, percentile: float = 0.5
    ) -> list[float | None]: ...
    def predict_median_survival_time(
        self, x_new: list[float], n_new: int
    ) -> list[float | None]: ...

class DeepSurvConfig:
    hidden_layers: list[int]
    activation: Activation
    dropout_rate: float
    learning_rate: float
    batch_size: int
    n_epochs: int
    l2_reg: float
    seed: int | None
    early_stopping_patience: int | None
    validation_fraction: float

    def __init__(
        self,
        hidden_layers: list[int] | None = None,
        activation: Activation | None = None,
        dropout_rate: float = 0.2,
        learning_rate: float = 0.001,
        batch_size: int = 256,
        n_epochs: int = 100,
        l2_reg: float = 0.0001,
        seed: int | None = None,
        early_stopping_patience: int | None = None,
        validation_fraction: float = 0.1,
    ) -> None: ...

class DeepSurv:
    @property
    def n_features(self) -> int: ...
    @property
    def hidden_layers(self) -> list[int]: ...
    @property
    def unique_times(self) -> list[float]: ...
    @property
    def baseline_hazard(self) -> list[float]: ...
    @property
    def train_loss(self) -> list[float]: ...
    @property
    def val_loss(self) -> list[float]: ...
    @staticmethod
    def fit(
        x: list[float],
        n: int,
        p: int,
        time: list[float],
        status: list[int],
        config: DeepSurvConfig,
    ) -> DeepSurv: ...
    def predict_risk(self, x_new: list[float], n_new: int) -> list[float]: ...
    def predict_survival(self, x_new: list[float], n_new: int) -> list[list[float]]: ...
    def predict_cumulative_hazard(self, x_new: list[float], n_new: int) -> list[list[float]]: ...
    def predict_survival_time(
        self, x_new: list[float], n_new: int, percentile: float = 0.5
    ) -> list[float | None]: ...
    def predict_median_survival_time(
        self, x_new: list[float], n_new: int
    ) -> list[float | None]: ...

class Subject:
    def __init__(
        self,
        covariates: list[float],
        time: float,
        status: int,
        weight: float = 1.0,
    ) -> None: ...

class CoxPHModel:
    @property
    def coefficients(self) -> list[float]: ...
    @property
    def std_errors(self) -> list[float]: ...
    @property
    def vcov(self) -> list[list[float]]: ...
    @property
    def log_likelihood(self) -> float: ...
    @property
    def n_observations(self) -> int: ...
    @property
    def n_events(self) -> int: ...
    @property
    def event_times(self) -> list[float]: ...
    @property
    def baseline_hazard(self) -> list[float]: ...
    @property
    def censoring(self) -> list[int]: ...
    @staticmethod
    def new_with_data(
        covariates: list[list[float]],
        time: list[float],
        status: list[int],
    ) -> CoxPHModel: ...
    def add_subject(self, subject: Subject) -> None: ...
    def fit(self, n_iters: int = 20) -> None: ...
    def predict(self, covariates: list[list[float]]) -> list[float]: ...
    def predict_survival(self, covariates: list[list[float]]) -> list[list[float]]: ...
    def predicted_survival_time(
        self, covariates: list[list[float]], percentile: float = 0.5
    ) -> list[float | None]: ...
    def survival_curve(
        self, covariates: list[list[float]], times: list[float] | None = None
    ) -> tuple[list[float], list[list[float]]]: ...
    def cumulative_hazard(self, covariates: list[list[float]]) -> list[list[float]]: ...
    def risk_scores(self, covariates: list[list[float]]) -> list[float]: ...
    def hazard_ratios(self) -> list[float]: ...
    def hazard_ratios_with_ci(
        self, confidence_level: float = 0.95
    ) -> list[tuple[float, float, float]]: ...
    def martingale_residuals(self) -> list[float]: ...
    def deviance_residuals(self) -> list[float]: ...
    def dfbeta(self) -> list[list[float]]: ...
    def brier_score(self, time: float) -> float: ...
    def restricted_mean_survival_time(self, tau: float) -> float: ...
    def summary(self) -> str: ...
    def aic(self) -> float: ...
    def bic(self) -> float: ...
    def calculate_baseline_hazard(self) -> None: ...
    def compute_standard_errors(self) -> None: ...
    def compute_fisher_information(self) -> list[list[float]]: ...

class SurvFitKMOutput:
    @property
    def time(self) -> list[float]: ...
    @property
    def surv(self) -> list[float]: ...
    @property
    def n_risk(self) -> list[int]: ...
    @property
    def n_event(self) -> list[int]: ...
    @property
    def n_censor(self) -> list[int]: ...
    @property
    def std_err(self) -> list[float]: ...
    @property
    def lower(self) -> list[float]: ...
    @property
    def upper(self) -> list[float]: ...
    @property
    def cumhaz(self) -> list[float]: ...

class KaplanMeierConfig:
    def __init__(
        self,
        conf_level: float = 0.95,
        conf_type: str = "log-log",
        se_type: str = "greenwood",
    ) -> None: ...

class SurvfitKMOptions:
    def __init__(
        self,
        conf_level: float = 0.95,
        conf_type: str = "log-log",
        se_type: str = "greenwood",
        start_time: float | None = None,
    ) -> None: ...

class NelsonAalenResult:
    @property
    def time(self) -> list[float]: ...
    @property
    def cumhaz(self) -> list[float]: ...
    @property
    def variance(self) -> list[float]: ...
    @property
    def lower(self) -> list[float]: ...
    @property
    def upper(self) -> list[float]: ...
    @property
    def n_risk(self) -> list[int]: ...
    @property
    def n_event(self) -> list[int]: ...

class LogRankResult:
    @property
    def statistic(self) -> float: ...
    @property
    def p_value(self) -> float: ...
    @property
    def df(self) -> int: ...
    @property
    def observed(self) -> list[float]: ...
    @property
    def expected(self) -> list[float]: ...
    @property
    def var_observed(self) -> list[float]: ...

class RMSTResult:
    @property
    def rmst(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def lower(self) -> float: ...
    @property
    def upper(self) -> float: ...
    @property
    def tau(self) -> float: ...

class CalibrationResult:
    @property
    def observed(self) -> list[float]: ...
    @property
    def predicted(self) -> list[float]: ...
    @property
    def n_groups(self) -> int: ...
    @property
    def hosmer_lemeshow_stat(self) -> float: ...
    @property
    def hosmer_lemeshow_p(self) -> float: ...

class UnoCIndexResult:
    @property
    def c_index(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def lower(self) -> float: ...
    @property
    def upper(self) -> float: ...
    @property
    def n_pairs(self) -> int: ...
    @property
    def n_concordant(self) -> int: ...

class SurvivalFit:
    coefficients: list[float]
    iterations: int
    variance_matrix: list[list[float]]
    log_likelihood: float
    convergence_flag: int
    score_vector: list[float]

class SurvregConfig:
    def __init__(
        self,
        distribution: DistributionType | None = None,
        max_iter: int = 100,
        tol: float = 1e-9,
    ) -> None: ...

class BootstrapResult:
    @property
    def estimate(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def lower(self) -> float: ...
    @property
    def upper(self) -> float: ...
    @property
    def bootstrap_estimates(self) -> list[float]: ...

class CVResult:
    @property
    def mean_score(self) -> float: ...
    @property
    def std_score(self) -> float: ...
    @property
    def scores(self) -> list[float]: ...
    @property
    def n_folds(self) -> int: ...

class TestResult:
    @property
    def statistic(self) -> float: ...
    @property
    def p_value(self) -> float: ...
    @property
    def df(self) -> int: ...

class BayesianCoxResult:
    @property
    def coefficients(self) -> list[float]: ...
    @property
    def std_errors(self) -> list[float]: ...
    @property
    def credible_intervals(self) -> list[tuple[float, float]]: ...
    @property
    def effective_sample_size(self) -> list[float]: ...
    @property
    def rhat(self) -> list[float]: ...

class ElasticNetCoxResult:
    @property
    def coefficients(self) -> list[float]: ...
    @property
    def intercept(self) -> float: ...
    @property
    def alpha(self) -> float: ...
    @property
    def l1_ratio(self) -> float: ...
    @property
    def n_iter(self) -> int: ...
    @property
    def nonzero_features(self) -> list[int]: ...

class MixtureCureResult:
    @property
    def cure_coefficients(self) -> list[float]: ...
    @property
    def survival_coefficients(self) -> list[float]: ...
    @property
    def cure_rate(self) -> float: ...
    @property
    def log_likelihood(self) -> float: ...

class JointModelResult:
    @property
    def longitudinal_coefficients(self) -> list[float]: ...
    @property
    def survival_coefficients(self) -> list[float]: ...
    @property
    def association(self) -> float: ...
    @property
    def log_likelihood(self) -> float: ...

class IPCWResult:
    @property
    def weights(self) -> list[float]: ...
    @property
    def estimate(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def lower(self) -> float: ...
    @property
    def upper(self) -> float: ...

class GComputationResult:
    @property
    def ate(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def lower(self) -> float: ...
    @property
    def upper(self) -> float: ...
    @property
    def survival_treated(self) -> list[float]: ...
    @property
    def survival_control(self) -> list[float]: ...

class QALYResult:
    @property
    def qaly(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def lower(self) -> float: ...
    @property
    def upper(self) -> float: ...

class RCLLResult:
    @property
    def rcll(self) -> float: ...
    @property
    def se(self) -> float: ...
    @property
    def n_samples(self) -> int: ...

def survfitkm(
    time: list[float],
    status: list[int],
    conf_level: float = 0.95,
) -> SurvFitKMOutput: ...
def survfitkm_with_options(
    time: list[float],
    status: list[int],
    options: SurvfitKMOptions,
) -> SurvFitKMOutput: ...
def nelson_aalen_estimator(
    time: list[float],
    status: list[int],
    conf_level: float = 0.95,
) -> NelsonAalenResult: ...
def stratified_kaplan_meier(
    time: list[float],
    status: list[int],
    strata: list[int],
    conf_level: float = 0.95,
) -> dict[int, SurvFitKMOutput]: ...
def logrank_test(
    time: list[float],
    status: list[int],
    group: list[int],
) -> LogRankResult: ...
def fleming_harrington_test(
    time: list[float],
    status: list[int],
    group: list[int],
    rho: float = 0.0,
    gamma: float = 0.0,
) -> LogRankResult: ...
def rmst(
    time: list[float],
    status: list[int],
    tau: float,
    conf_level: float = 0.95,
) -> RMSTResult: ...
def rmst_comparison(
    time: list[float],
    status: list[int],
    group: list[int],
    tau: float,
    conf_level: float = 0.95,
) -> dict[str, Any]: ...
def survreg(
    time: list[float],
    status: list[float],
    covariates: list[list[float]],
    weights: list[float] | None = None,
    offsets: list[float] | None = None,
    initial_beta: list[float] | None = None,
    strata: list[int] | None = None,
    distribution: str | None = None,
    max_iter: int | None = None,
    eps: float | None = None,
    tol_chol: float | None = None,
) -> SurvivalFit: ...
def calibration(
    predicted: list[float],
    time: list[float],
    status: list[int],
    n_groups: int = 10,
) -> CalibrationResult: ...
def uno_c_index(
    time: list[float],
    status: list[int],
    risk_scores: list[float],
    tau: float | None = None,
) -> UnoCIndexResult: ...
def brier(
    time: list[float],
    status: list[int],
    predicted: list[float],
    eval_time: float,
) -> float: ...
def integrated_brier(
    time: list[float],
    status: list[int],
    predicted: list[list[float]],
    eval_times: list[float],
) -> float: ...
def bootstrap_cox_ci(
    time: list[float],
    status: list[int],
    x: list[list[float]],
    n_bootstrap: int = 1000,
    conf_level: float = 0.95,
) -> BootstrapResult: ...
def cv_cox_concordance(
    time: list[float],
    status: list[int],
    x: list[list[float]],
    n_folds: int = 5,
) -> CVResult: ...
def lrt_test(
    log_likelihood_full: float,
    log_likelihood_reduced: float,
    df: int,
) -> TestResult: ...
def bayesian_cox(
    time: list[float],
    status: list[int],
    x: list[list[float]],
    n_samples: int = 1000,
    n_warmup: int = 500,
    prior_scale: float = 1.0,
) -> BayesianCoxResult: ...
def elastic_net_cox(
    time: list[float],
    status: list[int],
    x: list[list[float]],
    alpha: float = 1.0,
    l1_ratio: float = 0.5,
    max_iter: int = 1000,
) -> ElasticNetCoxResult: ...
def mixture_cure_model(
    time: list[float],
    status: list[int],
    x_cure: list[list[float]],
    x_survival: list[list[float]],
    max_iter: int = 100,
) -> MixtureCureResult: ...
def joint_model(
    longitudinal_time: list[float],
    longitudinal_value: list[float],
    subject_id: list[int],
    survival_time: list[float],
    survival_status: list[int],
    x: list[list[float]],
) -> JointModelResult: ...
def ipcw_kaplan_meier(
    time: list[float],
    status: list[int],
    weights: list[float],
) -> SurvFitKMOutput: ...
def g_computation(
    time: list[float],
    status: list[int],
    treatment: list[int],
    x: list[list[float]],
    n_bootstrap: int = 1000,
) -> GComputationResult: ...
def qaly_calculation(
    time: list[float],
    status: list[int],
    utility: list[float],
    tau: float,
) -> QALYResult: ...
def rcll(
    time: list[float],
    status: list[int],
    predicted_survival: list[list[float]],
    eval_times: list[float],
) -> RCLLResult: ...
def gradient_boost_survival(
    x: list[float],
    n: int,
    p: int,
    time: list[float],
    status: list[int],
    config: GradientBoostSurvivalConfig | None = None,
) -> GradientBoostSurvival: ...
def survival_forest(
    x: list[float],
    n: int,
    p: int,
    time: list[float],
    status: list[int],
    config: SurvivalForestConfig | None = None,
) -> SurvivalForest: ...
def deep_surv(
    x: list[float],
    n: int,
    p: int,
    time: list[float],
    status: list[int],
    config: DeepSurvConfig | None = None,
) -> DeepSurv: ...
def load_lung() -> dict[str, list[Any]]: ...
def load_aml() -> dict[str, list[Any]]: ...
def load_veteran() -> dict[str, list[Any]]: ...
def load_ovarian() -> dict[str, list[Any]]: ...
def load_colon() -> dict[str, list[Any]]: ...
def load_pbc() -> dict[str, list[Any]]: ...
def load_cgd() -> dict[str, list[Any]]: ...
def load_bladder() -> dict[str, list[Any]]: ...
def load_heart() -> dict[str, list[Any]]: ...
def load_kidney() -> dict[str, list[Any]]: ...
def load_rats() -> dict[str, list[Any]]: ...
def load_stanford2() -> dict[str, list[Any]]: ...
def load_udca() -> dict[str, list[Any]]: ...
def load_myeloid() -> dict[str, list[Any]]: ...
def load_flchain() -> dict[str, list[Any]]: ...
def load_transplant() -> dict[str, list[Any]]: ...
def load_mgus() -> dict[str, list[Any]]: ...
def load_mgus2() -> dict[str, list[Any]]: ...
def load_diabetic() -> dict[str, list[Any]]: ...
def load_retinopathy() -> dict[str, list[Any]]: ...
def load_gbsg() -> dict[str, list[Any]]: ...
def load_rotterdam() -> dict[str, list[Any]]: ...
def load_logan() -> dict[str, list[Any]]: ...
def load_nwtco() -> dict[str, list[Any]]: ...
def load_solder() -> dict[str, list[Any]]: ...
def load_tobin() -> dict[str, list[Any]]: ...
def load_rats2() -> dict[str, list[Any]]: ...
def load_nafld() -> dict[str, list[Any]]: ...
def load_cgd0() -> dict[str, list[Any]]: ...
def load_pbcseq() -> dict[str, list[Any]]: ...
def load_hoel() -> dict[str, list[Any]]: ...
def load_myeloma() -> dict[str, list[Any]]: ...
def load_rhdnase() -> dict[str, list[Any]]: ...
