def time_varying_coefficients(d, timelines, constant=False, independent=0, randgen=random.exponential):
    """
    Time vary coefficients

    d: the dimension of the dataset
    timelines: the observational times
    constant: True for constant coefficients
    independent: the number of coffients to set to 0 (covariate is ind of survival), or
      a list of covariates to make indepent.
    randgen: how scalar coefficients (betas) are sampled.

    returns a matrix (t,d+1) of coefficients
    """
    t = timelines.shape[0]
    try:
        a = np.arange(d)
        random.shuffle(a)
        independent = a[:independent]
    except __HOLE__:
        pass

    n_funcs = len(FUNCS)
    coefficients = np.zeros((t, d))
    data_generators = []
    for i in range(d):
        f = FUNCS[random.randint(0, n_funcs)] if not constant else constant_
        if i in independent:
            beta = 0
        else:
            beta = randgen((1 - constant) * 0.5 / d)
        coefficients[:, i] = f(timelines, alpha=randgen(2000.0 / t), beta=beta)
        data_generators.append(f.__doc__)

    df_coefficients = pd.DataFrame(coefficients, columns=data_generators, index=timelines)
    return df_coefficients
dataset/ETHPy150Open CamDavidsonPilon/lifelines/lifelines/generate_datasets.py/time_varying_coefficients