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.