TFTree

Tree to tensorflow


Keywords
tensorflow, machine, learning, sklearn, spark, model-serving, xgboost
Install
pip install TFTree==0.1.2

Documentation

Covert Tree Models to Tensorflow Tree.


CircleCI PyPI version

The Goal is to have one unified tree runtime

* Convert a spark Tree/Forest into Tensorflow Graph.

* Convert a sciki-learn Tree/Forest into Tensorflow Graph.

Example

Convert fitted - sklearn.DecisionTreeClassifier - sklearn.DecisionTreeRegressor - sklearn.RandomForestRegressor - sklearn.RandomForestClassifier

to tensorflow.saved_model

All you need to do is pass your desired model_dir, './tmp' in this example and a fitted classifier.

    
    from ttt import export_decision_tree

    clf = sklearn.ensemble.RandomForestClassifier()
    clf.fit(X, y)
    features = {'features': tf.placeholder(tf.float64, [None, X.shape[1]])}
    export_decision_tree(clf, features, 'tmp')
    

And then you can server this model with tf/serving using 'tmp'