This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Titanium is light-weight evaluator for PMML models based on NumPy.

Project Description

Titanium is light-weight evaluator for PMML models based on NumPy. With Titanium you are able to take predictive model stored in pmml file, load it and start using it for making new predictions. It has the same API as you may know when using widely known machine learning libraries like Keras or scikit-learn - e.g.:

  • predict_proba(X)
  • predict_classes(X)

It natively supports batch processing as input is expected to be 2D NumPy array. For list of supported models see bellow.

The concept behind the name is that Titanium as the element is light and extremely durable material. Moreover it’s resistant to corrosion - which has a parallel as mathematics behind the neural network evaluation using matrix operations is above any particular implementations.


To install titanium, simply:

$ pip install titanium


Example on Iris data - for more examples see the examples folder.

from keras2pmml import keras2pmml
from sklearn.datasets import load_iris
import numpy as np
import theano
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers.core import Dense
from sklearn.preprocessing import StandardScaler

import titanium as ti
import os

iris = load_iris()
X =
y =

theano.config.floatX = 'float32'
X = X.astype(theano.config.floatX)
y = y.astype(np.int32)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.3)

y_train_ohe = np_utils.to_categorical(y_train)
y_test_ohe = np_utils.to_categorical(y_test)

std = StandardScaler()
X_train_scaled = std.fit_transform(X_train)
X_test_scaled = std.transform(X_test)
model = Sequential()
model.add(Dense(input_dim=X_train_scaled.shape[1], output_dim=20, activation='tanh'))
model.add(Dense(input_dim=20, output_dim=5, activation='tanh'))
model.add(Dense(input_dim=5, output_dim=y_test_ohe.shape[1], activation='sigmoid'))
model.compile(loss='categorical_crossentropy', optimizer='sgd'), y_train_ohe, nb_epoch=100, batch_size=1, verbose=3, validation_data=None)

params = {
    'copyright': 'Václav Čadek',
    'description': 'Simple Keras model for Iris dataset.',
    'model_name': 'Iris Model'

keras2pmml(model, file='iris.pmml', **params)
pmml = ti.read_pmml('iris.pmml')

keras_preds = model.predict_classes(X_test_scaled)
titanium_preds = pmml.predict_classes(X_test_scaled)

print('Accuracy (Keras): {accuracy}'.format(accuracy=accuracy_score(y_test, keras_preds)))
print('Accuracy (Titanium): {accuracy}'.format(accuracy=accuracy_score(y_test, titanium_preds)))

What is supported?

  • Models
    • keras.models.Sequential
  • Activation functions
    • tanh
    • sigmoid/logistic


This software is licensed under MIT licence.

Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
titanium-0.0.1.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Jul 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting