Academic
Blog
Analytics

Marathon training program analysis using python and chartjs

4 mins read time ❤️ Views


I wanted to run a marathon at least once in my life, then I chose to do the Marathon de Metz.

Running calendar

I began my preparation program 3 months before the race. I started running regularly the first week of July. Mostly small distances on weekdays and longest ones during the weekend. I wasn’t strict at the beginning, during the month of July but, then I my training became more regular.

Daily behaviour

From my daily analysis I can say that I prefer to run mostly on Tuesday and that I barely run on Fridays. Saturdays runs are the longest ones, with an average of 20.4 km. Regarding speed, I run slower on Saturdays, because distance are longer.

Weekly behaviour

It is nice to see the weekly progress, running 22 kilometres at the beginning of July and reaching 46 kilometres on September. In average, I train 3 times a week.

Monthly behaviour

There is also an monthly progress, being September my best month with 164 km and 14 training sessions. Almost half of the month.

Marathon time prediction

It is possible to estimate the elapsed the time that I would spend to cover the 42.195 km of the marathon. I applied a simple linear regression using the cover distance and the climbed altitude.

The predicted time is 3.99 hours with an average speed of 10.56 km/h. One may see that for my training, the cover distance is more important than the climb altitude when predicting the elapsed time.

from sklearn import linear_model

# Use distance and climb height
X_train = recent_frame[['Kilometers','Climb']].values
y_train = recent_frame['Time']
# Test with the marathon 42.195 km and 400 m climb
X_test = np.array([42.195, 400]).reshape(1,-1)

# Use linear regression
regr = linear_model.LinearRegression()
regr.fit(X_train, y_train)
y_pred = regr.predict(X_test)
print('Distance: {} Km, Speed: {} Km/h, Time: {} hours \n'.format(X_test[0][0], X_test[0][0]/float(y_pred[0]/60), y_pred[0]/60))
>>> Distance: 42.195 Km, Speed: 10.56 Km/h, Time: 3.99 hours 

Average speed and length per training

My average speed varies depending on the number of kilometres that I run. For long distances, the average was near 11.2 km/hour. Meanwhile, for shorter distances I was able to reach 12.7 km/hours during 8 kilometres.

Data analysis

The python code used to explore the data can be found inside this python notebook.

In relation with 🏷️ run, python, chartjs, leaflet, withings:

Two years data from Withings smart watch

The withings smart watch helps me find insights my health. How much I move and sleep.

Running statistics from Santorini experience

In this post I use the javascript library Chartjs to illustrate interactively the statistics of a running activity at Santorini experience 2016

Intelligent Video Analytics using SSD mobilenet on NVIDIA's Jetson Nano

This project implements a deep learning model on a Jetson Nano to count and track people passing in front of a video camera.

Analysis of Paris bike systems Velib

This post shows how to query data from Paris Open Data base, make some geographical plots using folium and also some analysis about the bike utilisation depending on the date

Subscribe to my newsletter 📰

and share it with your friends: