Over the last decade, we have seen tremendous interest in the application of data mining and statistical algorithms, first in research and science and, more recently across various industries, that has led to the development of myriad solutions by the data science community.

Most of the times data science algorithms are built standalone on platforms like R or python etc. In order to build a data-driven product or use these algorithms for real-time predictions it’s essential these algorithms get integrated or ported over to the application stack.

Let’s say your data Science team has built an amazingly accurate model in R using some package which has a built-in algorithm and we are ready to put it to work. However application servers run on Java, and this particular package is not available in Java. R-Java bridge would be a maintenance problem. One solution is to create Java version of R package and rebuild your algorithms using that package. This is however tedious as we just need algorithms to predict the outcomes.

To address portability of algorithms Data Mining group ~~ ~~has developed two vendor neutral standards for exporting data science algorithms, namely, Predictive Model Markup Language (PMML) and Portable Format for Analytics (PFA).

__Predictive Model Markup Language (PMML)__

The Predictive Model Markup Language (PMML) is the de facto standard language used to represent predictive analytic models. It allows for predictive solutions to be easily shared between PMML compliant applications without the need for custom coding, that is, it may be developed in one application and directly deployed on another.

Traditionally, after building a model, the data scientist team had to write a document describing the entire solution. This document was then passed to the IT engineering team, which would then recode it into the production environment to make the solution operational and scalable. With PMML, that double effort is no longer required since the predictive solution as a whole (data transformations + predictive model) is simply represented as a PMML file which is then used as is for production deployment. Now we have packages and libraries in all data mining tools (R, Python etc) to generate PMML file for the model built within the particular tool.

__Working with PMML__

The structure of a PMML file follows the steps commonly used to build a predictive solution which includes:

contains general information about the PMML document, such as copyright information for the model, its description, an attribute for a timestamp etc.*Header:*-contains definitions for all the possible fields used by the model.These include numerical, ordinal, and categorical fields.*Data Dictionary*- defines the strategies for handling missing and outlier values.*Mining Schema*- define the computations required for pre-processing the raw input data into derived fields*Data Transformations*- defines the structure and the parameters used to build the model. PMML currently covers models like Association Rules, Cluster Models, Decision Trees, Naïve Bayes classifiers, Neural Networks, Regression, Rulesets, Sequences, Support Vector Machines, Text Models, and Time Series model*Model Definition*- define the outputs expected from the model.*Outputs*- define the post-processing steps to be applied to the model output.*Targets*- defines the performance metrics obtained when passing test data through the model (as opposed to training data).*Model Explanation*- defines a sample set of input data records together with expected model outputs.*Model Verification*

Thus PMML enables the instant deployment of predictive solutions which can be expressed in their entirety(including data pre-processing, data post-processing, and modeling technique). It is currently supported by all of the top commercial and open source statistical tools.

__Portable Format for Analytics (PFA)__

The Portable Format for Analytics (PFA) is a JSON-based predictive model interchange format. It provides a common language to help smooth the transition from development to production. PFA encapsulates a unit of data processing scoring engine, the "predict" method of a model.

__Working with PFA__

When compared with PMML, PFA adds the flexibility of arbitrary function composition, rather than choosing from a set of established models. Want to partition a space with clusters and associate a different SVM to each cluster? Want to augment decision trees so that a neural network is performed at each node to decide which branch to follow? We can do all these, and many more things in PFA comfortably. Let’s understand this a bit more.

A PFA scoring engine is a JSON file containing model parameters and a scoring procedure. The scoring procedure transforms inputs to outputs by composing functions that range in complexity from addition to neural nets. If your "predict" method can be expressed in terms of common data science primitives (arithmetic, special functions, matrices, list/map manipulations, decision trees, nearest cluster/neighbor, and "lapply"-like functional programming), then it can be written in a few lines of PFA "code" (actually JSON). For example, a random forest is scored like this:

` {"a.mode":`

` {"a.map": [{"cell": "forest"},`

` {"params": [{"tree": "TreeNode"}],`

` "ret": "string",`

` "do": {"model.tree.simpleTree":`

` ["input", "tree"]}}]}}`

Starting from the innermost function call, "model.tree.simpleTree" scores "input" against a "tree", which is part of an inline user-defined function that transforms a "TreeNode" named "tree" into a "string" by scoring it, which is applied to a list of "TreeNodes" from a data cell named "forest", and the most common ("a.mode") score is reported. It could be generated automatically from an R expression like this:

`a.mode(a.map(forest, function(tree) {`

`model.tree.simpleTree(input, tree)`

` }))`

In the scenario above, the data scientist would only have to express the model in PFA for the backend engineer to plug it into a PFA implementation running in production. Thanks to a detailed conformance suite, everyone can be confident that a scoring engine that tests well in R or Python will work in Java.

Originally Posted Here

- Free machine learning course: Using ML algorithms, practices, and p...
- What are some of the disadvantages of microservices?
- Alation 2021.1 data catalog improves data intelligence
- Nvidia acquisition of Arm faces industry, regulatory hurdles
- Nvidia opens paid, instructor-led AI workshops to the public
- CTO on the need for AI ethics and diversity
- 8 benefits of a warehouse management system
- Supplier segmentation lessons in the wake of COVID-19
- 5 essential dos and don'ts of IoT implementations
- Digital acceleration opens opportunities, widens tech gap
- mob programming

© 2021 TechTarget, Inc. Powered by

Badges | Report an Issue | Privacy Policy | Terms of Service

**Most Popular Content on DSC**

To not miss this type of content in the future, subscribe to our newsletter.

- Book: Applied Stochastic Processes
- Long-range Correlations in Time Series: Modeling, Testing, Case Study
- How to Automatically Determine the Number of Clusters in your Data
- New Machine Learning Cheat Sheet | Old one
- Confidence Intervals Without Pain - With Resampling
- Advanced Machine Learning with Basic Excel
- New Perspectives on Statistical Distributions and Deep Learning
- Fascinating New Results in the Theory of Randomness
- Fast Combinatorial Feature Selection

**Other popular resources**

- Comprehensive Repository of Data Science and ML Resources
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- 100 Data Science Interview Questions and Answers
- Cheat Sheets | Curated Articles | Search | Jobs | Courses
- Post a Blog | Forum Questions | Books | Salaries | News

**Archives:** 2008-2014 |
2015-2016 |
2017-2019 |
Book 1 |
Book 2 |
More

**Most popular articles**

- Free Book and Resources for DSC Members
- New Perspectives on Statistical Distributions and Deep Learning
- Time series, Growth Modeling and Data Science Wizardy
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- Comprehensive Repository of Data Science and ML Resources
- Advanced Machine Learning with Basic Excel
- Difference between ML, Data Science, AI, Deep Learning, and Statistics
- Selected Business Analytics, Data Science and ML articles
- How to Automatically Determine the Number of Clusters in your Data
- Fascinating New Results in the Theory of Randomness
- Hire a Data Scientist | Search DSC | Find a Job
- Post a Blog | Forum Questions

## You need to be a member of Data Science Central to add comments!

Join Data Science Central