Arrange the steps in the order they must occur to collect data, train, and deploy an end-to-end behavioral cloning model.
Section 7.2 Training Loops & Regression Evaluation
Because steering a robot involves selecting a value along a continuous spectrum (e.g., steering anywhere from \(-30^\circ\) to \(+30^\circ\)), behavioral cloning operates as a regression task.
To determine how accurately our model has cloned the expertβs behavior during a training loop, we must evaluate its performance mathematically. The standard metric used to calculate this error is the Mean Squared Error (MSE). MSE measures the average squared difference between the modelβs predicted steering values and the true expert labels across the dataset:
\begin{equation*}
\operatorname{MSE} = \frac{1}{n} \sum_{i=1}^{n} \left(y_i - \hat{y}_i\right)^2
\end{equation*}
Where:
-
\(y_i\) is the actual target command provided by the expert driver.
-
\(\hat{y}_i\) is the command predicted by the autonomous driving network.
-
\(n\) is the total number of data samples evaluated.
The Data Collection Loop
A behavioral cloning model is only as good as the data used to train it. The end-to-end training loop follows four main steps: Record Human Drive β Preprocess Data β Train Model (Regression) β Evaluate & Deploy.
-
Recording: Capture synchronized camera frames (30 Hz) and control actions \((v, \omega)\text{.}\)
-
Preprocessing: Normalize image pixel values and scale control inputs (e.g., mapping motor values to \([-1.0, 1.0]\)).
-
Training (Regression Task): Because motor outputs like velocity \(v\) and turn rate \(\omega\) are continuous numerical values, behavioral cloning treats control estimation as a regression problem. The training algorithm minimizes the difference between human actions \(y_{\text{human}}\) and model predictions \(\hat{y}_{\text{model}}\text{.}\)
-
Evaluation: Calculate error metrics such as Mean Squared Error (MSE) before deploying the model to physical hardware.
Subsection 7.2.1 Section 7.2 Interactive Exercises

Subsubsection 7.2.1.1 Exercise 7.2.1: ActiveCode Exercise β Building a Motor Command Regression Evaluation Loop
Note: Because Runestone CodeLens runs standard Python without external machine learning libraries, we implement a pure-Python regression evaluation loop below!
In this exercise, you will complete a function that evaluates a trained end-to-end control model against a mock dataset of human expert steering actions \((v, \omega)\text{.}\)
Task:
-
Compute the Mean Absolute Error (MAE) between the humanβs linear velocity commands and the modelβs predicted commands.
-
Print whether the model passes safety evaluation (Average Error \(< 0.1\) m/s).
Subsubsection 7.2.1.2 Exercise 7.2.2: Parsons Problem β End-to-End Data Pipeline Execution
Reorder the steps below to form the correct sequence for training and deploying an end-to-end behavioral cloning robot.
Checkpoint 7.2.2.
You have attempted of activities on this page.
