TensorFlow Tutorial
This 60-minute hands-on tutorial introduces TensorFlow and TensorFlow Probability through practical examples covering tensors, Keras neural networks, and structural time series forecasting.
Tutorial in 30 Seconds¶
TensorFlow is an open-source machine learning framework from Google for building and training neural networks and probabilistic models.
Key capabilities:
- Tensors and automatic differentiation: Immutable multi-dimensional arrays optimized for CPUs, GPUs, and TPUs with efficient gradient computation
- Keras API: High-level interface for rapidly building and training neural networks
- TensorFlow Probability: Probabilistic programming for Bayesian inference and uncertainty quantification
- Interpretable models: Structural decomposition reveals which components drive predictions
After this tutorial, you will understand:
- The core APIs of TensorFlow (tensors, variables, automatic differentiation)
- How to build and train neural networks with Keras
- Probabilistic modeling with TensorFlow Probability distributions and Bayesian inference
Official References¶
- TensorFlow: An Open Source Machine Learning Framework
- TensorFlow GitHub repo
- TensorFlow Probability
- TensorFlow Probability GitHub repo
Getting Started¶
Prerequisites¶
This tutorial runs in a Docker container with all dependencies pre-configured. No additional setup is required beyond the steps below.
Setup Instructions¶
Navigate to the tutorial directory:
> cd tutorials/TensorFlowBuild the Docker image:
> ./docker_build.sh(See
docker_build.sh)Launch Jupyter Lab:
> ./docker_jupyter.sh(See
docker_jupyter.sh)
Dependency Management¶
This project uses uv for efficient Python dependency management within the
Docker container. The system works as follows:
requirements.in— Lists top-level package dependenciesrequirements.txt— Auto-generated pinned versions for reproducibility
The Docker container comes with all dependencies pre-compiled and synced. If you need to update dependencies manually:
# Compile top-level packages into pinned requirements
> uv pip compile requirements.in -o requirements.txt
# Sync the environment with the compiled list
> uv pip sync requirements.txt- For more informations on the Docker build system refer to Project template readme
Tutorial Notebooks¶
Work through the following notebooks in order:
tensorflow.API.ipynb: Core TensorFlow fundamentals- Tensors and tensor operations
- Automatic differentiation
- Keras regression models
- TensorFlow Probability distributions
tensorflow.example.ipynb: Advanced structural time series forecasting- Data Generation: Synthetic daily time series combining multiple components
- Model Building: Approximate posterior over model parameters using Variational Inference (VI)
- Forecasting and Evaluation: End-to-end pipeline for predictions and model assessment
- Building trend and seasonality components
- Incorporating holiday effects
- Autoregressive modeling
tensorflow_utils.py: Utility functions supporting the tutorial notebooks
Changelog¶
- 2026-03-01: Initial release