Quickstart
InĀ [1]:
Copied!
import pandas as pd
from lactopy import OBLA
import pandas as pd
from lactopy import OBLA
InĀ [2]:
Copied!
df = pd.read_csv('../tests/test_data/lactate_test_data copy.csv')
df = pd.read_csv('../tests/test_data/lactate_test_data copy.csv')
InĀ [3]:
Copied!
# fit model returns a scikit learn like model object
obla = OBLA()
obla.fit(df['watt'], df['lactate'], method='spline')
# fit model returns a scikit learn like model object
obla = OBLA()
obla.fit(df['watt'], df['lactate'], method='spline')
Out[3]:
OBLA()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
OBLA()
InĀ [4]:
Copied!
# plot fit of data
obla.plot.plot_fit()
# plot fit of data
obla.plot.plot_fit()
Out[4]:
<Axes: title={'center': 'Lactate Model Plot'}, xlabel='Intensity', ylabel='Lactate'>
InĀ [5]:
Copied!
# predict intensity at 4 mmol
obla.predict(4)
# predict intensity at 4 mmol
obla.predict(4)
Out[5]:
np.float64(147.14747308909196)
InĀ [6]:
Copied!
# Plot the prediction at 4 mmol
obla.plot.plot_predictions(4)
# Plot the prediction at 4 mmol
obla.plot.plot_predictions(4)
Out[6]:
<Axes: title={'center': 'Lactate Model Plot'}, xlabel='Intensity', ylabel='Lactate'>
InĀ [7]:
Copied!
from lactopy.lactate_models import Dmax
from lactopy.lactate_models import Dmax
InĀ [8]:
Copied!
model = Dmax()
model.fit(df['watt'], df['lactate'], impl='modified')
# plot fit of data
model.plot.plot_fit()
model = Dmax()
model.fit(df['watt'], df['lactate'], impl='modified')
# plot fit of data
model.plot.plot_fit()
Out[8]:
<Axes: title={'center': 'Dmax Model Fit'}, xlabel='Intensity', ylabel='Lactate'>
InĀ [9]:
Copied!
model.plot.plot_predictions()
model.plot.plot_predictions()
Out[9]:
<Axes: title={'center': 'Dmax Model Fit'}, xlabel='Intensity', ylabel='Lactate'>