Physics-Informed Machine Learning for VMAT MLC and Gantry Error Prediction

How domain knowledge and feature engineering reduce prediction errors by 30%

By Kayhan Kaptan - Medical Physics, Quality Control, Data Science and Automation

Machine learning (ML) has become a powerful tool in medical physics, but its success depends heavily on how well the input data captures the underlying physical processes. A recent talk by Dr. Perumal Mugan illustrates this perfectly – his team developed a model to predict MLC and gantry errors during VMAT delivery, and by incorporating physics‑informed feature engineering they cut residual errors by 30%. This article walks through the entire process, from ML fundamentals to the specific techniques that made the difference.

The Difference Between Conventional Physics and Machine Learning

In traditional programming, you provide both the input and the relationship (equation), and the program computes the output. In supervised machine learning, you provide only the input examples and the corresponding correct outputs; the algorithm learns the relationship from the data. For example, curve fitting is a rudimentary form of supervised ML. The key limitation: ML models perform well only on data similar to the training set. A model trained on head‑and‑neck plans cannot predict doses for pelvic cases. In contrast, physics‑based models (like dose calculation algorithms) rely on first principles and generalize across anatomies.

How Supervised Learning Works (Briefly)

A supervised model is trained on historical observations (input and output). It makes a random prediction, compares it to the true output (loss), and iteratively reduces the loss using an optimizer. The goal is to minimize the error between predicted and actual values. There are two main tasks: regression (predicting continuous variables, e.g., gamma pass rate percentage) and classification (predicting categories, e.g., pass/fail). Model performance is evaluated on unseen data after training and validation – the ability to generalize is what matters.

Raw data often does not directly reflect the mechanisms that cause errors. For MLC error, the underlying causes include motor load, friction from neighbouring leaves, gravity, speed, and acceleration. A simple input like “planned MLC position” cannot capture these. Therefore, the data must be transformed so that it more closely represents the physical influences. This transformation is called feature engineering.

The process involves:

  1. Identifying the physical influences (gravity, friction, etc.)
  2. Mapping available data to reflect those influences
  3. Constructing new features from the mapping
  4. Validating that the new features improve model prediction

Step 1: Understand the VMAT Delivery Data

In VMAT, the TPS defines control points, while the linac’s trajectory log records every 20 ms. The planned values in the TPS often differ from the “planned” values in the log because the TrueBeam supervisor proactively adjusts gantry speed, dose rate, and MLC speed to reduce errors. This creates a mismatch. To build a model that can predict errors before delivery (using only the TPS plan), we need to match the different time scales. In this work, each control point’s error was taken as the mean of all 20 ms samples within that control point.

Step 2: Analyze Feature‑Target Relationships

Before training, explore how each potential feature relates to the error. Use both correlation (detects monotonic relationships) and mutual information (detects any form of dependency, including non‑monotonic). For example, MLC velocity shows a strong linear correlation with MLC error (dominant feature). But features like “adjacent MLC overlap” have low correlation but high mutual information – they are still important, especially when the MLC is static.

Step 3: Engineer Physics‑Informed Features

This is the core of the work. Three key engineered features were developed:

1. Gravity Vector (Signed)

Gravity affects MLC error depending on gantry angle, collimator angle, leaf bank, and leaf direction. A signed gravity value (positive = gravity assisting movement, negative = opposing) was created from these four inputs. The analysis showed that lag errors (leaf behind) are larger when the leaf moves against gravity, and lead errors larger when moving with gravity.

2. Friction Factor

Friction between adjacent leaves depends on their overlap length and relative velocity. A friction factor was defined as relative velocity × overlap length. When leaves move in opposite directions, friction increases. The engineered friction factor showed a clear relationship with MLC error, whereas the raw overlap did not.

3. Zero‑Speed Feature Amplification

When an MLC is static (velocity = 0), velocity cannot explain the error. To give more weight to other predictors (gravity, friction, etc.) at zero speed, those descriptor values were divided by (velocity + 0.001). This makes them numerically large when velocity is near zero, allowing the model to learn from the static regime.

Six such “velocity‑normalized” features were constructed, using adjacent MLC overlap, gravity, interdigitation, dose rate, and pair opening.

Step 4: Train and Compare Models

Two feature sets were compared:

  • Set 1 (Conventional): raw MLC speed, gantry speed, dose rate, etc.
  • Set 2 (Conventional + Engineered): added the six engineered features.

Using both trajectory‑log data (for training) and DICOM RT plan data, multiple ML models (e.g., XGBoost, random forest) were trained. The engineered features consistently reduced residual error by about 30%. Additionally, models trained on trajectory‑log data performed slightly better than those using DICOM data, because the TPS planned values are adjusted by the supervisor.

Step 5: Validate with SHAP Analysis

SHAP (SHapley Additive exPlanations) confirmed that the engineered features (gravity vector, friction factor) ranked among the top three most important features, even above the dominant raw velocity.

Key Results

  • 30% reduction in residual errors with physics‑informed features.
  • Zero‑speed prediction spike eliminated – the model now predicts well even when MLCs are static.
  • Generalizability – the same methodology can be applied to other linac models (e.g., C‑series) by retraining with appropriate data.

Clinical Relevance

TrueBeam VMAT errors are typically < 0.1 mm, so direct clinical action (e.g., replanning) is rarely needed. However, for older linacs where errors reach ∼1 mm, such predictive models could flag problematic plans before delivery. More importantly, the approach demonstrates how domain knowledge can be as valuable as model fine‑tuning.

Conclusion

Machine learning in medical physics is not a black box – it works best when grounded in physics. By systematically engineering features that capture the underlying mechanisms (gravity, friction, dynamic adaptation), one can achieve substantial improvements without changing the algorithm. Future work could explore integrating LLMs for automated feature suggestion, but the core lesson remains: know your physics, transform your data, and validate the improvements.


Kaptan Data Solutions

🔍 Discover Kaptan Data Solutions — your partner for medical-physics data science & QA!

We're a French startup dedicated to building innovative web applications for medical physics, and quality assurance (QA).

Our mission: provide hospitals, cancer centers and dosimetry labs with powerful, intuitive and compliant tools that streamline beam-data acquisition, analysis and reporting.

🌐 Explore all our medical-physics services and tech updates
💻 Test our ready-to-use QA dashboards online

Our expertise covers:

📊 Interactive dashboards for linac performance & trend analysis
🔬 Patient-specific dosimetry and image QA (EPID, portal dosimetry)
📈 Statistical Process Control (SPC) & anomaly detection for beam data
🤖 Automated QA workflows with n8n + AI agents (predictive maintenance)
📑 DICOM-RT / HL7 compliant reporting and audit trails

Leveraging advanced Python analytics and n8n orchestration, we help physicists automate routine QA, detect drifts early and generate regulatory-ready PDFs in one click.

Ready to boost treatment quality and uptime? Let’s discuss your linac challenges and design a tailor-made solution!

#MedicalPhysics #Radiotherapy #LinacQA #DICOM #DataScience #Automation

Request a quote

Get in touch to discuss your specific requirements and discover how our tailor-made solutions can help you unlock the value of your data, make informed decisions, and boost operational performance!

#DataScience #Automation #Python #n8n #Streamlit #DataAnalysis #AI #Visualization

Submit your project brief and receive a proposal

Share: X (Twitter) Facebook LinkedIn

Comments