Simple way to measure cell execution time in ipython notebook
The only way I found to overcome this problem is by executing the last statement with print.
Do not forget that cell magic starts with %%
and line magic starts with %
.
%%timeclf = tree.DecisionTreeRegressor().fit(X_train, y_train)res = clf.predict(X_test)print(res)
Notice that any changes performed inside the cell are not taken into consideration in the next cells, something that is counter intuitive when there is a pipeline:
An easier way is to use ExecuteTime plugin in jupyter_contrib_nbextensions package.
pip install jupyter_contrib_nbextensionsjupyter contrib nbextension install --userjupyter nbextension enable execute_time/ExecuteTime