PMML: The 'Save File' for Machine Learning Models
PMML is like a universal "save file" for ML models, using XML to describe everything needed for prediction: features, preprocessing, and model structure. It enables training in Python and deploying in Java. The footgun: verbose files and partial tool support.
WHY IT EXISTS PMML was created to solve the model deployment problem. Training often happens in specialized environments like Python or R, but scoring needs to run in different production systems like Java services or databases. PMML provides a vendor-neutral, interoperable format to transfer a trained model from the training environment to the scoring environment without recoding the model's logic.
THE MENTAL MODEL PMML is the "PDF for predictive models." Just as a PDF file renders the same way regardless of the OS or application that created it, a PMML file allows a model trained in one system to be executed by a completely different system. It's a self-contained, descriptive file format based on XML that captures the entire predictive pipeline, from input data definitions to the final model parameters.
HOW IT WORKS A PMML file is a structured XML document with several key sections. The DataDictionary defines all input features and their types (e.g., continuous, categorical). The TransformationDictionary specifies preprocessing steps like normalization or binning. The MiningSchema indicates which features are inputs and which is the target. Finally, a model-specific element like TreeModel or NeuralNetwork contains the actual trained model parameters, such as tree splits or network weights. A PMML-compliant scoring engine parses this XML and executes the steps to generate a prediction.
WHEN TO USE IT Use PMML when you need to decouple your model training environment from your model serving environment. It's ideal for regulated industries requiring model transparency and for enterprises with heterogeneous tech stacks (e.g., data scientists using Python, production services running on the JVM). It allows you to "export" a model from tools like R, Python (with libraries like sklearn2pmml), or SAS and "import" it into a dedicated scoring engine.
WHEN NOT TO USE IT Avoid PMML for highly custom or cutting-edge models not covered by the standard. The XML format can also be verbose and less performant for serialization compared to binary formats like ONNX or Pickle. If your training and deployment environments are identical (e.g., a pure Python stack), a simpler native format is often more efficient.
ONE CANONICAL EXAMPLE A bank trains a decision tree model in Python to predict loan default. Instead of having Java engineers re-implement the tree's logic, the data scientist exports the model to a loan_model.pmml file. This single XML file, containing the feature definitions and all the tree's split points and decisions, is then loaded by the bank's Java-based loan application system to score new applicants in real-time.
Read the original → dmg.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.