<p>I'm using the Python package <em>lifelines</em> to build a CoxPH model where I reduce the step size to 0.1, like so:</p>
<pre><code>cph = CoxPHFitter()
cph.fit(df, 'time', 'event', fit_options = {&quot;step_size&quot;:0.1})
</code></pre>
<p>I used k_fold_cross_validation to build the model, but I don't know how to add in step size. I expected to add it to fitter_kwargs, like this, but this does not work:</p>
<pre><code>k_fold_cross_validation(cph, df, duration_col='time', event_col='event', k=5, fitter_kwargs={fit_options:{&quot;step_size&quot;:0.1}})
</code></pre>

CC BY-SA 4.0
2023-11-01T12:37:11.533Z
have you tried simply cph.fit(df, 'time', 'event', step_size=0.1} ?
JRodrigoF
CC BY-SA 4.0
2023-11-01T14:10:46.343Z
@JRodrigoF I wouldn't be able to do cross-validation then
skubali
<python>
Adding step size to cross validation in Python package lifelines
# Adding step size to cross validation in Python package lifelines

(Asked by: username_0 on 2023-10-31)

I'm using the Python package lifelines to build a CoxPH model where I reduce the step size to 0.1, like so:
cph = CoxPHFitter()
cph.fit(df, 'time', 'event', fit_options = {"step_size":0.1})

I used k_fold_cross_validation to build the model, but I don't know how to add in step size. I expected to add it to fitter_kwargs, like this, but this does not work:
k_fold_cross_validation(cph, df, duration_col='time', event_col='event', k=5, fitter_kwargs={fit_options:{"step_size":0.1}})

**Tags:** python
> **Comments:**
> **username_1**: have you tried simply cph.fit(df, 'time', 'event', step_size=0.1} ?  
> **username_0**: @JRodrigoF I wouldn't be able to do cross-validation then  

---

## 0 answers

