def generate_hazard_rates(n, d, timelines, constant=False, independent=0, n_binary=0, model="aalen"):
    covariates = generate_covariates(n, d, n_binary=n_binary)
    if model == "aalen":
        coefficients = time_varying_coefficients(d + 1, timelines, independent=independent, constant=constant)
        hazard_rates = np.dot(covariates, coefficients.T)
        return pd.DataFrame(hazard_rates.T, index=timelines), coefficients, pd.DataFrame(covariates)
    elif model == "cox":
        covariates = covariates[:, :-1]
        coefficients = constant_coefficients(d, timelines, independent)
        baseline = time_varying_coefficients(1, timelines)
        hazard_rates = np.exp(np.dot(covariates, coefficients.T)) * baseline[baseline.columns[0]].values
        coefficients["baseline: " + baseline.columns[0]] = baseline.values
        return pd.DataFrame(hazard_rates.T, index=timelines), coefficients, pd.DataFrame(covariates)
    else:
        raise Exception
n: the number of instances
dataset/ETHPy150Open CamDavidsonPilon/lifelines/lifelines/generate_datasets.py/generate_hazard_rates