Skip to content

Instantly share code, notes, and snippets.

@andreh7
andreh7 / xgboost2tmva.py
Created July 27, 2018 12:12 — forked from hqucms/xgboost2tmva.py
Convert xgboost model to TMVA xml format. Not fully tested...
import re
from xml.dom.minidom import Document
def SubElement(parent, element_name, **attributes):
"""helper function to create elements in a way similar to ElementTree"""
doc = parent.ownerDocument
element = doc.createElement(element_name)
parent.appendChild(element)
for attr_name, attr_value in attributes.items():